Hi

I played a little bit with vtk->Mitk->vtk conversion and found a nice bug:

I have an loaded vtkImageData object:

vtkImageData* poVTKImage;
...//loading of image

//Print origin, index and size:

std::cout << "Origin: " << poVTKImage->GetOrigin()[0] << " " << 
poVTKImage->GetOrigin()[1] << " " << poVTKImage->GetOrigin()[2] << std::endl;

std::cout << "Index: " << poVTKImage->GetWholeExtent()[0] << " " << 
poVTKImage->GetWholeExtent()[2] << " " << poVTKImage->GetWholeExtent()[4] << 
std::endl;

std::cout << "Size: " << poVTKImage->GetWholeExtent()[1]+1 << " " << 
poVTKImage->GetWholeExtent()[3]+1 << " " << poVTKImage->GetWholeExtent()[5]+1 
<< std::endl;



//convert to mitk:

mitk::Image::Pointer oMITKImage = mitk::Image::New();

oMITKImage->Initialize(oImageReader->GetOutput()->GetImage());

oMITKImage->SetVolume(oImageReader->GetOutput()->GetImage()->GetScalarPointer());

oMITKImage->Update();



//convert back to vtk:

vtkImageData* poVTKImageFromMITKImage = oImage->GetVtkImageData();

std::cout << "Origin: " << poVTKImageFromMITKImage ->GetOrigin()[0] << " " << 
poVTKImageFromMITKImage ->GetOrigin()[1] << " " << poVTKImageFromMITKImage 
->GetOrigin()[2] << std::endl;

std::cout << "Index: " << poVTKImageFromMITKImage ->GetWholeExtent()[0] << " " 
<< poVTKImageFromMITKImage ->GetWholeExtent()[2] << " " << 
poVTKImageFromMITKImage ->GetWholeExtent()[4] << std::endl;

std::cout << "Size: " << poVTKImageFromMITKImage ->GetWholeExtent()[1]+1 << " " 
<< poVTKImageFromMITKImage ->GetWholeExtent()[3]+1 << " " << 
poVTKImageFromMITKImage ->GetWholeExtent()[5]+1 << std::endl;



My cout output is:

Origin: -350.00 -358.20 -1363.50

Index: 0 0 0

Size: 512 512 181



Origin: 0.00 0.00 0.00

Index: 0 0 0

Size: 512 512 181



Origin does not match!!!!
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to