}
//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+//Read transformation in NKI format (Xdr, transposed, cm)
+void vvImageReader::ReadNkiImageTransform()
+{
+ bool bRead=true;
+ typedef itk::ImageFileReader< itk::Image< double, 2 > > MatrixReaderType;
+ MatrixReaderType::Pointer readerTransfo = MatrixReaderType::New();
+ readerTransfo->SetFileName(mInputFilenames[0]+".MACHINEORIENTATION");
+DD(mInputFilenames[0]+".MACHINEORIENTATION");
+ try
+ { readerTransfo->Update();
+ }
+ catch( itk::ExceptionObject & err )
+ { bRead=false;
+ }
+
+ if (bRead)
+ { double mat[16];
+
+ //Transpose matrix (NKI format)
+ for(int j=0; j<4; j++)
+ for(int i=0; i<4; i++)
+ mat[4*j+i]=readerTransfo->GetOutput()->GetBufferPointer()[4*i+j];
+
+ //From cm to mm
+ for(int i=0; i<3; i++)
+ mat[4*i+3]*=10;
+
+ //Set Transformation
+ vtkSmartPointer<vtkTransform> pt = vtkSmartPointer<vtkTransform>::New();
+ pt->SetMatrix( mat );
+ pt->Inverse();
+DD(*pt);
+ mImage->SetTransform( pt );
+ }
+}
+//------------------------------------------------------------------------------
#endif
int mDim;
std::string mInputPixelType;
+ //====================================================================
+ void ReadNkiImageTransform();
private:
vvImage::Pointer mImage;
#include <string>
#include <itkImageFileReader.h>
#include <itkImageSeriesReader.h>
+#include <itkImageToVTKImageFilter.h>
+
+#include <vtkTransform.h>
+
#include "clitkCommon.h"
-#include "itkImageToVTKImageFilter.h"
#include "vvFromITK.h"
#include "vvConstants.h"
UpdateWithDimAndInputPixelType<float,VImageDimension>();
else
std::cerr << "Error, input pixel type : " << InputPixelType << " unknown !" << std::endl;
+
+ if (CLITK_EXPERIMENTAL)
+ if (mLastError.size()==0)
+ ReadNkiImageTransform();
}
//----------------------------------------------------------------------------