[Insight-users] Problem filling up an Image
Carlos Sánchez Mendoza
carlos.sanchez.mendoza at gmail.com
Fri Nov 7 11:36:54 EST 2008
Hi all,
the following code tries to create an Image from date that is
accessible via a function call. No matter what filter I use to process
the image when I do Update() there is malloc error. Anyone sees
something wrong with it?
Thank you very much in advance.
Carlos S. Mendoza,
typedef float InputPixelType;
typedef itk::Image<InputPixelType,Dimension> InputImageType;
typedef itk::RescaleIntensityImageFilter<InputImageType,InputImageType>
NormalizeFilterType;
InputImageType::Pointer inputImage = InputImageType::New();
NormalizeFilterType::Pointer normalizer = NormalizeFilterType::New();
InputImageType::IndexType start;
start[0] = 0; // first index on X
start[1] = 0; // first index on Y
start[2] = 0; // first index on Z
InputImageType::SizeType size;
size[0] = miResolucio.uX; // size along X
size[1] = miResolucio.uY; // size along Y
size[2] = mllLlesques.size(); // size along Z
InputImageType::RegionType region;
region.SetSize(size);
region.SetIndex(start);
inputImage->SetRegions(region);
inputImage->Allocate();
inputImage->FillBuffer(0);
//Here the image gets filled in
//from external source
normalizer->SetInput(inputImage);
normalizer->SetOutputMaximum(MAX_VALUE);
normalizer->SetOutputMinimum(MIN_VALUE);
normalizer->Update();
MALLOC ERROR HERE
More information about the Insight-users
mailing list