[Insight-users] ITK exception caught in main
:itk::InvalidRequestedRegionError (0x82cb748)
Miller, James V (GE, Research)
millerjv at crd.ge.com
Thu Feb 2 13:20:14 EST 2006
Amir,
You should need both the call to Update() and UpdateLargestPossibleRegion(). The call to UpdateLargestPossibleRegion() should be fine.
jim
-----Original Message-----
From: charfeddine amir [mailto:charfeddine_amir at yahoo.fr]
Sent: Thursday, February 02, 2006 2:24 AM
To: Miller, James V (GE, Research); insight insight
Subject: RE: [Insight-users] ITK exception caught in main :itk::InvalidRequestedRegionError (0x82cb748)
Hi Jim,
thx very much
i just add a call to the UpdateLargestPossibleRegion() method , and every thing was ok:
.
.
m_ImageReader->SetFileName( FileNamesItr->c_str());
m_ImageReader->Update();
m_ImageReader->UpdateLargestPossibleRegion()
.
.
Regards,
Amir.
"Miller, James V (GE, Research)" <millerjv at crd.ge.com> a écrit :
The problem is probably in your LoadNextImage() method.
What ImageType is ImageFileReader loading? Is it a 2D or 3D image?
When a pipeline is run the first time, it establishes a set of region requests at each stage in the pipeline. The last filter places a request on the filter before ! it, that filter places a request on the filter before it, ... When you changed the filename on the reader, the reader may no longer satisfy the request cached between it and the downstream filters. When you change a parameter like the slice to visualize (or the amount to shrink an image), you need to call UpdateLargestPossibleRegion() instead of Update() on the pipeline to renogiate the regions and ignore the previous cached versions.
Jim
-----Original Message-----
From: insight-users-bounces+millerjv=crd.ge.com at itk.org! [mailto:insight-users-bounces+millerjv=crd.ge.com at itk.org]On Behalf Of charfeddine amir
Sent: Wednesday, February 01, 2006 10:37 AM
To: insight insight
Subject: [Insight-users] ITK exception caught in main :itk::InvalidRequestedRegionError (0x82cb748)
HI all
i have this error and the program crash while triying to visualize Dicom Image.
this program read all Dicom files belonging to the same serie, from a given directory.
each file contain many slice of a fantom.
I take the ShapeDetectionLevelSet program from the InsightApplications and edit it do that.
i start with pushing the Load Button, I select a dicom directory containing files, then program read all the Dicom files belonging to the same serie( the first one found), and read the first Dicom file, then i can visualize it when i click on the Display Button (under Load button),
then i move to the next Dicom file! in serie with a counter (like fltk slider), and when i reclick on display, the program crash with the following message:
ITK exception caught in main
itk::InvalidRequestedRegionError (0x82cb748)
Location: "Image::PropagateRequestedRegion()"
File: /usr/local/InsightToolkit-2.4.0/Code/Common/itkDataObject.c! xx
Line: 397
Description: Requested region is (at least partially) outside the largest possible region.
this is part of code i add:
//function for loading the first serie in the directory dirname
void
ShapeDetectionLevelSetBase
::LoadInputDir( const char * dirname )
{
if( !dirname )
{
return;
}
nameGenerator->SetDirectory( dirname );
seriesUID = nameGenerator->GetSeriesUIDs();
seriesIdentifier = seriesUID.begin()->c_str();
fileNames = nameGenerator->GetFileNames( seriesIdentifier ); FileNamesBegin = fileNames.begin();
FileNamesItr = fileNames.end(); FileNamesEnd = fileNames.end();
ListCardinal=0;
ListPosition=1;
while( FileNamesItr != FileNamesBegin )
{
ListCardinal++;
FileNamesItr--;
}
LoadCurrentImage();
}
//function for! reading the first file in serie
void
ShapeDetectionLevelSetBase
::LoadCurrentImage()
{
m_ImageReader->SetFileName( FileNamesItr->c_str());
m_ImageReader->Update();
m_InputImage=m_ImageReader->GetOutput();
// Allocate an image of seeds of the same size
InputImageType::RegionType region
= m_ImageReader->GetOutput()->GetLargestPossibleRegion();
InputImageType::SizeType size = region.GetSize();
for(unsigned int i=0; i<ImageDimension; i++)
{
if( size[i] < 10 )
{
this->ShowStatus("Image must be 3D and with at least 10 pixels along each Dimension.");
itk::ExceptionObject excp;
excp.SetDescription("Image must be 3D and with at least 10 pixels along each Dimension.");
throw ! excp;
}
}
m_SeedImage->SetRegions( region );
m_SeedImage->Allocate();
m_SeedImage->FillBuffer( itk::NumericTraits<SeedImageType::PixelType>::Zero );
m_FastMarchingFilter->SetOutputSize( region.GetSize() );
m_InputImageIsLoaded = true;
}
//function for reading the next file in serie
void
ShapeDetectionLevelSetBase
::LoadNextImage( )
{
if ( FileNamesItr != FileNamesEnd )
{
FileNamesItr++;
ListPosition++;
m_ImageReader->SetFileName( FileNamesItr->c_str() );
m_ImageReader->Update();
m_InputImage=m_ImageReader->GetOutput();
}
//this->ShowInputImage();
InputImageType::RegionType region
= m_ImageReader->GetOutput()->GetLargestPossibleRegion();
InputImageType::SizeType size = region.GetSize();
for(unsigned int i=0; i<ImageDimension; i++)
{
if( size[i] < 10 )
{
this->ShowStatus("Image must be 3D and with at least 10 pixels along each Dimension.");
itk::ExceptionObject excp;
excp.SetDescription("Image must be 3D and with at least 10 pixels along each Dimension.");
throw excp;
}
}
m_SeedImage->SetRegions( region );
m_SeedImage->Allocate();
m_SeedImage->FillBuffer( itk::NumericTraits<SeedImageType::PixelType>::Zero );
m_FastMarchingFilter->SetOutputSize( region.GetSize() );
}
//function for reading the previous file in serie
void
ShapeDetectionLevelSetBase
::LoadPrevImage( )
{
if ( FileNamesItr != FileNamesBegin )
{
FileNamesItr--;
ListPosition--;
m_ImageReader->SetFileName( FileNamesItr->c_str() );
m_ImageReader->Update();
mm_IInputImage=m_ImageReader->GetOutput();
}
//this->ShowInputImage();
InputImageType::RegionType region
= m_ImageReader->GetOutput()->GetLargestPossibleRegion();
InputImageType::SizeType size = region.GetSize();
for(unsigned int i=0; i<ImageDimension; i++)
{
if( size[i] < 10 )
{
this->ShowStatus("Image must be 3D and with at least 10 pixels along each Dimension.");
itk::ExceptionObject excp;
excp.SetDescription("Image must be 3D and with at least 10 pixels along each Dimension.");
throw excp;
}
}
m_SeedImage->SetRegions( region );
m_SeedImage->Allocate();
m_SeedImage->FillBuffer( itk::NumericTraits<SeedImageType::PixelType>::Zero );
m_FastMarchingFilter->SetOutputSize( region.GetSize() );
}
/*********************************************************************************************/
any comment is welcome
thx
Amir,
_____
Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international. Téléchargez <http://us.rd.yahoo.com/messenger/mail_taglines/default/*http://fr.beta.messenger.yahoo.com> la version beta.
_____
Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international. Téléchargez <http://us.rd.yahoo.com/messenger/mail_taglines/default/*http://fr.beta.messenger.yahoo.com> la version beta.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20060202/42db5010/attachment.htm
More information about the Insight-users
mailing list