]> Creatis software - clitk.git/commitdiff
clitkDicom2Image with imaging machine coordinate system (Identity matrix) by default
authortbaudier <thomas.baudier@creatis.insa-lyon.fr>
Thu, 16 Nov 2017 16:02:20 +0000 (17:02 +0100)
committertbaudier <thomas.baudier@creatis.insa-lyon.fr>
Thu, 16 Nov 2017 16:02:20 +0000 (17:02 +0100)
Add an option to have it with patient coordinate system

tools/clitkDicom2Image.cxx
tools/clitkDicom2Image.ggo

index ffd08e8a9b9941c49585b5ec5cf05a7028cec97d..51a32d15550ff3a1afe2dff199d97514e81ccbd0 100644 (file)
@@ -91,16 +91,19 @@ int main(int argc, char * argv[])
     series_numbers.insert(series_number);
     theorigin[series_number] = gdcm::ImageHelper::GetOriginValue(hreader.GetFile());
     theorientation[series_number] = gdcm::ImageHelper::GetDirectionCosinesValue(hreader.GetFile());
-    double n1 = theorientation[series_number][1]*theorientation[series_number][5]-
-                theorientation[series_number][2]*theorientation[series_number][4];
-    double n2 = theorientation[series_number][3]*theorientation[series_number][2]-
-                theorientation[series_number][5]*theorientation[series_number][0];
-    double n3 = theorientation[series_number][0]*theorientation[series_number][4]-
-                theorientation[series_number][1]*theorientation[series_number][3];
-    double sloc = theorigin[series_number][0]*n1+
-                  theorigin[series_number][1]*n2+
-                  theorigin[series_number][2]*n3;
-    sliceLocations[series_number].push_back(sloc);
+    if (args_info.extract_series_flag) {
+      double n1 = theorientation[series_number][1]*theorientation[series_number][5]-
+                  theorientation[series_number][2]*theorientation[series_number][4];
+      double n2 = theorientation[series_number][3]*theorientation[series_number][2]-
+                  theorientation[series_number][5]*theorientation[series_number][0];
+      double n3 = theorientation[series_number][0]*theorientation[series_number][4]-
+                  theorientation[series_number][1]*theorientation[series_number][3];
+      double sloc = theorigin[series_number][0]*n1+
+                    theorigin[series_number][1]*n2+
+                    theorigin[series_number][2]*n3;
+      sliceLocations[series_number].push_back(sloc);
+    } else
+      sliceLocations[series_number].push_back(theorigin[series_number][2]);
     seriesFiles[series_number].push_back(input_files[i]);
 
     gdcm::Attribute<0x28, 0x100> pixel_size;
@@ -238,7 +241,7 @@ int main(int argc, char * argv[])
     }
     vvImageWriter::Pointer writer = vvImageWriter::New();
     writer->SetInput(image);
-    if (!image->GetTransform().empty())
+    if (args_info.extract_series_flag && !image->GetTransform().empty())
       writer->SetSaveTransform(true);
     writer->SetOutputFileName(outfile);
     writer->Update();
index daf0a5bb2e0353fcbe4fa4a9b1184f62b5ffb5c3..7cf454f87ac8c0c6458ba3a2a182ffe047f71c2a 100644 (file)
@@ -2,10 +2,11 @@
 package "clitk"
 version "Try to convert a DICOM into an image (.hdr, .vox...)"
 
-option "config"                 -      "Config file"            string         no
-option "verbose"        v "Verbose"                     flag off
-option "tolerance"      t "Tolerance for slice position"        double default="0" no
-option "output"      o "Output image filename"         string  yes
-option "std_input"   - "Take the like of input file from stdin, to support huge lists of filenames" flag off
-option "focal_origin" - "Output files with FOCAL-like origin, instead of the origin present in the dicom files" flag off
+option "config"                    -   "Config file"            string         no
+option "verbose"             v "Verbose"                        flag off
+option "tolerance"         t "Tolerance for slice position"     double default="0" no
+option "output"         o "Output image filename"              string  yes
+option "std_input"      - "Take the like of input file from stdin, to support huge lists of filenames" flag off
+option "focal_origin"   - "Output files with FOCAL-like origin, instead of the origin present in the dicom files" flag off
 option "extract_series" s "Identify different series in the file list and create the MHDs accordinly" flag off
+option "patientSystem"  p "Open the image with patient coordinate system" flag off