[vtkusers] Slice through vtkImageStencilData

David Gobbi david.gobbi at gmail.com
Thu Oct 4 11:14:35 EDT 2012


Hi Vincent,

But vtkImageReslice does not reslice the stencil.  The stencil (both
the input stencil and the output stencil) is in the coordinate system
of the output image.

The way that vtkImageReslice works, it requires an uncompressed
image for fast random-access of pixels.  If you need to reslice a
vtkImageStencilData in XZ or YZ, then you could write your own filter
to do that efficiently.  To reslice a vtkImageStencilData in an
oblique direction, you would have to convert it to a binary image
first.

 - David

On Thu, Oct 4, 2012 at 3:35 AM, Vincent LEFORT
<vincent.lefort at aquilab.com> wrote:
> Hi,
>
> Yes David, I want to slice in different directions (XZ, YZ or oblique), I was thinking about the vtkImageReslice because it can generate stencil output after slicing in different directions.
>
> And using a vtkImageData, is functional (what I do currently), but using 1 byte to store an information that could be store in 1 bit, is not optimal in memory. So convert a vtkImageStencilData to vtkImageData before slicing is not interesting.
>
> So, using vtkImageStencilData is an idea of compress data volume to say "i'm inside or outside the contour".
> After the slice operation (the problem here), extract the contour with vtkContourFilter or vtkMarchingSquares and display it in an actor to show the proper data will be ok.
>
> And using a vtkImageData using the scalar type VTK_BIT doesn't work with vtkImageReslice...
>
> Maybe, in this case other solutions are preferable : recode vtkImageReslice to support compressed input volume (RLE) or VTK_BIT, using octree, other...
>
> Any idea ?
>
> Regards,
>
> Vincent
>
> -----Message d'origine-----
> De : Jothybasu Selvaraj [mailto:jothybasu at gmail.com]
> Envoyé : mercredi 3 octobre 2012 17:18
> À : David Gobbi
> Cc : Vincent LEFORT; vtkusers at vtk.org
> Objet : Re: [vtkusers] Slice through vtkImageStencilData
>
> But I think we can convert vtkImageStencilData into a vtkImageData using vtkImageStencil (if you have the original image data & image stencil data).
>
> Something like this
>
> vtkSmartPointer<vtkImageStencil>stencil2=
>             vtkSmartPointer<vtkImageStencil>::New();
>     stencil2->SetStencil(stencilData);
>     stencil2->SetInput(imgData);
>     stencil2->ReverseStencilOff();
>     stencil2->SetBackgroundValue(0);
>     stencil2->Update();
>
> Jothy
>
> On Wed, Oct 3, 2012 at 4:11 PM, David Gobbi <david.gobbi at gmail.com> wrote:
>> Hi Vincent,
>>
>> The quick answer is no, you cannot use vtkImageReslice to slice
>> through a vtkImageStencilData.  The image input is not optional, and
>> cannot be faked.
>>
>> But I don't know what you mean by "slice through, and display later".
>> A vtkImageStencilData is already stored as a stack of slices, more or
>> less.  Do you mean to slice through it in different directions, i.e.
>> with XZ or YZ slices instead of XY slices?
>>
>>  - David
>>
>>
>> On Wed, Oct 3, 2012 at 8:20 AM, Vincent LEFORT
>> <vincent.lefort at aquilab.com> wrote:
>>> Hello,
>>>
>>> Is it possible to slice through a vtkImageStencilData ?
>>>
>>> I know is it possible to get the result of a slice operation using a
>>> vtkImageReslice and an input vtkImageStencilData (using
>>> GenerateStencilOutputOn), and get the output stencil, but i would
>>> like the same thing without using an entry in vtkImageReslice (but
>>> the entry 0 is not optional).
>>>
>>> Maybe, there is an other way to do this (or generate a fake
>>> vtkImageData without allocation of fake data) ?
>>>
>>> The final goal, is to have a very light structure to embed a bit
>>> volume representation for contours/structure (1 bit indicate if we
>>> are inside a contour or outside by voxel), and slice through, and display it after.
>>>
>>> Regards,
>>>
>>> Vincent
>> _______________________________________________
>> 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
>
>
>
> --
> Jothybasu Selvaraj
> PhD Student
> University of Liverpool
> UK



More information about the vtkusers mailing list