[Insight-users] 1. outer layer filter 2. vtk itk convertors help
Luis Ibanez
luis.ibanez at kitware.com
Mon Jul 19 23:46:35 EDT 2004
Hi Ruby,
1) By "outer layer from 3D image data" do you mean:
A- The bounding box of the volume ?
B- The skin (face and back) of the head ?
If you want A, you don't need a filter for that,
you can figure out the bounding box by using the
image origin, size and pixel spacing
If you want B, you need to read the Chapter on
image segmentation from the ITK Software Guide
http://www.itk.org/ItkSoftwareGuide.pdf
2) What is the purpose of the conversions you are
making before passing the vtkImageData to the
cleanImage function ?
Is there any reason for not simply passing the
output of the v16 reader directly as input
to this function ?
Chances are that the conversions are resulting
in a null pointer being passed to the import
filter...
Regards,
Luis
---------------------
Ruby Shamir wrote:
> Hi All,
>
> 1. Is there a filter getting the outer layer from 3D image data? (our
> data is MRI head).
>
>
> 2. I tried to convert vtkImageData to itk::Image and then to convert it
> back to vtkImageData, but when tried to update() got an exception:
>
> itk::ExceptionObject (0012E984)
> Location: "Unknown"
> File: f:\itk\code\code\basicfilters\itkvtkimageimport.txx
> Line: 102
> Description: itk::ERROR: VTKImageImport(09FACC90): Downcast from
> DataObject to my Image type failed.
>
> Help.
>
> Thank you,
>
> Ruby
>
>>From outside we run:
>
> v16 = vtkVolume16Reader::New();
>
> ... (reading 3D object)
>
> vtkImageData * originalImage = vtkImageData::New();
>
> v16->Update();
> originalImage->DeepCopy(v16->GetOutput());
> originalImage->SetScalarTypeToUnsignedShort();
> originalImage->UpdateData();
>
> vtkImageData * cleanedImage = vtkImageData::New();
>
> cleanedImage->DeepCopy(cleanImageData(originalImage));
>
> And the function is:
>
> vtkImageData * showVolume::cleanImageData (vtkImageData *
> originalImageData){
>
> typedef itk::Image<unsigned short, 3> inputImageType;
>
> typedef itk::ImageToVTKImageFilter<inputImageType>
> itkToVtkConnectorType;
> typedef itk::VTKImageToImageFilter<inputImageType>
> vtkToItkConnectorType;
>
> itkToVtkConnectorType::Pointer itkToVtkConnector =
> itkToVtkConnectorType::New();
> vtkToItkConnectorType::Pointer vtkToItkConnector =
> vtkToItkConnectorType::New();
>
> try{
>
> vtkToItkConnector->SetInput(originalImageData);
> vtkToItkConnector->GetImporter()->Update();
>
>
> itkToVtkConnector->SetInput(vtkToItkConnector->GetOutput());
> itkToVtkConnector->GetImporter()->Update();
>
> }
> catch (itk::ExceptionObject o){
> fstream b;
> b.open("err.txt",ios::out);
> b<<o;
> b.close();
> }
>
> return (itkToVtkConnector->GetOutput());
>
>
> }
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
More information about the Insight-users
mailing list