I managed to work it out by filling a vtkImageData with the ITK values.<div><br>
<br><br><div class="gmail_quote">On Wed, Oct 19, 2011 at 4:11 PM, Divya Rathore <span dir="ltr"><<a href="mailto:divyarathore@gmail.com">divyarathore@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Somehow, populating objects of various VTK classes with C/C++ type arrays/vectors has always scared me. I found it very easy to miss one thing or the other. I shall try that once again, nonetheless.<div><br></div><div>I will try to feed an object of vtkImageData (<a href="http://www.vtk.org/doc/release/5.8/html/a00911.html" target="_blank">http://www.vtk.org/doc/release/5.8/html/a00911.html</a>) with the slices that ITK has read and put in a vector for me.</div>
<div><br></div><div>Thanks for the suggestion, Jothy.</div><div><br></div><div>best regards,</div><div>Divya</div><div><div></div><div class="h5"><div>
<br><br><div class="gmail_quote">On Wed, Oct 19, 2011 at 3:59 PM, Jothybasu Selvaraj <span dir="ltr"><<a href="mailto:jothybasu@gmail.com" target="_blank">jothybasu@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 am not much familiar with ITK, but if you convert all the 2D images into vtkImageData (all having the same extent and no. of scalar components) you could convert it into a 3D image set with vtkImageAppend. <br>
<br>OTHERWISE<br><br>If it is possible to create 3D c array from the itk images could vtkImageImport to import into vtk. <br><br><br>Jothy<div><div></div><div><br><br><div class="gmail_quote">On Wed, Oct 19, 2011 at 3:47 PM, Divya Rathore <span dir="ltr"><<a href="mailto:divyarathore@gmail.com" target="_blank">divyarathore@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks for the response, Jothy.<div><br></div><div>I did came across this sample. Unfortunately, the data has already been read and re-reading is not an option here (the example you refered to reads the data using itk::ImageSeriesReader).</div>
<div><br></div><div>I have no choice but to supply <span style="font-family:Consolas;font-size:13px;white-space:pre-wrap;background-color:rgb(255, 255, 255)">vector<ImageType::Pointer> ImageArray</span> into the <span style="font-family:Consolas;font-size:13px;white-space:pre-wrap;background-color:rgb(255, 255, 255)">itk::ImageToVTKImageFilter.</span></div>
<div><br></div><div>
Any suggestions?</div><div><br></div><div>best regards,</div><div>Divya</div><div><div></div><div><div><br><br><div class="gmail_quote">On Wed, Oct 19, 2011 at 3:35 PM, Jothybasu Selvaraj <span dir="ltr"><<a href="mailto:jothybasu@gmail.com" target="_blank">jothybasu@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">First try to convert your 2D slices into a 3D volume using itk. Have a look at this<br><br><a href="http://www.vtk.org/Wiki/ITK/Examples/IO/VolumeFromSlices" target="_blank">http://www.vtk.org/Wiki/ITK/Examples/IO/VolumeFromSlices</a><br>
<br>Then convert the itk 3D image into vtk 3D image.<br><br>HTH<br><br>Jothy<br><br><br><div class="gmail_quote"><div><div></div><div>On Wed, Oct 19, 2011 at 3:29 PM, Divya Rathore <span dir="ltr"><<a href="mailto:divyarathore@gmail.com" target="_blank">divyarathore@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div><div>I am trying to transfer DICOM files read in ITK to VTK for a 3D rendering.</div>
<div><br></div>I have a vector of ImageType::Pointer in ITK:<div>
<pre style="font-family:Consolas;font-size:13px;background-color:white;background-repeat:initial initial"><span style="color:blue">typedef</span>        itk::OrientedImage<<span style="color:blue">signed</span> <span style="color:blue">short</span>, 3> ImageType;</pre>
<pre style="font-family:Consolas;font-size:13;color:black;background:white"><pre style="font-family:Consolas;font-size:13;color:black;background:white"><span style="color:blue">typedef</span> std::vector<ImageType::Pointer> ImageArray;
</pre></pre><div><br></div><div>Each element in this vector (ImageArray) contains a slice of DICOM read in 'signed short' for certain reasons beyond my control.</div></div><div>I would like to transfer this ImageArray to ImageToVTKImageFilter as follows:</div>
<div><br></div><div><pre style="font-family:Consolas;font-size:13;color:black;background:white"><span style="color:blue">typedef</span> itk::ImageToVTKImageFilter< ImageType> itkVtkConverter;</pre></div><div><pre style="font-family:Consolas;font-size:13;color:black;background:white">
itkVtkConverter::Pointer conv;
</pre><pre style="font-family:Consolas;font-size:13;color:black;background:white"><span style="font-family:monospace;font-size:small"><pre style="font-family:Consolas;font-size:13px;color:black;background-color:white"> // QUESTION: HOW TO SUPPLY THE VECTOR ImageArray here?</pre>
</span></pre><pre style="background-color:white;background-repeat:initial initial"><pre style="font-family:Consolas;font-size:13px;color:black;background-color:white">conv->SetInput(_**_WHAT_GOES_HERE?_**_);
conv->Update();</pre><pre style="font-size:13px;color:black;background-color:white"><span style="font-family:arial, helvetica, sans-serif">as the data is signed short, I will need to convert it to 'unsigned short' that I can achieve as follows:</span></pre>
<pre style="font-size:13px;color:black;background-color:white"><font face="arial, helvetica, sans-serif"><pre style="font-family:Consolas;font-size:13;color:black;background:white">vtkSmartPointer<vtkImageCast> dataCast = vtkSmartPointer<vtkImageCast>::New();
dataCast->SetInput(conv->GetOutput());
dataCast->SetOutputScalarTypeToUnsignedShort();
dataCast->Update();</pre></font></pre><pre style="font-size:13px;color:black;background-color:white"><font face="arial, helvetica, sans-serif">finally forwarding this to the vtkVolumeRayCastMapper:</font></pre><pre style="background-color:white">
<pre style="font-family:Consolas;font-size:13px;color:black;background-color:white;background-repeat:initial initial">volumeMapper->SetInput(dataCast->GetOutput());
</pre><pre style="color:black;background-color:white"><font face="arial, helvetica, sans-serif"><br>
</font></pre><pre style="background-color:white"><font face="arial, helvetica, sans-serif">How to supply the vector ImageArray to ImageToVTKImageFilter?<span style="color:black">
</span></font></pre><pre style="background-color:white"><font face="arial, helvetica, sans-serif"><br>
</font></pre><pre style="background-color:white"><font face="arial, helvetica, sans-serif">best regards,</font></pre>
<font color="#888888"><pre style="background-color:white"><font face="arial, helvetica, sans-serif">Divya</font></pre>
<div style="color:black;font-family:Consolas;font-size:13px"><br></div></font></pre></pre></div>
<br></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 <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://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><font color="#888888"><br><br clear="all"><br>-- <br><div dir="ltr">Jothybasu K Selvaraj<br>PhD Student<br>University of Liverpool<br>Liverpool,UK<br></div><br>
</font></div>
</blockquote></div><br></div>
</div></div><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://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">Jothybasu K Selvaraj<br>PhD Student<br>University of Liverpool<br>Liverpool,UK<br></div><br>
</div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>