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

David Gobbi david.gobbi at gmail.com
Fri Nov 7 12:34:16 EST 2014


A lot of people ask what VTK's units are.  I'll answer with a question:
In the equation y = 2*x, what are the units of y?  The answer, of course,
is that the units of y are the same as the units of x (we will assume "2"
has no units).  Just like the equation y=2*x, the VTK filters assume that
the user already knows what units they are working in.

Angles are a special case.  The vtkCylindricalTransform uses radians
(as stated in its documentation).

 - David


On Fri, Nov 7, 2014 at 10:10 AM, Vincent SALEH <vincent.saleh at magellium.fr>
wrote:

> Hi David,
>
> I followed the steps you advised and it looks ok.
>
> Final question (I hope), I am just wondering what are the units of each
> variables: radius, circumferential angle, and longitudinal sample spacings.
>
> Thanks in advance.
>
>
>
> *De :* David Gobbi [mailto:david.gobbi at gmail.com]
> *Envoyé :* vendredi 7 novembre 2014 15:49
> *À :* Vincent SALEH
> *Cc :* VTK Users
> *Objet :* Re: [vtkusers] Extract a tube of data from DICOM series data
>
>
>
> 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 at magellium.fr> 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
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20141107/ca4e2659/attachment.html>


More information about the vtkusers mailing list