]> Creatis software - gdcm.git/blobdiff - src/gdcmFile.h
According to Benoit's suggestion, and without any objection from anybody
[gdcm.git] / src / gdcmFile.h
index f72484188d77d0a8363eaa7d4f457398996aed20..da097692bcaa53af0423387cdc766a2f5a3b541b 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmFile.h,v $
   Language:  C++
-  Date:      $Date: 2004/12/04 09:41:02 $
-  Version:   $Revision: 1.84 $
+  Date:      $Date: 2005/01/08 15:03:59 $
+  Version:   $Revision: 1.92 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -19,7 +19,8 @@
 #ifndef GDCMFILE_H
 #define GDCMFILE_H
 
-#include "gdcmCommon.h"
+#include <iostream>
+#include "gdcmBase.h"
 
 namespace gdcm 
 {
@@ -35,48 +36,69 @@ class DocEntryArchive;
  * for accessing the image/volume content. One can also use it to
  * write Dicom/ACR-NEMA/RAW files.
  */
-class GDCM_EXPORT File
+class GDCM_EXPORT File : public Base
 {
 public:
    enum FileMode
    {
-      WMODE_DECOMPRESSED,
+      WMODE_RAW,
       WMODE_RGB
    };
      
 public:
-   File( Header* header );
-   File( std::string const& filename );
+   File( );
+   File( Header *header );
+   File( std::string const &filename );
  
    virtual ~File();
 
+   void Print(std::ostream &os = std::cout); 
+
    /// Accessor to \ref Header
-   HeaderGetHeader() { return HeaderInternal; }
+   Header *GetHeader() { return HeaderInternal; }
 
    size_t GetImageDataSize();
    size_t GetImageDataRawSize();
 
-   uint8_t* GetImageData();
-   uint8_t* GetImageDataRaw();
-   size_t GetImageDataIntoVector(void* destination, size_t maxSize);
+   uint8_t *GetImageData();
+   uint8_t *GetImageDataRaw();
+   size_t GetImageDataIntoVector(void *destination, size_t maxSize);
+
+   void SetImageData(uint8_t *data, size_t expectedSize);
 
-   bool SetImageData (uint8_t* data, size_t expectedSize);
+   // User datas
+   void SetUserData(uint8_t *data, size_t expectedSize);
+   uint8_t* GetUserData();
+   size_t GetUserDataSize();
+   // RBG datas (from file
+   uint8_t* GetRGBData();
+   size_t GetRGBDataSize();
+   // RAW datas (from file
+   uint8_t* GetRawData();
+   size_t GetRawDataSize();
 
    // Write pixels of ONE image on hard drive
    // No test is made on processor "endianity"
    // The user must call his reader correctly
-   bool WriteRawData  (std::string const& fileName);
-   bool WriteDcmImplVR(std::string const& fileName);
-   bool WriteDcmExplVR(std::string const& fileName);
-   bool WriteAcr      (std::string const& fileName);
-   bool Write(std::string const& fileName);
-
-   bool SetEntryByNumber(std::string const& content,
-                                uint16_t group, uint16_t element);
+   bool WriteRawData  (std::string const &fileName);
+   bool WriteDcmImplVR(std::string const &fileName);
+   bool WriteDcmExplVR(std::string const &fileName);
+   bool WriteAcr      (std::string const &fileName);
+   bool Write         (std::string const &fileName);
+
+   bool SetEntry(std::string const &content,
+                 uint16_t group, uint16_t element);
+   bool SetEntry(uint8_t *content, int lgth,
+                 uint16_t group, uint16_t element);
+   bool ReplaceOrCreate(std::string const &content,
+                        uint16_t group, uint16_t element);
+   bool ReplaceOrCreate(uint8_t *binArea, int lgth,
+                        uint16_t group, uint16_t element);
+
    uint8_t* GetLutRGBA();
 
    // Write mode
-   void SetWriteModeToDecompressed() { SetWriteMode(WMODE_DECOMPRESSED); };
+   void SetWriteModeToRaw() { SetWriteMode(WMODE_RAW); };
    void SetWriteModeToRGB()          { SetWriteMode(WMODE_RGB); };
    void SetWriteMode(FileMode mode)  { WriteMode = mode; };
    FileMode GetWriteMode()           { return WriteMode; };
@@ -90,10 +112,9 @@ public:
    FileType GetWriteType()            { return WriteType; };
 
 protected:
-   bool WriteBase(std::string const& fileName);
    bool CheckWriteIntegrity();
 
-   void SetWriteToDecompressed();
+   void SetWriteToRaw();
    void SetWriteToRGB();
    void RestoreWrite();
 
@@ -106,18 +127,15 @@ protected:
    void SetWriteToNoLibido();
    void RestoreWriteOfLibido();
 
-   ValEntryCopyValEntry(uint16_t group,uint16_t element);
-   BinEntryCopyBinEntry(uint16_t group,uint16_t element);
+   ValEntry *CopyValEntry(uint16_t group,uint16_t element);
+   BinEntry *CopyBinEntry(uint16_t group,uint16_t element);
 
 private:
    void Initialise();
 
-   uint8_t* GetDecompressed();
-   int ComputeDecompressedPixelDataSizeFromHeader();
+   uint8_t *GetRaw();
 
-private:
 // members variables:
-
    /// Header to use to load the file
    Header *HeaderInternal;
 
@@ -130,8 +148,8 @@ private:
    bool Parsed;
 
    /// Utility pixel converter
-   PixelReadConvertPixelReadConverter;
-   PixelWriteConvertPixelWriteConverter;
+   PixelReadConvert *PixelReadConverter;
+   PixelWriteConvert *PixelWriteConverter;
 
    // Utility header archive
    DocEntryArchive *Archive;