Hi Claudia,

i just compiled and executed a small program containing your code without any 
problems:

#include <mitkImage.h>
#include <mitkPicFileReader.h>
#include <mitkImageDataItem.h>
int main(int argc, char* argv[])
{
  mitk::PicFileReader::Pointer reader = mitk::PicFileReader::New();
  const char * filename = 
"/local/muellerm/mitk/src/mitk/Core/Code/Testing/Data/Pic2DplusT.pic.gz";
  reader->SetFileName(filename);
  reader->Update();

  mitk::Image::Pointer image = reader->GetOutput();
  MITK_INFO << image;
  mitk::Image::Pointer imageSeries = mitk::Image::New();
  imageSeries->Initialize(image);
  int time = 1;

  // your code
  mitkIpPicDescriptor* currentVolume
      = image->GetVolumeData(0)->GetPicDescriptor();
  imageSeries->SetPicVolume(image->GetVolumeData(0)->GetPicDescriptor(),time);
 // end of your code

  MITK_INFO << imageSeries;
}

I am running Ubuntu with ITK 3.16. Unfortunately, I can`t remember if your 
Visual Studio compiler complains about incomplete types (as GCC does) or if the 
MS Linker just throws unresolved symbols errors. However, make sure that you 
have mitkImageDataItem.h included because mitk::ImageDataItem is just forward 
declared in mitkImage.h.
So far I have no other idea what may be the cause of your error.

Regards,
Michael

Von: Claudia Hänel [mailto:[email protected]]
Gesendet: Donnerstag, 29. Juli 2010 15:57
An: Schwarz Tobias
Cc: [email protected]
Betreff: Re: [mitk-users] Saving 3D data over time into one mitk::Image

Hi,

if I try it with

mitkIpPicDescriptor* currentVolume = 
image->GetVolumeData(0)->GetPicDescriptor();
imageSeries->SetPicVolume(image->GetVolumeData(0)->GetPicDescriptor(),time);

I get a linking error

error LNK2001: Nicht aufgelöstes externes Symbol ""public: __thiscall 
itk::SmartPointerForwardReference<class 
mitk::ImageDataItem>::~SmartPointerForwardReference<class 
mitk::ImageDataItem>(void)" 
(??1?$smartpointerforwardrefere...@vimagedataitem@mitk@@@itk@@q...@xz)".

But I can't figure out which library is missing. itkCommon.lib (for 
itk::SmartPointerForwardReference) and mitkCore.lib (for mitk::ImageDataItem) 
are included

Best regards,
Claudia


Zitat von Schwarz Tobias <[email protected]>:

> 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