[Insight-users] ResampleFilterType

Mauro Maiorca mauromaiorca at gmail.com
Mon May 25 05:26:12 EDT 2009


Hi all,
I've experienced a behaviour of ResampleFilterType that looks somehow
odd to me!
I'm using the ImageRegistration8.cxx example, the code itself works
fine, but actually I'm dealing with a featured image
("movingFeaturedImage"), so my aim is to align the original moving
image ("movingImage") to the fixed image("fixedImage"). The idea is to
pass the movingFeaturedImage to the resampler.  Something like that:

  ResampleFilterType::Pointer resampler = ResampleFilterType::New();
  resampler->SetTransform( finalTransform );
  resampler->SetInput( movingFeaturedImage );
  resampler->SetSize(    fixedImage->GetBufferedRegion().GetSize() );
  resampler->SetOutputOrigin(  fixedImage->GetOrigin() );
  resampler->SetOutputSpacing( fixedImage->GetSpacing() );
  resampler->SetDefaultPixelValue( -1000 );
  resampler->Update();

well, the "resampler->GetOutput();" is just an empty image!
Obviously "movingImage" and "movingFeaturedImage" are created with the
same characteristics (voxel spacing, etc etc. In fact
"movingFeaturedImage" come out from "movingImage" through a
thresholdFilter). It just doesn't work!
I found a (working) rude solution: just copying voxel by voxel the
"movingImage" to the "movingFeaturedImage" such as

	IteratorType imageIt ( movingFeaturedImage,
movingFeaturedImage->GetRequestedRegion() );
	IteratorType imageDstIt ( movingImage, movingImage->GetRequestedRegion() );
	for (imageIt.GoToBegin(), imageDstIt.GoToBegin(); !imageIt.IsAtEnd();
++imageIt,++imageDstIt){
		imageDstIt.Set(imageIt.Get());
	}
	movingImage-> Update();
	ResampleFilterType::Pointer resampler = ResampleFilterType::New();
	resampler->SetTransform( finalTransform );
	resampler->SetInput( movingImage );
	resampler->SetSize(    fixedImage->GetBufferedRegion().GetSize() );
	resampler->SetOutputOrigin(  fixedImage->GetOrigin() );
	resampler->SetOutputSpacing( fixedImage->GetSpacing() );
	resampler->SetDefaultPixelValue( -1000 );
	resampler->Update();


It works fine, but... probably it's not the nicest solution ;-)
I just upgraded to the last version of ITK (3.12.0) to see whether the
problem has been fixed in the meanwhile, but same behaviour!
Any feedback would be appreciated!

cheers,
Mauro


More information about the Insight-users mailing list