[vtkusers] Reslice an image with a stencil using a dataset.

David Gobbi david.gobbi at gmail.com
Thu Feb 17 17:18:52 EST 2011


Well, the first thing to understand is that vtkImplicitDataSet
requires that the data set has scalars.  I'm not sure what kind of
values it returns for points outside of the data set (or outside of
the element, in your case), so check the documentation to see what it
says about that.

You should check the vtkImplicitDataSet yourself using its
FunctionValue(x,y,z) method to make sure that it is returning the
values that you expect inside and outside of your element.  If it
isn't, then you'll have to sort that out first before you start
worrying about the stencil.

With the Origin/Spacing transforms, what you are doing does not look
correct to me.  The reason that vtkImageData and vtkImageStencilData
have an origin and spacing is so that the imaging pipeline can
automatically compute the correct (x,y,z) "data position" of each
voxel.  By applying a transform to the implicit function, It looks
like you are doing this calculation yourself, and you shouldn't,
because the filters will take care of it for you.

  - David






On Thu, Feb 17, 2011 at 3:06 PM, vlibertiaux <vlibertiaux at gmail.com> wrote:
>
> Hi David,
>
> The vtkDataSet element contains the coordinates of a single element. It is
> given as the input of the function, so we can think this element as the full
> mesh as far as the code I'm working on is concerned.
>
> What I cannot still figure out is why the stencil is not working as it
> should.  The vtkImplicitFunctionToImageStencil was, to my opinion, given the
> good input.  There should be some 2's (background value) when I call the
> reslice->GetOutput() imagedata because I know for sure that the element is
> strictly smaller than it's corresponding bounding box (the element is not a
> cube).
>
> Now knowing that I am working on a single element already extracted in a
> previous part of the code, could you help me figure out why the stencil does
> not seem to perform his task ?
>
> Anyway, I am really grateful to you for the time you spent answering my
> questions.
>
> Best regards,
>
> V.
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/Reslice-an-image-with-a-stencil-using-a-dataset-tp3390074p3390240.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://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list