]> Creatis software - gdcm.git/blobdiff - src/gdcmFile.cxx
Special patch to allow gdcm to read ACR-LibIDO formatted images
[gdcm.git] / src / gdcmFile.cxx
index ddde9fe44edd128eaf2c2157508876e15d136801..58da7385690e835c033bb3325b8aaf6c9d19fb62 100644 (file)
@@ -864,7 +864,36 @@ int gdcmFile::WriteBase (string FileName, FileType type) {
       fwrite("DICM",4,1,fp1);
    }
 
+   // --------------------------------------------------------------
+   // Special Patch to allow gdcm to re-write ACR-LibIDO formated images
+   //
+   // if recognition code tells us we dealt with a LibIDO image
+   // we reproduce on disk the switch between lineNumber and columnNumber
+   // just before writting ...
+
+   std::string rows, columns; 
+   if ( filetype == ACR_LIBIDO){
+         rows    = GetPubElValByNumber(0x0028, 0x0010);
+         columns = GetPubElValByNumber(0x0028, 0x0011);
+         SetPubElValByNumber(columns,  0x0028, 0x0010);
+         SetPubElValByNumber(rows   ,  0x0028, 0x0011);
+   }   
+   // ----------------- End of Special Patch ----------------
+
    gdcmHeader::Write(fp1, type);
+
+   // --------------------------------------------------------------
+   // Special Patch to allow gdcm to re-write ACR-LibIDO formated images
+   // 
+   // ...and we restore the Header to be Dicom Compliant again 
+   // just after writting
+
+   if (filetype == ACR_LIBIDO){
+         SetPubElValByNumber(rows   , 0x0028, 0x0010);
+         SetPubElValByNumber(columns, 0x0028, 0x0011);
+   }   
+   // ----------------- End of Special Patch ----------------
+
    fwrite(PixelData, lgrTotale, 1, fp1);
    fclose (fp1);
    return(1);