[Insight-users] Losing signal after slice extraction

Huisman, A. A.Huisman-4 at umcutrecht.nl
Wed Jul 26 07:18:05 EDT 2006


Hello ITK-users,

I noticed some strange behaviour after application of the ITK ExtractImageFilter (Visual Studio 2005, ITK 2.6.0). When I read an image and ask for the maximum I get a certain value which looks correct. After application of an ExtractImageFilter and recomputation of the maximum of the original (!) image I get a much lower value. It looks like there are some pointers interchanged since the maximum calculation on the extracted slide results in the same intensity value as computed on the complete image after image extraction. However, when I ask for the dimension of the original image after slide extraction it still tells me the correct number of slides so the pointers are not pointing to completely the same image.

Here is the code:

typedef itk::Image<PixelType, 3> InputImageType;
typedef itk::Image<PixelType, 2> OutputImageType;
typedef itk::ExtractImageFilter<InputImageType, OutputImageType> ExtractImageFilterType;
InputImageType::Pointer im = tools->readImageStack(dirPath.c_str(), extension, series_id); //this function reads the complete image stack
typedef itk::MinimumMaximumImageCalculator<InputImageType> MinMaxCalculatorType;
MinMaxCalculatorType::Pointer minMaxCalc = MinMaxCalculatorType::New();
minMaxCalc->SetImage(im);
minMaxCalc->ComputeMaximum();
qDebug() << " max after reading: " << minMaxCalc->GetMaximum();

ExtractImageFilterType::Pointer filter = ExtractImageFilterType::New();
filter->SetInput(im);

ImageType::RegionType inreg = im->GetLargestPossibleRegion();
ImageType::SizeType size2 = inreg.GetSize();
ImageType::IndexType start2 = inreg.GetIndex();
size2[2] = 0;
start2[2] = 20; //just as example; I know there are at least 45 slides in this typical image.
filter->Update();
MinMaxCalculatorType::Pointer minMaxCalc2 = MinMaxCalculatorType::New();
minMaxCalc2->SetImage(im);
minMaxCalc2->ComputeMaximum();
qDebug() << " max after reading: " << minMaxCalc2->GetMaximum();

Can anyone tell me what I'm doing wrong or what bug is causing this behaviour or why this feature works this way (I always understood that images are not affected by a filter)? 

Thank you very much,
André Huisman


More information about the Insight-users mailing list