<div dir="ltr">A lot of people ask what VTK's units are.  I'll answer with a question:<div>In the equation y = 2*x, what are the units of y?  The answer, of course,</div><div>is that the units of y are the same as the units of x (we will assume "2"</div><div>has no units).  Just like the equation y=2*x, the VTK filters assume that</div><div>the user already knows what units they are working in.</div><div><br></div><div>Angles are a special case.  The vtkCylindricalTransform uses radians</div><div>(as stated in its documentation).</div><div><br></div><div> - David</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 7, 2014 at 10:10 AM, Vincent SALEH <span dir="ltr"><<a href="mailto:vincent.saleh@magellium.fr" target="_blank">vincent.saleh@magellium.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="FR" link="blue" vlink="purple"><div><p class="MsoNormal">Hi David,<u></u><u></u></p><p class="MsoNormal"><span lang="EN-US">I followed the steps you advised and it looks ok.<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US">Final question (I hope), I am just wondering what are the units of each variables: radius, circumferential angle, and longitudinal sample spacings.<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US">Thanks in advance.<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">De :</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> David Gobbi [mailto:<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>] <br><b>Envoyé :</b> vendredi 7 novembre 2014 15:49<br><b>À :</b> Vincent SALEH<br><b>Cc :</b> VTK Users<br><b>Objet :</b> Re: [vtkusers] Extract a tube of data from DICOM series data<u></u><u></u></span></p><div><div class="h5"><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><div><p class="MsoNormal">Hi Vincent,<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">The input to vtkImageReslice should be the original image<u></u><u></u></p></div><div><p class="MsoNormal">(before either stencil has been applied).  In order for<u></u><u></u></p></div><div><p class="MsoNormal">vtkImageReslice to do the interpolation properly, it must<u></u><u></u></p></div><div><p class="MsoNormal">have neighbor voxels for each voxel it extracts.  After it<u></u><u></u></p></div><div><p class="MsoNormal">has unwrapped the whole cylinder, you can select one<u></u><u></u></p></div><div><p class="MsoNormal">"radius" slice for viewing.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">With vtkImageReslice, you _must_ specify what output<u></u><u></u></p></div><div><p class="MsoNormal">sampling you want.  Use SetOutputSpacing() to set the<u></u><u></u></p></div><div><p class="MsoNormal">radius, circumferential angle, and longitudinal sample<u></u><u></u></p></div><div><p class="MsoNormal">spacings.  Also use SetOutputExtent() to set the<u></u><u></u></p></div><div><p class="MsoNormal">number of samples for each.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">I may have been wrong about having to invert the<u></u><u></u></p></div><div><p class="MsoNormal">transform.  Try feeding it in without GetInverse().<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Also, for the transform to work properly, the input image must<u></u><u></u></p></div><div><p class="MsoNormal">be centered.  After all, in cylindrical coordinates the assuption<u></u><u></u></p></div><div><p class="MsoNormal">is that (0,0,0) is at the center of the cylinder.  The filter<u></u><u></u></p></div><div><p class="MsoNormal">vtkImageChangeInformation can center the image (i.e. put<u></u><u></u></p></div><div><p class="MsoNormal">vtkImageChangeInformation with CenterImageOn() before<u></u><u></u></p></div><div><p class="MsoNormal">vtkImageReslice).<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Good luck,<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"> - David <u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div></div><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On Fri, Nov 7, 2014 at 7:29 AM, Vincent32160 <<a href="mailto:vsh@magellium.fr" target="_blank">vsh@magellium.fr</a>> wrote:<u></u><u></u></p><p class="MsoNormal">I now have a tube of data. On the right, you see stencilFiltrer2, the result<br>of two vtkROIStencilSource (the first to remove the outer voxels and the<br>second the inner)<br><<a href="http://vtk.1045678.n5.nabble.com/file/n5729402/output3.png" target="_blank">http://vtk.1045678.n5.nabble.com/file/n5729402/output3.png</a>><br><br>I try to use vtkCylindricalTransform and vtkImageReslice to unwrap the tube<br>and I don't get the result I want. Could you help?<br><br>//Image Reslice<br>vtkCylindricalTransform * cylTransform = vtkCylindricalTransform::New();<br><br>vtkImageReslice * imageReslice = vtkImageReslice::New();<br>imageReslice->SetInputConnection(stencilFilter2->GetOutputPort());<br>imageReslice->SetResliceTransform(cylTransform->GetInverse());<br>imageReslice->Update();<br><br>// Create volume<br>vtkSmartPointer<vtkPiecewiseFunction> outputOpacity =<br>        vtkSmartPointer<vtkPiecewiseFunction>::New();<br>outputOpacity->AddPoint(-1000, 1.0);<br>outputOpacity->AddPoint(3000, 0.0);<br><br>// Create volume mapper<br>vtkVolumeRayCastMapper * imageMapper3d = vtkVolumeRayCastMapper::New();<br>imageMapper3d->SetInputConnection(imageReslice->GetOutputPort());<br>imageMapper3d->SetVolumeRayCastFunction(rayCastFunction);<br><br>// Volume property<br>vtkSmartPointer<vtkVolumeProperty> outputVolumeProperty =<br>        vtkSmartPointer<vtkVolumeProperty>::New();<br>outputVolumeProperty->SetScalarOpacity(outputOpacity);<br>outputVolumeProperty->SetInterpolationTypeToLinear();<br>outputVolumeProperty->ShadeOn();<br><br>// Displayed volume<br>vtkSmartPointer<vtkVolume> extractedVol = vtkSmartPointer<vtkVolume>::New();<br>extractedVol->SetMapper(imageMapper3d);<br>extractedVol->SetProperty(outputVolumeProperty);<br><br>Thanks<br><br><br>David Gobbi wrote<br>> Hi Vincent,<br>><br>> Use an opacity transfer function that makes the black voxels transparent.<br>><br>> You can unwrap the tube by reslicing it through an inverse cylindrical<br>> transformation (e.g. vtkCylindricalTransform and vtkImageReslice).<br>><br>>  - David<br>><br>> On Thu, Nov 6, 2014 at 7:05 AM, Vincent32160 &lt;<br><br>> vsh@<br><br>> &gt; wrote:<br>><br>>> Thanks again David!<br>>><br>>> As I want to keep a volume I chose solution 2.<br>>> I used a volume mapper and the result is pretty good.<br>>> The only problem is that I am not able to remove the black voxels around<br>>> the<br>>> cylinder. (See picture)<br>>> &lt;<a href="http://vtk.1045678.n5.nabble.com/file/n5729393/output2.png&gt" target="_blank">http://vtk.1045678.n5.nabble.com/file/n5729393/output2.png&gt</a>;<u></u><u></u></p><div><div><p class="MsoNormal">>><br>>> The next step of my approach is to be able to keep only the voxels on the<br>>> edges (meaning on a tube or hollow cylinder of 1-voxel thickness). And<br>>> after<br>>> that I would like to unfold the tube and have a flat surface of pixels.<br>>> Let me know if you think that it is better to create a new thread for<br>>> these<br>>> two next steps.<br>>><br>>> Thanks for your help.<br>>><br>>> Vincent<br>>><br>>><br>>><br>>><br>>> --<br>>> View this message in context:<br>>> <a href="http://vtk.1045678.n5.nabble.com/Extract-a-tube-of-data-from-DICOM-series-data-tp5729381p5729393.html" target="_blank">http://vtk.1045678.n5.nabble.com/Extract-a-tube-of-data-from-DICOM-series-data-tp5729381p5729393.html</a><br>>> Sent from the VTK - Users mailing list archive at Nabble.com.<br>>> _______________________________________________<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://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>>><br>><br>> _______________________________________________<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://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br><br><br><br><br><br>--<u></u><u></u></p></div></div><p class="MsoNormal">View this message in context: <a href="http://vtk.1045678.n5.nabble.com/Extract-a-tube-of-data-from-DICOM-series-data-tp5729381p5729402.html" target="_blank">http://vtk.1045678.n5.nabble.com/Extract-a-tube-of-data-from-DICOM-series-data-tp5729381p5729402.html</a><u></u><u></u></p><div><div><p class="MsoNormal">Sent from the VTK - Users mailing list archive at Nabble.com.<br>_______________________________________________<br>Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br><br>Visit other Kitware open-source projects at <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: <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://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><u></u><u></u></p></div></div></div><p class="MsoNormal"><u></u> <u></u></p></div></div></div></div></div></blockquote></div><br></div>