Hi Claudia,

I don't see any error in your code. I use a similar approach, which works fine:

  // initialize
  mitk::Image::Pointer image = mitk::Image::New();
  image->Initialize(mitk::PixelType(typeid(unsigned char)), dimension, 
dimensions);  // dimension = 4

  // Fill with zeroes (optional)
  unsigned int byteSize = sizeof(unsigned char);
  for (unsigned int dim = 0; dim < dimension; ++dim) 
  {
    byteSize *= image->GetDimension(dim);
  }
  memset(image->GetData(), 0, byteSize );

  // Fill a time step
  mitkIpPicDescriptor* currentVolume = 
resultImage->GetVolumeData(0)->GetPicDescriptor();  // resultImage is 3D
  image->SetPicVolume( currentVolume , currentTime );                           
           // currentTime is counted up



Could you please try it this way, too? Maybe there is a bug in 
SetImportVolume().

Best, 
Tobi


------------------------------------------------------------
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]
Web: 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.

-----Ursprüngliche Nachricht-----
Von: Claudia Hänel [mailto:[email protected]] 
Gesendet: Mittwoch, 28. Juli 2010 10:20
An: [email protected]
Betreff: [mitk-users] Saving 3D data over time into one mitk::Image

Hi,

I want to write some 3D data over time into a mitk::Image.
What I do is the following:

void MyImageData::Initialize(mitk::Image::Pointer image, int nrOfVolumes)
{
        unsigned int *d = image->GetDimensions();
        d[3] = nrOfVolumes;

        imageSeries = mitk::Image::New();
        imageSeries->Initialize(image->GetPixelType(), 4,d,1);

        initialized = true;
}

bool MyImageData::pushDataBack(mitk::Image::Pointer image)
{
        if (initialized)
        {
                imageSeries->SetImportVolume(image, time);
                imageSeries->GetData();
                imageSeries->Update();

                if(imageSeries->IsVolumeSet(time))
                {
                        time++;
                        return true;
                }
                return false;
        }
        else
                return false;

}

It works fine for the first image. After that I get exceptions in the  
memory management. I tried all variants of  
mitk::Image::ImportMemoryManagementType in the SetImportVolume-function.
As I understand the concept of mitk::Image I can save data with the  
same region and data type over time just by increasing the time  
variable, right?
Can anyone help me, please?

Best regards,
Claudia




------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to