[vtkusers] ImageToVTKImageFilter in separate block error

Paweł~~Łubniewski lubniewski at gmail.com
Thu Feb 18 03:46:41 EST 2010


Ok, i meant breaking pipeline.
In ITK there is a function DisconnectPipeline()
and i searched a similar one in VTK.
But i forgot that can make ShallowCopy on pipeline's output
and next destroy the pipeline safely, having result image stored.
Sorry for disturbing. Regards,
Pawel~
_________________
Paweł~~Łubniewski



W dniu 17 lutego 2010 11:41 użytkownik Paweł~~Łubniewski <
lubniewski at gmail.com> napisał:

> Dear VTK users,
> I am writing a program where i need to convert
> itk::Image to vtkImageData and vice versa.
> I try to separate the code concerning conversion filter
> (precisely, i have a more complicated hierarchy of classes
> where one does the conversion and passes an output to other).
>
> Here is a snippet:
>
> *typedef *itk::Image<*short int*, *3*> ImageType;
> ImageType::Pointer imageITK;           //itk smart pointer to image
> vtkSmartPointer<vtkImageData> imageVTK;//vtk smart pointer to image
>
> //... //loading data to imageITK;
>
> {  //block of conversion itk->vtk begins
>    *typedef *itk::ImageToVTKImageFilter<ImageType> ConverterType;
>    ConverterType::Pointer converter = ConverterType::New();
>    converter->SetInput(imageITK);
>    converter->Update();
>    imageVTK = converter->GetOutput();
> }  //block of conversion itk->vtk ends
>
> anImageActor->SetInput(imageVTK);//anImageActor is added to aRenderer
> props' list
> aRenderer->Render();             //segmentation error
> imageVTK->Update();              //segmentation error
>
> It seems to me that after ImageToVTKImageFilter destruction (end of block),
> it is impossible to access the result of conversion (imageVTK).
> Indeed, if you comment out the block parentheses, it works fine.
> But i have to have this code separate (because of the program structure).
>  What could i do? Should i store every filter instances all the program
> life?
>
> Thanks in advance for reply.
> Pawel~
>
> _________________
>  Paweł~~Łubniewski
> __________________________________________________________________________
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100218/d44d9a4d/attachment.htm>


More information about the vtkusers mailing list