]> Creatis software - gdcm.git/blobdiff - src/gdcmPixelConvert.h
ENH: Adding 'gdcm' namespace. Be nice with me this was a ~13000 lines patch. Also...
[gdcm.git] / src / gdcmPixelConvert.h
index 1dd425a0d97415cfc97984cafb476d0465bcb95c..0ac94ca4131c66422e41f0da1ff699e8fcfb6e85 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmPixelConvert.h,v $
   Language:  C++
-  Date:      $Date: 2004/10/08 16:27:20 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2004/10/12 04:35:47 $
+  Version:   $Revision: 1.6 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 
 #include "gdcmCommon.h"
 #include "gdcmRLEFramesInfo.h"
+#include "gdcmJPEGFragmentsInfo.h"
+#include "gdcmException.h"
+
+namespace gdcm 
+{
 
 /*
  * \brief Utility container for gathering the various forms the pixel data
  *        migth take during the user demanded processes.
  */
-class GDCM_EXPORT gdcmPixelConvert {
-friend class gdcmFile;
+class GDCM_EXPORT PixelConvert {
+friend class File;
    /// Pixel data represented as RGB after color interpretation
    uint8_t* RGB;
    size_t   RGBSize;          //aka ImageDataSize
@@ -36,8 +41,8 @@ friend class gdcmFile;
    uint8_t* Uncompressed;
    size_t   UncompressedSize;
 public:
-   gdcmPixelConvert();
-   ~gdcmPixelConvert();
+   PixelConvert();
+   ~PixelConvert();
 
    uint8_t* GetRGB() { return RGB; }
    void     SetRGBSize( size_t size ) { RGBSize = size; }
@@ -52,36 +57,58 @@ public:
    void Squeeze();
 //////////////////////////////////////////////////////////
 // In progress
-bool ReadAndUncompress12Bits( FILE* filePointer,
-                              size_t uncompressedSize,
-                              size_t PixelNumber );
-bool ReadUncompressed( FILE* filePointer,
-                       size_t uncompressedSize,
-                       size_t expectedSize );
-bool ConvertGrayAndLutToRGB( uint8_t *lutRGBA );
-bool ReadAndUncompressRLE8Bits(FILE* fp, size_t uncompressedSize );
-static bool UncompressRLE16BitsFromRLE8Bits(
-                       int XSize,
-                       int YSize,
-                       int NumberOfFrames,
-                       uint8_t* fixMemUncompressed );
-static bool ReadAndUncompressRLEFragment(
-                                    uint8_t* decodedZone,
-                                    long fragmentSize,
-                                    long uncompressedSegmentSize,
-                                    FILE* fp );
-static bool gdcm_read_RLE_file   ( void* image_buffer,
-                                   int XSize,
-                                   int YSize,
-                                   int ZSize,
-                                   int BitsAllocated,
-                                   gdcmRLEFramesInfo* RLEInfo,
-                                   FILE* fp );
-
+   static bool UncompressRLE16BitsFromRLE8Bits(
+                  int XSize,
+                  int YSize,
+                  int NumberOfFrames,
+                  uint8_t* fixMemUncompressed );
+   static bool ReadAndUncompressRLEFragment(
+                  uint8_t* decodedZone,
+                  long fragmentSize,
+                  long uncompressedSegmentSize,
+                  FILE* fp );
+   static bool ReadAndDecompressRLEFile(
+                  void* image_buffer,
+                  int XSize,
+                  int YSize,
+                  int ZSize,
+                  int BitsAllocated,
+                  RLEFramesInfo* RLEInfo,
+                  FILE* fp );
+   static void ConvertDecompress12BitsTo16Bits(
+                  uint8_t* pixelZone,
+                  int sizeX,
+                  int sizeY,
+                  FILE* filePtr) throw ( FormatError );
+   static void SwapZone(void* im, int swap, int lgr, int nb);
+   static void ConvertReorderEndianity(
+                  uint8_t* pixelZone,
+                  size_t imageDataSize,
+                  int numberBitsStored,
+                  int numberBitsAllocated,
+                  int swapCode,
+                  bool signedPixel );
+   static bool ReadAndDecompressJPEGFile(
+                  uint8_t* destination,
+                  int XSize,
+                  int YSize,
+                  int BitsAllocated,
+                  int BitsStored,
+                  int SamplesPerPixel,
+                  int PixelSize,
+                  bool isJPEG2000,
+                  bool isJPEGLossless,
+                  JPEGFragmentsInfo* JPEGInfo,
+                  FILE* fp );
+   static bool PixelConvert::ConvertReArrangeBits(
+                  uint8_t* pixelZone,
+                  size_t imageDataSize,
+                  int numberBitsStored,
+                  int numberBitsAllocated,
+                  int highBitPosition ) throw ( FormatError );
 
 
 };
-
+} // end namespace gdcm
 //-----------------------------------------------------------------------------
 #endif