Hi Lodron,

the method Image::InitializeByItk can't extend or change the dimensionality of 
the image. So with the call

mitkImage->InitializeByItk( SomeITK-3D-Image, ...)

the mitkImage will have the same dimensionality ( i.e. 3 ) and also same 
dimension sizes.  The remaining parameters in the function definition can 
change the corresponding dimension size but ONLY if the dimension is available 
in the given input image.

Solution for your problem is to create an mitk::Image with 4 dimensions, and 
also initialize it with a TimeSlicedGeometry:

Could look like:

   mitk::Image::Pointer image4D = mitk::Image::New();
  mitk::TimeSlicedGeometry::Pointer geom = mitk::TimeSlicedGeometry::New();
   geom->InitializeEvenlyTimed( m_VectorOf3DImages[ 0 ]->GetGeometry(), 
m_VectorOf3DImages.size() );
Regards,

Jan


Von: Lodron, Gerald [mailto:[email protected]]
Gesendet: Donnerstag, 12. April 2012 10:59
An: MITK ([email protected])
Betreff: [mitk-users] 4D image initialization form itk 3d image stack

Hi

I try to make a 4d mitk image form a stack of 3d itk images (gray), can anyone 
tell me what i am making wrong:

Std::vector<itk::Image<unsigned short, 3>::Pointer> o3DImageStack;//my filled 
itk image array


mitk::DataNode::Pointer oNode = mitk::DataNode::New();
mitk::Image::Pointer oImage = mitk::Image::New();

oImage->InitializeByItk(o3DImageStack.at(0).GetPointer(),1,o3DImageStack.size());

for(unsigned int i=0; i<o3DImageStack.size(); i++)
{
oImage->SetVolume(o3DImageStack.at(i)->GetBufferPointer(), i);
}

oNode->SetData(oImage);
oDS.Add(oNode);


In the mitk GUI the image has only 1 time step in timeslicedgeometry

Best regards

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to