]> Creatis software - gdcm.git/blobdiff - src/gdcmFile.h
ENH: Apparently implementation of GetMacAddress linux also works on my cygwin
[gdcm.git] / src / gdcmFile.h
index 23f87ff6edc4f47298a05aa82e310512ade5bd6e..219eddbbeddbc2bf900aa1d02f39b613e760279c 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmFile.h,v $
   Language:  C++
-  Date:      $Date: 2004/12/07 17:28:50 $
-  Version:   $Revision: 1.85 $
+  Date:      $Date: 2005/01/11 15:15:38 $
+  Version:   $Revision: 1.93 $
                                                                                 
   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 
 {
@@ -30,61 +31,74 @@ class PixelReadConvert;
 class PixelWriteConvert;
 class DocEntryArchive;
 //-----------------------------------------------------------------------------
-/*
- * In addition to Dicom header exploration, this class is designed
+/**
+ * \brief In addition to Dicom Header exploration, this class is designed
  * 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( );
-   File( Headerheader );
-   File( std::string constfilename );
+   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 constfileName);
-   bool WriteDcmImplVR(std::string constfileName);
-   bool WriteDcmExplVR(std::string constfileName);
-   bool WriteAcr      (std::string constfileName);
-   bool Write(std::string const& fileName);
-
-   bool SetEntryByNumber(std::string const& content,
-                         uint16_t group, uint16_t element);
-   bool SetEntryByNumber(uint8_t* content, int lgth,
-                         uint16_t group, uint16_t element);
-   bool ReplaceOrCreateByNumber(std::string const& content,
-                                uint16_t group, uint16_t element);
-   bool ReplaceOrCreateByNumber(uint8_t* binArea, int lgth,
-                                uint16_t group, uint16_t elem);
+   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; };
@@ -98,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();
 
@@ -114,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;
 
@@ -138,8 +148,8 @@ private:
    bool Parsed;
 
    /// Utility pixel converter
-   PixelReadConvertPixelReadConverter;
-   PixelWriteConvertPixelWriteConverter;
+   PixelReadConvert *PixelReadConverter;
+   PixelWriteConvert *PixelWriteConverter;
 
    // Utility header archive
    DocEntryArchive *Archive;