Ok, thanks.

I think i will currntly let my vtkImageData solution

PS: the itkTileImageFilter can combine 3D itkimages to a 4D image 
theoretically, not tested but should work

Von: Hering, Jan [mailto:[email protected]]
Gesendet: Donnerstag, 12. April 2012 13:43
An: Lodron, Gerald
Cc: MITK ([email protected])
Betreff: AW: 4D image initialization form itk 3d image stack

Hi Lodron,

ad 1) you would actually need to convert only one of your 3D images, as long as 
they all have the same geometry. If not, you need to initialize each time step 
of the time sliced geometry with geom->SetGeometry3D( vector_of_images[ t 
]->GetGeometry(), t ).

The Geometry3D can be created also directly by accessing the ITK image, but you 
have to set all essential parts manually:

geom->SetOrigin( itkImage->GetOrigin() ),and so on for Spacing, Direction, 
Center

ad 2) the time sliced geometry can be passed to an 4D image by the method
                      void mitk::Image::Initialize( PixelType, Geometry* )

Another possibility would be to create an 4D ITK image, and fill this by 
iterating over the 3D vector and then over each image.  As far as I know ITK 
does not provide a filter for combining 3D Volumes to a single 4D Dataset.

I have also added a feature-request to our bug tracker so the issue will get 
discussed and possible also implemented. You can follow the activity here ( 
http://bugs.mitk.org/show_bug.cgi?id=11676 )

Regards,

Jan


Von: Lodron, Gerald 
[mailto:[email protected]]<mailto:[mailto:[email protected]]>
Gesendet: Donnerstag, 12. April 2012 12:14
An: Hering, Jan
Cc: MITK 
([email protected]<mailto:[email protected]>)
Betreff: AW: 4D image initialization form itk 3d image stack

Hi

I currently made it over converting it to a vtkImagedata but it looks awful:

typedef itk::ImageToVTKImageFilter<TImage3D_US>  TVTKConverter;

TVTKConverter::Pointer oC = TVTKConverter::New();
      oC->SetInput(o3DImageStack.at(0).GetPointer());
      oC->Update();

      oImage->Initialize(oC->GetOutput(),1,o3DImageStack.size());
      oImage->SetVolume(oC->GetOutput()->GetScalarPointer(), 0);

      for(unsigned int i=1; i<o3DImageStack.size(); i++)
      {
        oC->SetInput(o3DImageStack.at(i).GetPointer());
        oC->Update();
        oImage->SetVolume(oC->GetOutput()->GetScalarPointer(), i);
      }

Your solution over the timeslicedgeometry does not work (for me :)):

1)  m_VectorOf3DImages[ 0 ]->GetGeometry -> there is no GetGeometry of an 
itk::Image. Should I first convert it to a mitk::Image?

2)  There is not mitk::Image::SetTimeSlicedGeometry method in mitk::Image, only 
a getter which returns a constant. So how do I combine the timeslicedgeometry 
with the mitk::Image (over SetGeometry?)

Best regards
Von: Hering, Jan [mailto:[email protected]]
Gesendet: Donnerstag, 12. April 2012 12:03
An: Lodron, Gerald; MITK 
([email protected]<mailto:[email protected]>)
Betreff: AW: 4D image initialization form itk 3d image stack

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]]<mailto:[mailto:[email protected]]>
Gesendet: Donnerstag, 12. April 2012 10:59
An: MITK 
([email protected]<mailto:[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