[vtkusers] Extract a tube of data from DICOM series data

David Gobbi david.gobbi at gmail.com
Thu Nov 13 11:58:25 EST 2014


On Thu, Nov 13, 2014 at 9:35 AM, Vincent32160 <vsh at magellium.fr> wrote:

> Hi David,
> I am still trying to unwrapped my cylinder.
> Unfortunately I don't get what you mean by "you can select one
> "radius" slice for viewing". Should I use a vtkImageViewer2 to do it?
>

When the cylinder has been unwrapped (via vtkImageReslice and a
vtkCylindricalTransform), you get a volume where the coordinates
are (r,theta,z).  So, yes, you could set the orientation of vtkImageViewer2
so that it extracts slices along the first axis instead of along the third
axis.
Or you could set the OutputExtent of vtkImageReslice so that it only
produces the single "r" slice that you want.



> Another question: I would like also to unwrap cylinder which don't have the
> same center as the original cylinder. Is that possible with
> vtkImageReslice?


Yes.  Use vtkImageChangeInformation's SetOutputOrigin() method to
adjust the input image, instead of using CenterImageOn().  This will allow
you
to put the center of the cylinder anywhere you want.   In VTK, the "Origin"
of
the image means the position, in physical coordinates, of the first voxel.
So
if you know what voxel you want to be at the center of the cylinder, you can
use algebra to compute how to set the Origin so that the physical
coordinates
of that voxel are (0,0,0).  Drawing diagrams helps.

 - David



