<div dir="ltr">I managed to add more than one stencils by using the combined_vtkImageStencilData->Add(new_vtkImageStencilData) and then setting vtkImageStencil->AddStencil(combined_vtkImageStencilData);<div><br></div>
<div>However, I have not been able to figure out a way to set the foreground color of any stencil to a given value. The aim is to show every stencil with a different color in the vtkImageData (= vtkImageStencil->GetOutput()).</div>
<div><br></div><div>Any help will be highly appreciated.</div><div><br></div><div><br></div><div>Thanks,</div><div>Prathamesh</div><div><br><div class="gmail_quote">On Thu, Jul 15, 2010 at 6:52 PM, Prathamesh Kulkarni <span dir="ltr"><<a href="mailto:prathameshmkulkarni@gmail.com">prathameshmkulkarni@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div dir="ltr">I managed use vtkImageStencil and vtkImageAccumulate, but could not get a proper blended image output with vtkImageBlend. Following is my code snippet for vtkImageBlend:<br>
<br> blended_image->SetInput(image_data);<br>
blended_image->SetStencil(image_stencil_data);<br><br> blended_image->SetOpacity(1, opacity)<br> blended_image->Update();<br><br>When I try to render blended_image->GetOutput(), I simply get the input image, as if setting the stencil had no effect. I expected to see a different opacity in the stencil region. Please tell me if I am missing anything here.<br>
<br><br>Also, I was wondering how to add multiple stencils to vtkImageStencil so that at the output I can have a vtkImageData showing multiple stencils with different colors. <br><br>In any case, I did not understand how to set the foreground color of a single stencil. <br>
<br><br><br>Sorry for putting in 3 questions together.. Thanks for your answers in advance.<br><font color="#888888"><br><br>Prathamesh<br><br><br></font><div class="gmail_quote"><div class="im">On Wed, Jul 14, 2010 at 5:31 PM, David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>></span> wrote:<br>
</div><div><div></div><div class="h5"><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">Hi Prathamesh,<br>
<br>
You should use either vtkClipVolume or vtkImageStencil, based on what<br>
you want as an output. The vtkClipVolume filter will output an<br>
unstructured grid, i.e. it will produce a geometric data set<br>
consisting of voxel cells (each voxel cell will be a little cube with<br>
eight points at its corners). If you want the output to be an actual<br>
image, with the background set to black or to transparent, then you<br>
should use vtkImageStencil.<br>
<br>
In either case, the best place to start is vtkImplicitLoop, which<br>
takes a contour and produces an "implicit function", which in<br>
VTK-speak, is a function used to define the inside vs. the outside of<br>
a selection area. Then the vtkImplicitLoop can be used as an input to<br>
vtkImplicitFunctionToImageStencil. The output of<br>
vtkImplicitFunctionToImageStencil can then be used as an input to e.g.<br>
vtkImageBlend (for pasting a cut-out image onto another image),<br>
vtkImageStencil (for blacking out the non-selected region of the<br>
image), or vtkImageAccumulate (for computing the average value,<br>
standard deviation, or the histogram of the image area inside the<br>
stencil).<br>
<font color="#888888"><br>
David<br>
</font><div><div></div><div><br>
<br>
<br>
<br>
On Wed, Jul 14, 2010 at 4:13 PM, Prathamesh Kulkarni<br>
<<a href="mailto:prathameshmkulkarni@gmail.com" target="_blank">prathameshmkulkarni@gmail.com</a>> wrote:<br>
><br>
> Hello all,<br>
><br>
> I want to extract a sub-image from vtkImageData given a closed set of points<br>
> forming any arbitrary shape (may be a vtkPolyData).<br>
><br>
> I have been looking at vtk classes like vtkClipVolume, vtkExtractVOI,<br>
> vtkImageStencil. I am no able to understand which way should be preferred<br>
> over which to do my task. Also, I am not able to figure out the exact<br>
> pipeline structure for these clipping methods.<br>
><br>
> Could someone please throw some light on this?<br>
><br>
> Thanks,<br>
> Prathamesh<br>
><br>
</div></div><div><div></div><div>> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at:<br>
> <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
><br>
><br>
</div></div></blockquote></div></div></div><br></div>
</blockquote></div><br></div></div>