-//-----------------------------------------------------------------------------
-/*
- * 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
-{
-public:
- enum WriteMode
- {
- WMODE_DECOMPRESSED,
- WMODE_RGB
- };
-
-public:
- File( Header* header );
- File( std::string const& filename );
-
- virtual ~File();
-
- /// Accessor to \ref Header
- Header* GetHeader() { return HeaderInternal; }
-
- size_t GetImageDataSize();
- size_t GetImageDataRawSize();
-
- uint8_t* GetImageData();
- uint8_t* GetImageDataRaw();
- size_t GetImageDataIntoVector(void* destination, size_t maxSize);
-
- bool SetImageData (uint8_t* data, size_t expectedSize);
-
- // 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);
-
- virtual bool SetEntryByNumber(std::string const& content,
- uint16_t group, uint16_t element)
- {
- HeaderInternal->SetEntryByNumber(content,group,element);
- return true;
- }
- uint8_t* GetLutRGBA();
-
- // Write mode
- void SetWriteModeToDecompressed() { SetWriteMode(WMODE_DECOMPRESSED); };
- void SetWriteModeToRGB() { SetWriteMode(WMODE_RGB); };
- void SetWriteMode(WriteMode mode) { WriteMode = mode; };
- WriteMode GetWriteMode() { return WriteMode; };
-
- // Write format
- void SetWriteTypeToDcmImplVR() { SetWriteType(ImplicitVR); };
- void SetWriteTypeToDcmExplVR() { SetWriteType(ExplicitVR); };
- void SetWriteTypeToAcr() { SetWriteType(ACR); };
- void SetWriteTypeToAcrLibido() { SetWriteType(ACR_LIBIDO); };
- void SetWriteType(FileType format) { WriteType = format; };
- FileType GetWriteType() { return WriteType; };
-
-protected:
- bool WriteBase(std::string const& fileName);
- bool CheckWriteIntegrity();