[IGSTK-Users] problems using a specific image reader
Sophie Blestel
sophie.blestel at gmail.com
Mon Mar 19 10:43:04 EDT 2007
Hi,
I use images in a specific format, so I can't read them using
DICOMImageReader. So I have written a new class : GisImageReader, that has
only a few methods :
//to set my image in an internal variable
void SetGisImage(char * FileName);
//to get my image as an itk::OrientedImage
const virtual ImageType::ConstPointer GetITKImage() const;
(with : typedef itk::OrientedImage< unsigned short, 3 > ImageType)
etc....
This class doesn't inheritate.
I have also declared the ImageReaderToImageSpatialObject class to be a
friend :
igstkFriendClassMacro(
igstk::Friends::ImageReaderToImageSpatialObject );
In my project, I do :
igstk::MRImageSpatialObject * m_ImageSpatialObject =
igstk::MRImageSpatialObject::New();
igstk::GisImageReader * m_ImageReader = new
igstk::GisImageReader();
m_ImageReader->SetGisImage(FileName);
igstk::Friends::ImageReaderToImageSpatialObject::ConnectImage(m_ImageReader,
m_ImageSpatialObject);
ConnectImage is defined in igstkImageReader as follows :
template < class TReader, class TImageSpatialObject >
static void
ConnectImage( const TReader * reader, TImageSpatialObject *
imageSpatialObject )
{
cout<<"DEBUG, ConnectImage called ... \n";
imageSpatialObject->RequestSetImage( reader->GetITKImage() );
}
But when I execute it, there is an error : "Acces refused / The memory can't
be read".
This bug happends in the method :
ImageSpatialObject< TPixelType, VDimension >::RequestSetImage( const
ImageType * image )
at it very beginning :
m_ImageToBeSet = image;
Then I wrote :
(*image).Print(cout);
std::cout<<"m_ImageToBeSet"<<m_ImageToBeSet<<"\n";
image is "full" and contains my image, but it appeared that m_ImageToBeSet
induced an error, because it was not initialized.
So I initialized it in the constructor of the class ImageSpatialObject, but
it doesn't change anything. It still induces an error.
Do you have any idea of what's wrong ?
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/igstk-users/attachments/20070319/900fa7e8/attachment-0002.html>
More information about the IGSTK-Users
mailing list