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

vlibertiaux vlibertiaux at gmail.com
Thu Feb 17 15:50:12 EST 2011


Hi David,

thank you very much for your quick reply.

I have now a better understanding of those classes.

Now, I am still a but confused about how to but everything together.

Let me detail to see if there is a flaw in my reasoning: (I updated the code
http://codepad.org/TOOpENlx)

my input imagedata, the one I want to clip has an extent of 802*831*514.  I
want to clip it with a finite element described by the dataset element.  

So first I compute the extent corresponding to the element with respect to
the imagedata.  This extent is a bounding box enclosing the actual finite
element.  (lines 14->29)

Then I transform the coordinates of the element nodes to fit in the new
extent (lines 31->50)

I set the vtkImplicitDataSet with the vtkDataSet element, apply the
previously computed transform and give this ImplicitDataSet as the input of
the vtkImplicitFunctionToImageStencil (lines 52 ->55).

As far as this latter is concerned, I used the original imagedata as the
input for SetInformationMethod(). I assumed that the size of the stencil is
not just the size of the cookie-cutter.  Am I right ?

Finally, I pass data->GetOutpoutPort() as the input for the
vtkImageReslice->SetInputConnection(), keep the spacing and origin the same
(I saw you recommended it in a previous post to actually clip an image) and
apply the stencil.

After those operations, I print the output of the reslice object (through
GetComponentAsDouble) but I don't have any "2" (my background value),
meaning that something went wrong.  It is like if the stencil was not
applied.  Thus, the value enclosed in the bounding box of the finite element
but not enclosed in this latter are accounted for.

Could you please help me see where did I go wrong ?

Thank you very much,

best regards,

V. 
-- 
View this message in context: http://vtk.1045678.n5.nabble.com/Reslice-an-image-with-a-stencil-using-a-dataset-tp3390074p3390154.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list