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

Poirier, Guillaume Guillaume.Poirier at nrc-cnrc.gc.ca
Wed May 18 09:39:19 EDT 2011


This issue has been resolved... The problem was not due to the large image size. I was using
different registration functions that create transform parameters on the stack, like most
examples do. Then they are set with SetParameters() and a ref pointer to the transform is kept
for later use. For all but one of the transforms I was using it worked, however I found out that the
BSplineDeformableTransform::SetParameters() does not make a copy of them, you need to use
BSplineDeformableTransform::SetParametersByValue(). I would argue that this interface is somewhat
confusing. Maybe the other transforms' SetParameters() should be renamed SetParametersByValue(),
or maybe the copy operation could be specified as a second argument in a unique SetParameters()
function ?

Just my two cents ;)

regards,


Bill


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/20110518/4f288879/attachment.htm>


More information about the Insight-users mailing list