[Insight-users] VTK - ITK - VTK Pipeline problems

Jesse C Cronce croncejc at mrctr.upmc.edu
Mon Oct 31 14:31:40 EST 2005


Is it possible to have ImageType *x[20];

So that you can disconnect a particular image, make a few parameter
changes to the filter, call it's upadate method again, and disconnect
the next image w/out overwriting the memory of the initial image ?

Thanks,
JCC

On Mon, 2005-10-31 at 13:53 -0500, Karthik Krishnan wrote:
> Jesse C Cronce wrote:
> 
> >If you do a DisconnectPipeline, that will also disconnect memory
> >management of the image from the ITK libraries as well, right ? 
> >
> Not if you use smart pointers. (Memory management should be taken care 
> of) For instance, this is ok if you had
> 
> filter->Update();
> ImageType::Pointer x = filter->GetOutput();
> x->DisconnectPipeline();
> 
> this is not ok.
> 
> filter->Update();
> ImageType* x = filter->GetOutput();
> x->DisconnectPipeline();
> 
> The reference count is needed to prevent x from getting destroyed.
> 
> >(meaning
> >that the memory will have to be deleted/freed when no longer in use)
> >Also, if you call a GetOutput() on the filter that has been disconnected
> >from the pipeline, it looks like the result should be a NULL pointer
> >(from the code itkDataObject.cxx - 
> >
> >    m_Source->SetNthOutput(m_SourceOutputIndex, 0);
> >
> >) is this also correct ?
> >
> >  
> >
> yes
> 
> >Thanks!
> >JCC
> >
> >On Mon, 2005-10-31 at 10:53 -0500, Karthik Krishnan wrote:
> >  
> >
> >>Did you try to disconnect the objects from teh pipeline ?
> >>
> >>In ITK:
> >>
> >>filter->Update();
> >>itkImage = filter->GetOutput();
> >>itkImage->DisconnectPipeline();
> >>
> >>In VTK:
> >>
> >>use UnRegisterAllOutputs() to disconnect the pipeline
> >>or use ShallowCopy
> >>
> >>
> >>
> >>Istvan Matis wrote:
> >>
> >>    
> >>
> >>>Hello ITK users,
> >>> 
> >>>I am using a complex pipeline to convert vtkImageData to itk Image, 
> >>>apply some filters on it (each time a different filter) like 
> >>>smoohting, segmentation, then convert back to VTK in order to 
> >>>visualize it.
> >>>My problem is that I receive various errors, "unhandled exceptions" 
> >>>sometimes in the itk sources sometimes in system dlls, usually when I 
> >>>want to apply the itk filters for the 2nd time.
> >>> 
> >>>I am using the same pipeline several times on several (different) 
> >>>images read into VTK.
> >>>As I understood, if one element (object) in the VTK->ITK->VTK pipeline 
> >>>is destroyed the whole pipeline will crash. In order to prevent this I 
> >>>use vtkImageCast to "Clone" the final vtk output in order to separate 
> >>>the output vtkImageData from the whole pipeline.
> >>> 
> >>>Here is the sketch of the pipeline:
> >>> 
> >>>vtkImageData Input ->
> >>>-> vtkImageCast ->
> >>>-> vtkImageData Input 2 ->
> >>>-> itk::VTKImageToImageFilter ->
> >>>-> itk::Image ->
> >>>-> " different itk filter each time: ex: 
> >>>itk::ConnectedThresholdImageFilter or itk::CurvatureFlowImageFilter " ->
> >>>-> itk::Image Output ->
> >>>-> itk::ImageToVTKImageFilter ->
> >>>-> vtkImageData Output ->
> >>>-> vtkImageCast ->
> >>>-> vtkImageData Output 2
> >>> 
> >>>I use ->Update() at every step!
> >>> 
> >>>By the way I am using itk 2-0-0, vtk 4-4, VC++6 with SP6, WinXP Pro.
> >>> 
> >>>Is a solution to recreate (Delete() and New()) all the itk and vtk 
> >>>filters in the pipeline each time they need to be used? I observed 
> >>>that if I destroy even one of these filters the whole thing crashes, 
> >>>and not immediately, but sooner or later, somewhere when vtk needs the 
> >>>data.
> >>> 
> >>>My question is:
> >>>How can I separate the resulting vtkImage from the whole vtk-itk-vtk 
> >>>pipeline once it was processed?
> >>>Or more generally:
> >>>How can I reuse the whole pipeline on different images with different 
> >>>sizes and attributes?
> >>> 
> >>>Any hints will be gratefully apreciated.
> >>> 
> >>>Sincerelly,
> >>>Istvan
> >>> 
> >>> 
> >>>
> >>>------------------------------------------------------------------------
> >>>
> >>>_______________________________________________
> >>>Insight-users mailing list
> >>>Insight-users at itk.org
> >>>http://www.itk.org/mailman/listinfo/insight-users
> >>> 
> >>>
> >>>      
> >>>
> >>_______________________________________________
> >>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