[ITK-users] Pipeline crash when ReleaseDataFlagOn
Weldon
zagwin at gmail.com
Thu May 14 20:46:40 EDT 2015
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20150514/3fa61a03/attachment.html>
More information about the Insight-users
mailing list