> David Gobbi wrote
> > Hi Vincent,
> >
> > The input to vtkImageReslice should be the original image
> > (before either stencil has been applied).  In order for
> > vtkImageReslice to do the interpolation properly, it must
> > have neighbor voxels for each voxel it extracts.  After it
> > has unwrapped the whole cylinder, you can select one
> > "radius" slice for viewing.
> >
> > With vtkImageReslice, you _must_ specify what output
> > sampling you want.  Use SetOutputSpacing() to set the
> > radius, circumferential angle, and longitudinal sample
> > spacings.  Also use SetOutputExtent() to set the
> > number of samples for each.
> >
> > I may have been wrong about having to invert the
> > transform.  Try feeding it in without GetInverse().
> >
> > Also, for the transform to work properly, the input image must
> > be centered.  After all, in cylindrical coordinates the assuption
> > is that (0,0,0) is at the center of the cylinder.  The filter
> > vtkImageChangeInformation can center the image (i.e. put
> > vtkImageChangeInformation with CenterImageOn() before
> > vtkImageReslice).
> >
> > Good luck,
> >
> >  - David
> >
> >
> > On Fri, Nov 7, 2014 at 7:29 AM, Vincent32160 <
>
> > vsh@
>
> > > wrote:
> >
> >> I now have a tube of data. On the right, you see stencilFiltrer2, the
> >> result
> >> of two vtkROIStencilSource (the first to remove the outer voxels and the
> >> second the inner)
> >> <http://vtk.1045678.n5.nabble.com/file/n5729402/output3.png>
> >>
> >> I try to use vtkCylindricalTransform and vtkImageReslice to unwrap the
> >> tube
> >> and I don't get the result I want. Could you help?
> >>
> >> //Image Reslice
> >> vtkCylindricalTransform * cylTransform = vtkCylindricalTransform::New();
> >>
> >> vtkImageReslice * imageReslice = vtkImageReslice::New();
> >> imageReslice->SetInputConnection(stencilFilter2->GetOutputPort());
> >> imageReslice->SetResliceTransform(cylTransform->GetInverse());
> >> imageReslice->Update();
> >>
> >> // Create volume
> >> vtkSmartPointer
> > <vtkPiecewiseFunction>
> >  outputOpacity =
> >>         vtkSmartPointer
> > <vtkPiecewiseFunction>
> > ::New();
> >> outputOpacity->AddPoint(-1000, 1.0);
> >> outputOpacity->AddPoint(3000, 0.0);
> >>
> >> // Create volume mapper
> >> vtkVolumeRayCastMapper * imageMapper3d = vtkVolumeRayCastMapper::New();
> >> imageMapper3d->SetInputConnection(imageReslice->GetOutputPort());
> >> imageMapper3d->SetVolumeRayCastFunction(rayCastFunction);
> >>
> >> // Volume property
> >> vtkSmartPointer
> > <vtkVolumeProperty>
> >  outputVolumeProperty =
> >>         vtkSmartPointer
> > <vtkVolumeProperty>
> > ::New();
> >> outputVolumeProperty->SetScalarOpacity(outputOpacity);
> >> outputVolumeProperty->SetInterpolationTypeToLinear();
> >> outputVolumeProperty->ShadeOn();
> >>
> >> // Displayed volume
> >> vtkSmartPointer
> > <vtkVolume>
> >  extractedVol =
> >> vtkSmartPointer
> > <vtkVolume>
> > ::New();
> >> extractedVol->SetMapper(imageMapper3d);
> >> extractedVol->SetProperty(outputVolumeProperty);
> >>
> >> Thanks
> >>
> >>
> >> David Gobbi wrote
> >> > Hi Vincent,
> >> >
> >> > Use an opacity transfer function that makes the black voxels
> >> transparent.
> >> >
> >> > You can unwrap the tube by reslicing it through an inverse cylindrical
> >> > transformation (e.g. vtkCylindricalTransform and vtkImageReslice).
> >> >
> >> >  - David
> >> >
> >> > On Thu, Nov 6, 2014 at 7:05 AM, Vincent32160 <
> >>
> >> > vsh@
> >>
> >> > > wrote:
> >> >
> >> >> Thanks again David!
> >> >>
> >> >> As I want to keep a volume I chose solution 2.
> >> >> I used a volume mapper and the result is pretty good.
> >> >> The only problem is that I am not able to remove the black voxels
> >> around
> >> >> the
> >> >> cylinder. (See picture)
> >> >> <http://vtk.1045678.n5.nabble.com/file/n5729393/output2.png>
> >> >>
> >> >> The next step of my approach is to be able to keep only the voxels on
> >> the
> >> >> edges (meaning on a tube or hollow cylinder of 1-voxel thickness).
> And
> >> >> after
> >> >> that I would like to unfold the tube and have a flat surface of
> >> pixels.
> >> >> Let me know if you think that it is better to create a new thread for
> >> >> these
> >> >> two next steps.
> >> >>
> >> >> Thanks for your help.
> >> >>
> >> >> Vincent
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >>
> http://vtk.1045678.n5.nabble.com/Extract-a-tube-of-data-from-DICOM-series-data-tp5729381p5729393.html
> >> >> Sent from the VTK - Users mailing list archive at Nabble.com.
> >> >> _______________________________________________
> >> >> Powered by www.kitware.com
> >> >>
> >> >> Visit other Kitware open-source projects at
> >> >> http://www.kitware.com/opensource/opensource.html
> >> >>
> >> >> Please keep messages on-topic and check the VTK FAQ at:
> >> >> http://www.vtk.org/Wiki/VTK_FAQ
> >> >>
> >> >> Follow this link to subscribe/unsubscribe:
> >> >> http://public.kitware.com/mailman/listinfo/vtkusers
> >> >>
> >> >
> >> > _______________________________________________
> >> > Powered by www.kitware.com
> >> >
> >> > Visit other Kitware open-source projects at
> >> > http://www.kitware.com/opensource/opensource.html
> >> >
> >> > Please keep messages on-topic and check the VTK FAQ at:
> >> > http://www.vtk.org/Wiki/VTK_FAQ
> >> >
> >> > Follow this link to subscribe/unsubscribe:
> >> > http://public.kitware.com/mailman/listinfo/vtkusers
> >>
> >>
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://vtk.1045678.n5.nabble.com/Extract-a-tube-of-data-from-DICOM-series-data-tp5729381p5729402.html
> >> Sent from the VTK - Users mailing list archive at Nabble.com.
> >> _______________________________________________
> >> Powered by www.kitware.com
> >>
> >> Visit other Kitware open-source projects at
> >> http://www.kitware.com/opensource/opensource.html
> >>
> >> Please keep messages on-topic and check the VTK FAQ at:
> >> http://www.vtk.org/Wiki/VTK_FAQ
> >>
> >> Follow this link to subscribe/unsubscribe:
> >> http://public.kitware.com/mailman/listinfo/vtkusers
> >>
> >
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the VTK FAQ at:
> > http://www.vtk.org/Wiki/VTK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://public.kitware.com/mailman/listinfo/vtkusers
>
>
>
>
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/Extract-a-tube-of-data-from-DICOM-series-data-tp5729381p5729459.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20141113/66e6e9d8/attachment.html>


More information about the vtkusers mailing list