From 0a4f28d5ec16e85a53faa056246fd9d7dde3a168 Mon Sep 17 00:00:00 2001 From: jpr Date: Sun, 23 Oct 2005 15:09:19 +0000 Subject: [PATCH] In order to avoid confusing user with 'public' methods he is not allowed to use, - move *all* the methods of PixelReadConvert, PixelWriteConvert to 'private'. - declare as friend class FileHelper --- src/gdcmPixelReadConvert.cxx | 26 ++++++++++++++------------ src/gdcmPixelReadConvert.h | 20 +++++++++++++++----- src/gdcmPixelWriteConvert.cxx | 20 +++++++++++++------- src/gdcmPixelWriteConvert.h | 23 ++++++++++++++++------- 4 files changed, 58 insertions(+), 31 deletions(-) diff --git a/src/gdcmPixelReadConvert.cxx b/src/gdcmPixelReadConvert.cxx index e941a07f..1b8db70d 100644 --- a/src/gdcmPixelReadConvert.cxx +++ b/src/gdcmPixelReadConvert.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmPixelReadConvert.cxx,v $ Language: C++ - Date: $Date: 2005/10/21 17:11:33 $ - Version: $Revision: 1.84 $ + Date: $Date: 2005/10/23 15:09:19 $ + Version: $Revision: 1.85 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -526,17 +526,19 @@ bool PixelReadConvert::ReadAndDecompressJPEGFile( std::ifstream *fp ) } /** - * \brief Build Red/Green/Blue/Alpha LUT from File - * when (0028,0004),Photometric Interpretation = [PALETTE COLOR ] - * and (0028,1101),(0028,1102),(0028,1102) - * - xxx Palette Color Lookup Table Descriptor - are found - * and (0028,1201),(0028,1202),(0028,1202) - * - xxx Palette Color Lookup Table Data - are found + * \brief Build Red/Green/Blue/Alpha LUT from File when : + * - (0028,0004) : Photometric Interpretation == [PALETTE COLOR ] + * and + * - (0028,1101),(0028,1102),(0028,1102) + * xxx Palette Color Lookup Table Descriptor are found + * and + * - (0028,1201),(0028,1202),(0028,1202) + * xxx Palette Color Lookup Table Data - are found * \warning does NOT deal with : - * 0028 1100 Gray Lookup Table Descriptor (Retired) - * 0028 1221 Segmented Red Palette Color Lookup Table Data - * 0028 1222 Segmented Green Palette Color Lookup Table Data - * 0028 1223 Segmented Blue Palette Color Lookup Table Data + * - 0028 1100 Gray Lookup Table Descriptor (Retired) + * - 0028 1221 Segmented Red Palette Color Lookup Table Data + * - 0028 1222 Segmented Green Palette Color Lookup Table Data + * - 0028 1223 Segmented Blue Palette Color Lookup Table Data * no known Dicom reader deals with them :-( * @return a RGBA Lookup Table */ diff --git a/src/gdcmPixelReadConvert.h b/src/gdcmPixelReadConvert.h index f82f292d..4aac9d3d 100644 --- a/src/gdcmPixelReadConvert.h +++ b/src/gdcmPixelReadConvert.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmPixelReadConvert.h,v $ Language: C++ - Date: $Date: 2005/10/20 08:29:50 $ - Version: $Revision: 1.25 $ + Date: $Date: 2005/10/23 15:09:19 $ + Version: $Revision: 1.26 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -40,19 +40,28 @@ typedef void (*VOID_FUNCTION_PUINT8_PFILE_POINTER)(uint8_t *, File *); */ class GDCM_EXPORT PixelReadConvert : public Base { -public: +friend class FileHelper; + +private: PixelReadConvert(); virtual ~PixelReadConvert(); void Print( std::ostream &os = std::cout, std::string const &indent = "" ); // Getter accessors: + /// \brief returns pixel area holding RGB Pixels, made from Grey level + LUT uint8_t *GetRGB() { return RGB; } + /// \brief returns pixel area length -RGB Pixels, (from Grey level + LUT)- size_t GetRGBSize() { return RGBSize; } + /// \brief returns pixel area holding native RGB Pixels or Grey level uint8_t *GetRaw() { return Raw; } + /// \brief returns pixel area size -native RGB Pixels or Grey level- size_t GetRawSize() { return RawSize; } + /// \brief returns Red Green Blue Alpha LUT uint8_t *GetLutRGBA() { return LutRGBA; } + /// \brief returns Lut Item Number int GetLutItemNumber() { return LutItemNumber; } + /// \brief returns Lut Item Size int GetLutItemSize() { return LutItemSize; } // Predicates: bool IsRawRGB(); @@ -63,10 +72,11 @@ public: void Squeeze(); bool BuildRGBImage(); void BuildLUTRGBA(); - +/// \brief Allow user to pass his own function to modify pixels +/// (e.g; mirror, upsidedown, ...) just after reading void SetUserFunction( VOID_FUNCTION_PUINT8_PFILE_POINTER userFunc ) { UserFunction = userFunc; } -private: + // Use the fp: void ReadAndDecompress12BitsTo16Bits( std::ifstream *fp ) throw ( FormatError ); diff --git a/src/gdcmPixelWriteConvert.cxx b/src/gdcmPixelWriteConvert.cxx index b4f67961..9258fc14 100644 --- a/src/gdcmPixelWriteConvert.cxx +++ b/src/gdcmPixelWriteConvert.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmPixelWriteConvert.cxx,v $ Language: C++ - Date: $Date: 2005/09/21 09:44:59 $ - Version: $Revision: 1.10 $ + Date: $Date: 2005/10/23 15:09:19 $ + Version: $Revision: 1.11 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -45,10 +45,10 @@ PixelWriteConvert::~PixelWriteConvert() //----------------------------------------------------------------------------- // Public /** - * \brief SetReadData + * \brief sets Read Data (and size) * @param data data (uint8_t is for prototyping. if your data is not uint8_t * just cast the pointer for calling the method) - * @param size size in bytes + * @param size data size, in bytes */ void PixelWriteConvert::SetReadData(uint8_t *data, size_t size) { @@ -57,10 +57,16 @@ void PixelWriteConvert::SetReadData(uint8_t *data, size_t size) } /** - * \brief Sets User Data + * \brief Sets the internal pointer to the caller's inData + * image representation, BUT WITHOUT COPYING THE DATA. + * - 'image' Pixels are presented as C-like 2D arrays : line per line. + * - 'volume'Pixels are presented as C-like 3D arrays : plane per plane + * \warning Since the pixels are not copied, it is the caller's responsability + * not to deallocate its data before gdcm uses them (e.g. with + * the Write() method ) * @param data data (uint8_t is for prototyping. if your data is not uint8_t * just cast the pointer for calling the method) - * @param size size in bytes + * @param size size, in bytes. */ void PixelWriteConvert::SetUserData(uint8_t *data, size_t size) { @@ -87,7 +93,7 @@ uint8_t *PixelWriteConvert::GetData() /** * \brief Get Data Size (UserData or ReadData) - * @return size size in bytes + * @return size, in bytes. */ size_t PixelWriteConvert::GetDataSize() { diff --git a/src/gdcmPixelWriteConvert.h b/src/gdcmPixelWriteConvert.h index 7239238e..bbdcad27 100644 --- a/src/gdcmPixelWriteConvert.h +++ b/src/gdcmPixelWriteConvert.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmPixelWriteConvert.h,v $ Language: C++ - Date: $Date: 2005/01/11 15:15:38 $ - Version: $Revision: 1.6 $ + Date: $Date: 2005/10/23 15:09:19 $ + Version: $Revision: 1.7 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -27,28 +27,37 @@ namespace gdcm { /** * \brief Utility container for gathering the various forms the pixel data - * migth take during the user demanded processes. + * migth take during the user requiered processes. + * \warning None of the methods may be called by end user (they have no + * meaning outside the class FileHelper) */ class GDCM_EXPORT PixelWriteConvert : public Base { -public: +friend class FileHelper; + +private: PixelWriteConvert(); virtual ~PixelWriteConvert(); // Set/Get of images and their size - void SetReadData(uint8_t *data,size_t size); + + void SetReadData(uint8_t *data, size_t size); + /// \brief returns ReadData uint8_t *GetReadData() { return ReadData; } + /// \brief returns ReadDataSize size_t GetReadDataSize() { return ReadDataSize; } - void SetUserData(uint8_t *data,size_t size); + void SetUserData(uint8_t *data, size_t size); + /// \brief returns UserData uint8_t *GetUserData() { return UserData; } + /// \brief returns UserDataSize size_t GetUserDataSize() { return UserDataSize; } // Get the used image and its size uint8_t *GetData(); size_t GetDataSize(); -private: + // Variables /// Pixel data represented as RGB after LUT color interpretation. uint8_t *ReadData; -- 2.46.0