+
+//------------------------------ Set the Writing mode ---------------------------------
+
+ switch (mode[0])
+ {
+ case 'A' :
+ case 'a' :
+ // Writting an ACR file
+ // from a full gdcm readable File
+ std::cout << "WriteACR" << std::endl;
+ fh->SetWriteTypeToAcr();
+ break;
+
+ case 'D' : // Not documented in the 'usage', because the method
+ case 'd' : // is known to be bugged.
+ // Writting a DICOM Implicit VR file
+ // from a full gdcm readable File
+ std::cout << "WriteDCM Implicit VR" << std::endl;
+ fh->SetWriteTypeToDcmImplVR();
+ break;
+
+ case 'X' :
+ case 'x' :
+ // writting a DICOM Explicit VR
+ // from a full gdcm readable File
+ std::cout << "WriteDCM Explicit VR" << std::endl;
+ // fh->WriteDcmExplVR(outputFileName);
+ // Try this one :
+ fh->SetWriteTypeToDcmExplVR();
+
+ break;
+
+ case 'R' :
+ case 'r' :
+ // Writting a Raw File,
+ std::cout << "WriteRaw" << std::endl;
+ fh->WriteRawData(outputFileName);
+ break;
+
+ case 'J' :
+ case 'j' :
+ // writting a DICOM Jpeg Lossless
+ // from a full gdcm readable File
+ std::cout << "WriteDCM Jpeg Lossless" << std::endl;
+ fh->SetWriteTypeToJPEG();
+ break;
+
+ case '2' :
+ // writting a DICOM Jpeg 2000
+ // from a full gdcm readable File
+ std::cout << "WriteDCM Jpeg 2000" << std::endl;
+ fh->SetWriteTypeToJPEG2000();
+ break;
+
+ // Just for fun :
+ // Write a 'Video inverse' version of the file.
+ // *Not* described, on purpose, in the USAGE
+ case 'V' :
+ case 'v' :
+ if ( fh->GetFile()->GetBitsAllocated() == 8)
+ {
+ std::cout << "videoinv for 8 bits" << std::endl;
+ for (int i=0; i<dataSize; i++)
+ {
+ ((uint8_t*)imageData)[i] = 255 - ((uint8_t*)imageData)[i];
+ }
+ }
+ else
+ {
+ std::cout << "videoinv for 16 bits" << std::endl;
+ for (int i=0; i<dataSize/2; i++)
+ {
+ ((uint16_t*)imageData)[i] = 65535 - ((uint16_t*)imageData)[i];
+ }
+ }
+ std::cout << "WriteDCM Explicit VR + VideoInv" << std::endl;
+ fh->SetWriteTypeToDcmExplVR();
+ break;
+ }
+