[vtkusers] Howto supply vector of itk::OrientedImage::Pointer to ImageToVTKImageFilter

Divya Rathore divyarathore at gmail.com
Fri Oct 21 07:53:01 EDT 2011


I managed to work it out by filling a vtkImageData with the ITK values.



On Wed, Oct 19, 2011 at 4:11 PM, Divya Rathore <divyarathore at gmail.com>wrote:

> 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.
>
> I will try to feed an object of vtkImageData (
> http://www.vtk.org/doc/release/5.8/html/a00911.html) with the slices that
> ITK has read and put in a vector for me.
>
> Thanks for the suggestion, Jothy.
>
> best regards,
> Divya
>
>
> On Wed, Oct 19, 2011 at 3:59 PM, Jothybasu Selvaraj <jothybasu at gmail.com>wrote:
>
>> 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.
>>
>> OTHERWISE
>>
>> If it is possible to create 3D c array from the itk images could
>> vtkImageImport to import into vtk.
>>
>>
>> Jothy
>>
>>
>> On Wed, Oct 19, 2011 at 3:47 PM, Divya Rathore <divyarathore at gmail.com>wrote:
>>
>>> Thanks for the response, Jothy.
>>>
>>> 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).
>>>
>>> I have no choice but to supply vector<ImageType::Pointer> ImageArray into
>>> the itk::ImageToVTKImageFilter.
>>>
>>> Any suggestions?
>>>
>>> best regards,
>>> Divya
>>>
>>>
>>> On Wed, Oct 19, 2011 at 3:35 PM, Jothybasu Selvaraj <jothybasu at gmail.com
>>> > wrote:
>>>
>>>> First try to convert your 2D slices into a 3D volume using itk. Have a
>>>> look at this
>>>>
>>>> http://www.vtk.org/Wiki/ITK/Examples/IO/VolumeFromSlices
>>>>
>>>> Then convert the itk 3D image into vtk 3D image.
>>>>
>>>> HTH
>>>>
>>>> Jothy
>>>>
>>>>
>>>> On Wed, Oct 19, 2011 at 3:29 PM, Divya Rathore <divyarathore at gmail.com>wrote:
>>>>
>>>>> I am trying to transfer DICOM files read in ITK to VTK for a 3D
>>>>> rendering.
>>>>>
>>>>> I have a vector of ImageType::Pointer in ITK:
>>>>>
>>>>> typedef	itk::OrientedImage<signed short, 3> ImageType;
>>>>>
>>>>> typedef std::vector<ImageType::Pointer> ImageArray;
>>>>>
>>>>>
>>>>> Each element in this vector (ImageArray) contains a slice of DICOM read
>>>>> in 'signed short' for certain reasons beyond my control.
>>>>> I would like to transfer this ImageArray to ImageToVTKImageFilter as
>>>>> follows:
>>>>>
>>>>> typedef itk::ImageToVTKImageFilter< ImageType> itkVtkConverter;
>>>>>
>>>>>
>>>>> itkVtkConverter::Pointer conv;
>>>>>
>>>>>  // QUESTION: HOW TO SUPPLY THE VECTOR ImageArray here?
>>>>>
>>>>> conv->SetInput(_**_WHAT_GOES_HERE?_**_);
>>>>> conv->Update();
>>>>>
>>>>> as the data is signed short, I will need to convert it to 'unsigned short' that I can achieve as follows:
>>>>>
>>>>> vtkSmartPointer<vtkImageCast> dataCast = vtkSmartPointer<vtkImageCast>::New();
>>>>> dataCast->SetInput(conv->GetOutput());
>>>>> dataCast->SetOutputScalarTypeToUnsignedShort();
>>>>> dataCast->Update();
>>>>>
>>>>> finally forwarding this to the vtkVolumeRayCastMapper:
>>>>>
>>>>> volumeMapper->SetInput(dataCast->GetOutput());
>>>>>
>>>>>
>>>>>
>>>>> How to supply the vector ImageArray to ImageToVTKImageFilter?
>>>>>
>>>>>
>>>>>
>>>>> best regards,
>>>>>
>>>>> Divya
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> 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 K Selvaraj
>>>> PhD Student
>>>> University of Liverpool
>>>> Liverpool,UK
>>>>
>>>>
>>>
>>> _______________________________________________
>>> 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 K Selvaraj
>> PhD Student
>> University of Liverpool
>> Liverpool,UK
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111021/83591c3c/attachment.htm>


More information about the vtkusers mailing list