[Insight-users] Hammer Registration ImageIORegion error

Bill Lorensen bill.lorensen at gmail.com
Sun Apr 28 11:01:37 EDT 2013


On the readers, try replacing
Update()
with
UpdateLargestPossibleRegion()

or use a different reader for the fixed and moving images.


On Fri, Apr 26, 2013 at 2:22 AM, Prateep Mukherjee <pmukherj at umail.iu.edu>wrote:

> 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
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>


-- 
Unpaid intern in BillsBasement at noware dot com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130428/06aa90c1/attachment.htm>


More information about the Insight-users mailing list