[Insight-users] Deformable BSpline registration on large 2D image

Poirier, Guillaume Guillaume.Poirier at nrc-cnrc.gc.ca
Mon May 9 11:09:53 EDT 2011


Hello,

I am trying to apply a deformable bspline registration on a large float 2D Image (4256 X 2832).

I am using ITK 3.20.0 and Visual Studio 2008.

I use a itk::VectorResampleImageFilter with a default pixel value. In release mode
I am getting an occasional crash on the resample->Update() call (other times it works as
expected) and in debug mode no crashes but the output is always the default pixel value
everywhere... Is there a maximum largest region for the deformable bspline transform ?
Any suggestions ?

Here is some sample code:

typedef itk::RGBPixel< float > RGBFloatPixelType;
typedef itk::Image< RGBFloatPixelType, 2 > ImageType;
typedef itk::Image< unsigned char, 2 > FixedImageType;

typedef itk::ImageFileReader< FixedImageType > FixedImageReaderType;
FixedImageReaderType::Pointer fixedImageReader = FixedImageReaderType::New();
fixedImageReader->SetFileName("largeimage");
FixedImageType::Pointer fixedImage = fixedImageReader->GetOutput();
fixedImageReader->Update();
FixedImageType::RegionType region = fixedImage->GetLargestPossibleRegion();
// size is 4256 X 2832
FixedImageType::SizeType   size = region.GetSize();

ImageType::Pointer itk3DUVImg = ImageType::New();
itk3DUVImg->SetRegions(region);
itk3DUVImg->SetSpacing(fixedImage->GetSpacing());
itk3DUVImg->SetOrigin(fixedImage->GetOrigin());
itk3DUVImg->Allocate();

// set itk3DUVImg data
// [...]

typedef itk::VectorResampleImageFilter< ImageType, ImageType >  FilterType;
FilterType::Pointer resample = FilterType::New();

typedef itk::VectorNearestNeighborInterpolateImageFunction< ImageType, double >  InterpolatorType;
InterpolatorType::Pointer interpolator = InterpolatorType::New();
resample->SetInterpolator( interpolator );

typedef itk::Transform< double, 2, 2 > TransformType;
TransformType::Pointer finalTransform;
// finalTransform assigned to DeformableBSplineRegister previously computed
resample->SetTransform( finalTransform );
resample->SetInput( itk3DUVImg );
resample->SetSize( size );
resample->SetOutputOrigin( fixedImage->GetOrigin() );
resample->SetOutputSpacing( fixedImage->GetSpacing() );
pixelValue[0] = 999999.0;
pixelValue[1] = 999999.0;
pixelValue[2] = 999999.0;
resample->SetDefaultPixelValue(pixelValue);

ImageType::Pointer resampledITK3DUVImg = resample->GetOutput();

try
{
  resample->Update();
}
catch( itk::ExceptionObject & excp )
{
  // [...]
}


Many thanks,


bill

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110509/9a2ad26b/attachment.htm>


More information about the Insight-users mailing list