]> Creatis software - gdcm.git/blobdiff - src/gdcmFileHelper.h
Avoid propagating bugs when ReWrite an image 'not 8 bits- not 16 Bits'
[gdcm.git] / src / gdcmFileHelper.h
index 983c14c6bb972ba9f13171cb03b6b95fa7a1aa68..34b0c7a3c2bd7faed535ff276bb138f68cdb0226 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmFileHelper.h,v $
   Language:  C++
-  Date:      $Date: 2006/03/01 09:45:04 $
-  Version:   $Revision: 1.39 $
+  Date:      $Date: 2006/07/06 12:38:06 $
+  Version:   $Revision: 1.46 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 
 #include "gdcmDebug.h"
 #include "gdcmRefCounter.h"
-
+#include "gdcmVRKey.h"
+#include "gdcmFile.h"
 
 namespace gdcm 
 {
-class File;
+//class File;
 class DataEntry;
 class SeqEntry;
 class PixelReadConvert;
@@ -75,9 +76,9 @@ public:
                             uint16_t group, uint16_t elem);
 
    DataEntry *InsertEntryString(std::string const &content,
-                                       uint16_t group, uint16_t elem);
+                                uint16_t group, uint16_t elem, const VRKey &vr);
    DataEntry *InsertEntryBinArea(uint8_t *binArea, int lgth,
-                                        uint16_t group, uint16_t elem);
+                                 uint16_t group, uint16_t elem, const VRKey &vr);
    SeqEntry *InsertSeqEntry(uint16_t group, uint16_t elem);
 
    // File helpers
@@ -87,7 +88,7 @@ public:
    uint8_t *GetImageData();
    uint8_t *GetImageDataRaw();
 
-   GDCM_LEGACY(size_t GetImageDataIntoVector(void *destination,size_t maxSize));
+//   GDCM_LEGACY(size_t GetImageDataIntoVector(void *destination,size_t maxSize))
 
    void SetImageData(uint8_t *data, size_t expectedSize);
 
@@ -116,7 +117,11 @@ public:
    ///        (as opposed to 'Grey pixels + Palettes color')
    void SetWriteModeToRGB()           { SetWriteMode(WMODE_RGB);  }
    /// \brief Sets the Write Mode ( )
-   void SetWriteMode(FileMode mode)   { WriteMode = mode;         }
+   void SetWriteMode(FileMode mode)   { 
+      WriteMode = mode;
+      // Deal with Samples per Pixel    
+      //if (mode == WMODE_RGB) FileInternal->InsertEntryString("3",0x0028,0x0002);
+   }
    /// \brief Gets the Write Mode ( )
    FileMode GetWriteMode()            { return WriteMode;         }
 
@@ -132,6 +137,8 @@ public:
    void SetWriteTypeToAcrLibido()     { SetWriteType(ACR_LIBIDO); }
    /// \brief Tells the writer we want to write as JPEG   
    void SetWriteTypeToJPEG()          { SetWriteType(JPEG);       }
+   /// \brief Tells the writer we want to write as JPEG2000
+   void SetWriteTypeToJPEG2000()      { SetWriteType(JPEG2000);   }         
    /// \brief Tells the writer which format we want to write
    /// (ImplicitVR, ExplicitVR, ACR, ACR_LIBIDO)
    void SetWriteType(FileType format) { WriteType = format;       }
@@ -155,8 +162,8 @@ public:
 ///    FILTERED_IMAGE
 /// -3) user created a new image, using existing images (eg MIP, MPR, cartography image)
 ///   CREATED_IMAGE
-/// -4) user anonymized an image without processing the pixels.
-///   ANONYMIZED_IMAGE
+/// -4) user modified/added some tags *without processing* the pixels (anonymization...
+///   UNMODIFIED_PIXELS_IMAGE
 
    void SetContentType (ImageContentType c) { ContentType = c; }
    // no GetContentType() method, on purpose!
@@ -178,6 +185,7 @@ protected:
 
    void SetWriteFileTypeToACR();
    void SetWriteFileTypeToJPEG();
+   void SetWriteFileTypeToJPEG2000();   
    void SetWriteFileTypeToExplicitVR();
    void SetWriteFileTypeToImplicitVR();
    void RestoreWriteFileType();
@@ -187,11 +195,14 @@ protected:
    void RestoreWriteOfLibido();
 
    DataEntry *CopyDataEntry(uint16_t group, uint16_t elem, 
-                               const TagName &vr = GDCM_VRUNKNOWN);
+                               const VRKey &vr = GDCM_VRUNKNOWN);
    void CheckMandatoryElements();
-   void CheckMandatoryEntry(uint16_t group, uint16_t elem, std::string value);
-   void SetMandatoryEntry(uint16_t group, uint16_t elem, std::string value);
-   void CopyMandatoryEntry(uint16_t group, uint16_t elem, std::string value);
+   void CheckMandatoryEntry(uint16_t group, uint16_t elem, std::string value,
+                               const VRKey &vr = GDCM_VRUNKNOWN);
+   void SetMandatoryEntry(uint16_t group, uint16_t elem, std::string value,
+                               const VRKey &vr = GDCM_VRUNKNOWN);
+   void CopyMandatoryEntry(uint16_t group, uint16_t elem, std::string value,
+                               const VRKey &vr = GDCM_VRUNKNOWN);
    void RestoreWriteMandatory();
 
 private: