X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmPixelWriteConvert.cxx;h=9258fc143d51e80b2d65e28001956a6e9fee0d51;hb=327ad94af0b7e8bce9c8931789133757b318132b;hp=a4f8cec9072a94114db333ec351f4976b0b2a17e;hpb=5d1776a78fb7d94a8325a00e438f7be82c16053c;p=gdcm.git diff --git a/src/gdcmPixelWriteConvert.cxx b/src/gdcmPixelWriteConvert.cxx index a4f8cec9..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: 2004/12/03 11:55:38 $ - Version: $Revision: 1.1 $ + 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 @@ -16,56 +16,105 @@ =========================================================================*/ -////////////////// TEMPORARY NOTE -// look for "fixMem" and convert that to a member of this class -// Removing the prefix fixMem and dealing with allocations should do the trick -// -// grep PixelWriteConvert everywhere and clean up ! - #include "gdcmDebug.h" #include "gdcmPixelWriteConvert.h" -#include namespace gdcm { //----------------------------------------------------------------------------- // Constructor / Destructor +/** + * \brief Constructor + */ PixelWriteConvert::PixelWriteConvert() { - ReadData = 0; + ReadData = 0; ReadDataSize = 0; - UserData = 0; + UserData = 0; UserDataSize = 0; } +/** + * \brief Destructor + */ PixelWriteConvert::~PixelWriteConvert() { } //----------------------------------------------------------------------------- // Public -void PixelWriteConvert::SetReadData(uint8_t* data,size_t size) +/** + * \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 data size, in bytes + */ +void PixelWriteConvert::SetReadData(uint8_t *data, size_t size) { ReadData = data; ReadDataSize = size; } -void PixelWriteConvert::SetUserData(uint8_t* data,size_t size) +/** + * \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. + */ +void PixelWriteConvert::SetUserData(uint8_t *data, size_t size) { UserData = data; UserDataSize = size; } +/** + * \brief Get Data (UserData or ReadData) + * @return data (uint8_t is for prototyping. if your data is + * *not* uint8_t, just cast the returned pointer) + */ +uint8_t *PixelWriteConvert::GetData() +{ + if ( UserData ) + { + return UserData; + } + else + { + return ReadData; + } +} + +/** + * \brief Get Data Size (UserData or ReadData) + * @return size, in bytes. + */ +size_t PixelWriteConvert::GetDataSize() +{ + if ( UserData ) + { + return UserDataSize; + } + else + { + return ReadDataSize; + } +} + //----------------------------------------------------------------------------- -} // end namespace gdcm +// Protected + +//----------------------------------------------------------------------------- +// Private -// NOTES on File internal calls -// User -// ---> GetImageData -// ---> GetImageDataIntoVector -// |---> GetImageDataIntoVectorRaw -// | lut intervention -// User -// ---> GetImageDataRaw -// ---> GetImageDataIntoVectorRaw +//----------------------------------------------------------------------------- +// Print + +//----------------------------------------------------------------------------- +} // end namespace gdcm