[ITK-users] [ITK] Pipeline crash when ReleaseDataFlagOn

Bradley Lowekamp blowekamp at mail.nih.gov
Tue May 19 14:05:40 EDT 2015


Hello,

I am not sure what you mean by crash. Segfault? Exception?

I believe I have fixed the issue in the patch I have submitted to gerrit for review [1]. The CannyEdgeDectionImageFilter is unfortunately not very memory efficient in ITK.

Brad

[1] http://review.source.kitware.com/#/c/19795/

On May 14, 2015, at 8:46 PM, Weldon <zagwin at gmail.com> wrote:

> Hello All,
> 
> I have a simple Canny Edge detection pipeline, since the data is very big, I used ReleaseDataFlag in the pipeline. However, it will crash with Flag on. The code runs ok when I comments the flagon two lines. My codes are as following, could anybody tell me why? thanks 
> 
> int main(int argc, char* argv[])
> {
>   typedef signed short  InputPixelType;
>   typedef unsigned char OutputPixelType;
>   const unsigned int    Dimension = 3;
>   typedef itk::Image< InputPixelType, Dimension > InputImageType;
>   typedef itk::Image< OutputPixelType, Dimension > OutputImageType;
>   typedef itk::ImageFileReader< InputImageType > ReaderType;
>   ReaderType::Pointer reader = ReaderType::New();
>   reader->SetFileName( argv[1] );
>   typedef itk::GDCMImageIO           ImageIOType;
>   ImageIOType::Pointer gdcmImageIO = ImageIOType::New();
>   reader->SetImageIO( gdcmImageIO );
>   reader->update();
>   
>   InputImageType::Pointer pimg = reader->GetOutput();
>   
>   OutputImageType::Pointer pmask = OutputImageType::New();
> 
>   CannyEdgeDetection(pimg.GetPointer(), pmask.GetPointer());
> }
> 
> template<typename TInput, typename TOutput>
> void CannyEdgeDetection(typename TInput *inImage, typename TOutput *outImage)
> {
>             typedef float  PixelType;
>        const unsigned int    Dimension = 3;
>        typedef itk::Image< PixelType, Dimension > InternalImageType;
>             typedef itk::CastImageFilter< TInput, InternalImageType> CastFilterType;
> 	    typedef itk::CannyEdgeDetectionImageFilter <InternalImageType, InternalImageType> FilterType;
> 	    typedef itk::RescaleIntensityImageFilter< InternalImageType, TOutput > RescaleType;
> 
> 			CastFilterType::Pointer castFilter = CastFilterType::New();
> 			FilterType::Pointer cannyFilter    = FilterType::New();
> 			RescaleType::Pointer rescaler      = RescaleType::New();
> 
> 			cannyFilter->SetVariance( 2.0 );
> 			cannyFilter->SetUpperThreshold( 10.0);
> 			cannyFilter->SetLowerThreshold( 0.5);
> 
> 			rescaler->SetOutputMinimum( 0 );
> 			rescaler->SetOutputMaximum( 255 );
> 
> 			castFilter->ReleaseDataFlagOn();
> 			cannyFilter->ReleaseDataFlagOn();	//When rescaler->Update() exec, it will crash		
> 
> 			castFilter->SetInput(inImage);
> 			cannyFilter->SetInput(castFilter->GetOutput());
> 			rescaler->SetInput( cannyFilter->GetOutput() );
> 
> 			rescaler->Update();  //crash here
> 
>                       //deepcopy codes to copy data from rescaler to outImage
> }
> 
> 
> -- 
> Yours sincerely,
> Weldon
> _____________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
> 
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-users
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/mailman/listinfo/community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20150519/92b59afd/attachment.html>


More information about the Insight-users mailing list