Dear Jyo Yong,

that is becasue MITK images always have to initialized. I think you with NULL 
image you mean an image containing only zeros?
Easiest way would be to use the BasicImageProcessing module and subtract the 
original image from itself.

Or you could use code like this:

  unsigned int dimension = origImage->GetDimension();
  unsigned int * dimensions = origImage ->GetDimensions();
  mitk::Image::Pointer maskImage = mitk::Image::New();
  maskImage->Initialize(mitk::PixelType(typeid(unsigned char)), dimension, 
dimensions);

  unsigned int byteSize = sizeof(unsigned char);
  for (unsigned int dim = 0; dim < dimension; ++dim)
  {
    byteSize *= maskImage->GetDimension(dim);
  }
  memset(maskImage->GetData(), 0, byteSize );

  if (origImage->GetTimeSlicedGeometry() )
  {
    mitk::AffineGeometryFrame3D::Pointer originalGeometryAGF = 
origImage->GetTimeSlicedGeometry()->Clone();
    mitk::Geometry3D::Pointer originalGeometry = 
dynamic_cast<mitk::TimeSlicedGeometry*>( originalGeometryAGF.GetPointer() );
    if ( originalGeometry.IsNull() ) std::cout << "Warning: Segmentation 
Geometry is NULL!" << std::endl;
    maskImage->SetGeometry( originalGeometry );
  }

Best regards,
Tobias


------------------------------------------------------------
Tobias Schwarz
DKFZ
German Cancer Research Center (Deutsches Krebsforschungszentrum)
Member of the Helmholtz Association
Division of Medical & Biological Informatics E130
Im Neuenheimer Feld 280
D-69120 Heidelberg
Phone: 49-(0)6221-42-2353
Fax: 49-(0)6221-42-2345
E-Mail: [email protected]<mailto:[email protected]>
Web: www.dkfz.de<http://www.dkfz.de>
Confidentiality Note: This message is intended only for the use of the named 
recipient(s) and may obtain confidential and/or privileged information. If you 
are not the intended recipient, please contact the sender and delete the 
message. Any unauthorized use of the information contained in this message is 
prohibited.

Von: apollocarlos [mailto:[email protected]]
Gesendet: Freitag, 12. März 2010 07:24
An: mitk-users
Betreff: [mitk-users] How to initialize a NULL mitk::image

Dear All,

I am new to MITK. Now i'm trying to create a new, NULL mitk::image for 
contouring, as a mask on the images which are just read in. I tried like blow:
mitk::Image::Pointer m_maskImage = mitk::Image::New();
but when i tried to use GetPic() or GetGeometry(), it says the 0x00000000 
memory can't be read.

Could anyone help me?

thanks.
Best Regards.

Jyo Yong


2010-03-12
________________________________

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to