]> Creatis software - gdcm.git/blobdiff - Example/TestWrite.cxx
* DEVELOPPER spread out in Doc/Website/Developpers.html, CodingStyle.html,
[gdcm.git] / Example / TestWrite.cxx
index 402f7c684298e0e5e71e2be4753407dd3ea8f1cd..5e58ac2d9404b14a27f70924dbd841e5173361da 100644 (file)
@@ -19,9 +19,11 @@ int main(int argc, char* argv[])
          std::cerr << "usage: " << std::endl 
                    << argv[0] << " fileName writtingMode "
                 << std::endl 
-                   << "(a : ACR, d : DICOM Implicit VR,"
-                   << " x : DICOM Explicit VR  r : RAW)"
+                   << "(a : ACR, gives fileNamed : DICOM Implicit VR,"
+                   << " x : DICOM Explicit VR  r : RAW,"
+                   << " v : explicit VR + computes the video inv image"
                 << std::endl;
+
          return 0;
    }
 /*
@@ -46,7 +48,7 @@ int main(int argc, char* argv[])
      
    toto = argv[1]; 
 
-   e1 = new gdcmHeader( toto.c_str(), false );
+   e1 = new gdcmHeader( toto.c_str() );
    if (!e1->IsReadable())
    {
        std::cerr << "Sorry, not a Readable DICOM / ACR File"  <<std::endl;
@@ -132,6 +134,22 @@ int main(int argc, char* argv[])
       f1->WriteRawData(zozo);
       break;
 
+   case 'v' :
+
+     if ( f1->GetHeader()->GetBitsStored() == 8)
+        for (int i=0; i<dataSize; i++) {
+           ((char *)imageData)[i] += 127;
+        }
+     else  
+        for (int i=0; i<dataSize/2; i++) {
+           ((unsigned short *)imageData)[i] += 32767;
+        }
+
+         sprintf(zozo, "%s.DCM", toto.c_str());
+         printf ("WriteDCM Implicit VR\n");
+         f1->WriteDcmImplVR(zozo);
+         break;
+
    }
   return 0;
 }