[Insight-users] Hammer Registration ImageIORegion error

Prateep Mukherjee pmukherj at umail.iu.edu
Fri Apr 26 02:22:48 EDT 2013


Hello all,

   I am trying to use the Hammer registration method in ITK provided here (http://www.med.unc.edu/bric/ideagroup/free-softwares/fast-hammer). However I am getting a continuous error of ImageIORegion.

  I have pasted the relevant part of my code here.

 int main(int argc,char *argv[])  
{
	float XYZres = 1. ;
	int nThreads = 1;
	std::string fixedFilename = "/usr/local/itk/InsightToolkit-4.1.0/Examples/Data/RatLungSlice1.mha";
	std::string movingFilename = "/usr/local/itk/InsightToolkit-4.1.0/Examples/Data/RatLungSlice2.mha";
	std::string resampledFilename = "registered.mha";
    std::string iterationasstring = "50,50,50";

    unsigned int iterations[3];
    iterations[0] = 50; iterations[1] = 50; iterations[2] = 50;

	double scale = 7*(1./XYZres) ; if(scale<3) scale=3; printf("scale=%f\n", scale) ;

	/***** Model image, segmented *****/
	/*Img_XY = 256 ;*/	 

	printf("\nmodel image : %s\n", fixedFilename.c_str()) ;  
	printf("subject image : %s\n", movingFilename.c_str()) ;  

	/*** Load in fixed image and compute the attribute vectors ***/
	ReaderType::Pointer ImgReader = ReaderType::New();
	ImgReader->SetFileName( fixedFilename.c_str() );
	try
	{
		ImgReader->Update();
	}
	catch( itk::ExceptionObject *ex )
	{
		std::cerr << ex << std::endl;
	}
	ImageType::Pointer fImg0 = ImgReader->GetOutput();
	fImg0->DisconnectPipeline();
	std::cout << "Fixed image file read in\n";

	/*** Load in moving image and compute the attribute vectors ***/
	ImgReader->SetFileName( movingFilename.c_str() );
	try
	{
		ImgReader->Update(); 
	}
	catch( itk::ExceptionObject *ex )
	{
		std::cerr << ex << std::endl;
	}
	ImageType::Pointer mImg0 = ImgReader->GetOutput();
	mImg0->DisconnectPipeline();
	std::cout << "Moving image file read in\n";

	typedef itk::HammerDeformableRegistrationImageFilter<
		ImageType,
		DeformationFieldType> RegistrationFilterType;
	RegistrationFilterType::Pointer hammer = RegistrationFilterType::New();

	// hammer only need to know the fixed image, moving image, and 
	// how attribute vectors are computed (also similarity computation)
	// to perform registration

	hammer->SetFixedImage( fImg0 );
	hammer->SetMovingImage( mImg0 );

	// ----------------------------------------------------------
	// define an attribute vector filter object and set it to the 
	// hammer registration filter so the registration know   
	// 1. How to compute attribute vectors
	// 2. How to compute similarity between attribute vectors
	AttributeFilterType::Pointer avFilter = AttributeFilterType::New();
	// hammer->SetAttributeVectorFilter( avFilter );
	// ----------------------------------------------------------

	// ----------------------------------------------------------
	// the following lines set parameters for HAMMER registration
	// all these parameters should have default values
    hammer->SetIterations( iterations[0], iterations[1], iterations[2] );
	hammer->SetDeformRate(0.05);
	hammer->SetPointMatchingThreshold(0.8);
	hammer->SetSubvolumnSimilarityThreshold(0.6);
	hammer->SetSearchRadius(12);

	hammer->GenerateInputRequestedRegion();
	// ----------------------------------------------------------

 	clock_t Start = clock();
 	try {
 		hammer->Update(); // Also tried UpdateLargestPossibleRegion() here. Doesn't work !!
 	} catch( itk::ExceptionObject &e)
 	{
 		std::cerr << e << std::endl;
 	}

 }


  The error I am getting is :

  Description: itk::ERROR: ImageFileWriter(0x101d01e30): Largest possible region does not fully contain requested paste IO regionPaste IO region: ImageIORegion (0x7fff5fbfe3c0)

   Please help me to debug this. 

---
Thanks,
Prateep 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130426/8b460d75/attachment.htm>


More information about the Insight-users mailing list