]> Creatis software - clitk.git/blobdiff - tools/clitkDicom2Image.cxx
Open Dicom with imaging machine coordinate system (Identity matrix) by default
[clitk.git] / tools / clitkDicom2Image.cxx
index 4e8b268709825ccddf542a09df9169984d77b7c0..ffd08e8a9b9941c49585b5ec5cf05a7028cec97d 100644 (file)
@@ -17,6 +17,7 @@
 ===========================================================================**/
 
 // clitk includes
+#include "clitkIO.h"
 #include "clitkDicom2Image_ggo.h"
 #include "clitkCommon.h"
 #include "clitkImageCommon.h"
@@ -38,6 +39,8 @@ int main(int argc, char * argv[])
 {
   // init command line
   GGO(clitkDicom2Image, args_info);
+  CLITK_INIT;
+
   std::vector<std::string> input_files;
   ///if std_input is given, read the input files from stdin
   if (args_info.std_input_given) {
@@ -233,24 +236,10 @@ int main(int argc, char * argv[])
         name << *sn << "_" << args_info.output_arg;
       outfile = name.str();
     }
-    //Check on transform
-    bool bId = true;
-    for(unsigned int i=0; i<4; i++) {
-      for(unsigned int j=0; j<4; j++) {
-        double elt = image->GetTransform()[0]->GetMatrix()->GetElement(i,j);
-        if(i==j && elt!=1.) {
-          bId = false;
-        }
-        if(i!=j && elt!=0.) {
-          bId = false;
-        }
-      }
-    }
     vvImageWriter::Pointer writer = vvImageWriter::New();
     writer->SetInput(image);
-    if(!bId) {
-        writer->SetSaveTransform(true);
-    }
+    if (!image->GetTransform().empty())
+      writer->SetSaveTransform(true);
     writer->SetOutputFileName(outfile);
     writer->Update();