[Insight-users] Confusion about update sequence and required
region
Atwood, Robert C
r.atwood at imperial.ac.uk
Thu Feb 2 07:16:25 EST 2006
Thanks for the swift update, I was not even sure if it was a bug in the
filter or in my understanding of how to use it. It appers to work now
without UpdateLargestPossibleRegion(). Due to another thread on the list
I already tried including UpdateLargestPossibleRegion as follows , after
some trial and error to find whether Update() should be before or after
UpdateLargestPossibleRegion()
try {
//fshrinker->UpdateLargestPossibleRegion ();
fshrinker->Update ();
} catch (itk::ExceptionObject & err) {
std::cerr << "ExceptionObject caught: fshrinker !" <<
std::endl;
std::cerr << fshrinker << std::endl;
std::cerr << "Quitting" << std::endl;
std::cerr << err << std::endl;
return -1;
}
try {
mshrinker->UpdateLargestPossibleRegion ();
}
catch (itk::ExceptionObject & err) {
std::cerr << "ExceptionObject caught mshrinker !" <<
std::endl;
std::cerr << "Quitting" << std::endl;
std::cerr << err << std::endl;
return -1;
}
try {
mshrinker->Update ();
}
catch (itk::ExceptionObject & err) {
std::cerr << "ExceptionObject caught mshrinker-region!" <<
std::endl;
std::cerr << "Quitting" << std::endl;
std::cerr << err << std::endl;
return -1;
}
As you see, now the fshrinker workaround is commented out and the
program was built and run with the new CVS version of ITK. Hopefully I
can now eliminate the explicit update of these filters and allow the
pipeline to take care of itself... Definitely more elegant , it will
make my code appear to be more elegant too!
Robert
-----Original Message-----
From: Andinet Enquobahrie [mailto:andinet.enqu at kitware.com]
Sent: 01 February 2006 21:48
To: Atwood, Robert C
Cc: Insight Users
Subject: Re: [Insight-users] Confusion about update sequence and
required region
Hi Robert,
Thank you for the detailed description of the bug in ShrinkImageFilter.
As documented in itk::ProcessObject header file, a second call of
Update() doesn't update the OutputRequestedRegion correctly and
consequently it resulted in "InvalidRequestedRegion" error in your
case...
Again as indicated in the same documentation, one work around is to use
UpdateLargestPossibleRegion() instead of Update() for a second call.
However, Luis and I discussed about it, and we thought that it would be
more elegant to still be able to invoke Update() to update the pipeline
for a second time and get the correct output requested region.We
figured out that this is possible by defining the
"EnlargeOutputRequestedRegion" in ShrinkImageFilter similar to
itk::RegionOfInterestImageFilter.
We have committed this change to the cvs version. Please, update your
version and give it a try and let us know if it solves your problem.
-Andinet
>
> Hi everyone:
> I want to have a region extracted from a larger image, and to have
> subsampled images of this region at some different resolutions.
> However, I keep getting 'invalid region request' exeptions on the
> second time I subsample the extracted region.
> How should the required region be re-set? it always works the first
> time no matter what the value of r_iter, within reason (2-16, even
> integers) so I guess that some region from the first time through is
> propagated to the second time
>
>
> Here is simplified code I used to test without all teh other stuff
> going on . I am pretty sure the region extraction has worked correctly
> so that inputImage is a valid ImageType::Pointer
>
> Thanks
> Robert
>
>
>
>
>
>
> typedef itk::ShrinkImageFilter<ImageType,ImageType> ShrinkerType;
> ...
> ShrinkerType::Pointer fshrinker = ShrinkerType::New ();
> r_iter = 4;
> ...
>
> fshrinker->SetShrinkFactors (r_iter);
> fshrinker->SetInput (inputImage);
>
> try {
> fshrinker->Update ();
> } catch (itk::ExceptionObject & err) {
> std::cerr << "ExceptionObject caught fshrinker !" <<
std::endl;
> std::cerr << fshrinker << std::endl;
> std::cerr << "Quitting" << std::endl;
> std::cerr << err << std::endl;
> return -1;
> }
>
> fshrinker->SetShrinkFactors (r_iter >> 1);
> fshrinker->SetInput (inputImage);
> try {
> fshrinker->Update ();
> } catch (itk::ExceptionObject & err) {
> std::cerr << "ExceptionObject caught fshrinker 2 !" <<
> std::endl;
> std::cerr << fshrinker << std::endl;
> std::cerr << "Quitting" << std::endl;
> std::cerr << err << std::endl;
> return -1;
> }
>
> ...
>
>
> Output
> ExceptionObject caught fshrinker 2 !
> ShrinkImageFilter (0x85422f0)
> RTTI typeinfo: itk::ShrinkImageFilter<itk::Image<float, 3u>,
> itk::Image<float, 3u> >
> Reference Count: 2
> Modified Time: 370
> Debug: Off
> Observers:
> none
> Number Of Required Inputs: 1
> Number Of Required Outputs: 1
> Number Of Threads: 2
> ReleaseDataFlag: Off
> ReleaseDataBeforeUpdateFlag: Off
> Input 0: (0x8520490)
> Output 0: (0x85449c0)
> AbortGenerateData: Off
> Progress: 1
> Multithreader:
> RTTI typeinfo: itk::MultiThreader
> Reference Count: 1
> Modified Time: 90
> Debug: Off
> Observers:
> none
> Thread Count: 2
> Global Maximum Number Of Threads: 0
> Shrink Factor: 2 2 2
>
> Quitting
>
> itk::InvalidRequestedRegionError (0x8562e00)
> Location: "virtual void itk::DataObject::PropagateRequestedRegion()"
> File: /sources/local/ITK_cvs/Code/Common/itkDataObject.cxx
> Line: 397
> Description: Requested region is (at least partially) outside the
> largest possible region.
>
>
>
>-----------------------------------------------------------------------
-
>
>_______________________________________________
>Insight-users mailing list
>Insight-users at itk.org
>http://www.itk.org/mailman/listinfo/insight-users
>
>
More information about the Insight-users
mailing list