Module: $RCSfile: gdcmFileHelper.cxx,v $
Language: C++
- Date: $Date: 2005/07/23 01:59:21 $
- Version: $Revision: 1.50 $
+ Date: $Date: 2005/07/30 18:27:00 $
+ Version: $Revision: 1.51 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
{
FileInternal = new File( );
SelfHeader = true;
+ UserFunction = 0;
Initialize();
}
{
FileInternal = header;
SelfHeader = false;
+ UserFunction = 0;
Initialize();
}
*/
uint8_t *FileHelper::GetRaw()
{
+ PixelReadConverter->SetUserFunction( UserFunction );
+
uint8_t *raw = PixelReadConverter->GetRaw();
if ( ! raw )
{
Program: gdcm
Module: $RCSfile: gdcmFileHelper.h,v $
Language: C++
- Date: $Date: 2005/07/19 15:19:27 $
- Version: $Revision: 1.19 $
+ Date: $Date: 2005/07/30 18:27:00 $
+ Version: $Revision: 1.20 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmBase.h"
//#include <iostream>
+
+
namespace gdcm
{
class File;
class PixelReadConvert;
class PixelWriteConvert;
class DocEntryArchive;
+
+typedef void (*VOID_FUNCTION_PUINT8_PFILE_POINTER)(uint8_t *, File *);
+
//-----------------------------------------------------------------------------
/**
* \brief In addition to Dicom header exploration, this class is designed
void SetLoadMode(int loadMode);
void SetFileName(std::string const &fileName);
bool Load();
-
+ /// to allow user user to modify pixel order (Mirror, TopDown, 90°Rotate,...)
+ void SetUserFunction( VOID_FUNCTION_PUINT8_PFILE_POINTER userFunc )
+ { UserFunction = userFunc; }
// File methods
bool SetValEntry(std::string const &content,
uint16_t group, uint16_t elem);
/// \brief Tells the writer we want to keep 'Grey pixels + Palettes color'
/// when possible (as opposed to convert 'Palettes color' to RGB)
- void SetWriteModeToRaw() { SetWriteMode(WMODE_RAW); };
+ void SetWriteModeToRaw() { SetWriteMode(WMODE_RAW); };
/// \brief Tells the writer we want to write RGB image when possible
/// (as opposed to 'Grey pixels + Palettes color')
void SetWriteModeToRGB() { SetWriteMode(WMODE_RGB); };
/// When false the destructor is in charge of deletion.
bool SelfHeader;
- /// Wether already parsed or not
+ /// Whether already parsed or not
bool Parsed;
// Utility pixel converter
FileMode WriteMode;
/// \brief (ImplicitVR, ExplicitVR, ACR, ACR_LIBIDO)
FileType WriteType;
+ /// Pointer to a user supplied function to allow modification of pixel order
+ /// (i.e. : Mirror, TopDown, 90°Rotation, ...)
+ /// use as : void userSuppliedMirrorFunction(uint8_t *im, gdcm::File *f)
+ /// NB : the "uint8_t *" type of first param is just for prototyping.
+ /// User will Cast it according what he founds with f->GetPixelType()
+ /// See ctkgdcmSerieViewer for an example
+ VOID_FUNCTION_PUINT8_PFILE_POINTER UserFunction;
};
} // end namespace gdcm
/*=========================================================================
-
+
Program: gdcm
Module: $RCSfile: gdcmPixelReadConvert.cxx,v $
Language: C++
- Date: $Date: 2005/07/01 11:25:51 $
- Version: $Revision: 1.74 $
+ Date: $Date: 2005/07/30 18:27:00 $
+ Version: $Revision: 1.75 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
LutBlueData = 0;
RLEInfo = 0;
JPEGInfo = 0;
+ UserFunction = 0;
+ FileInternal = 0;
}
/// Canonical Destructor
YSize = file->GetYSize();
ZSize = file->GetZSize();
SamplesPerPixel = file->GetSamplesPerPixel();
- PixelSize = file->GetPixelSize();
+ //PixelSize = file->GetPixelSize(); Useless
PixelSign = file->IsSignedPixelData();
SwapCode = file->GetSwapCode();
std::string ts = file->GetTransferSyntax();
gdcmWarningMacro( "Unable to read Blue Palette Color Lookup Table data" );
}
}
+ FileInternal = file;
ComputeRawAndRGBSizes();
}
{
//gdcmWarningMacro( "Sorry, MPEG not yet taken into account" );
//return false;
- //ReadMPEGFile(fp, Raw, PixelDataLength); // fp has already been seek to start of mpeg
+ // fp has already been seek to start of mpeg
+ //ReadMPEGFile(fp, Raw, PixelDataLength);
return true;
}
else
ConvertReorderEndianity();
ConvertReArrangeBits();
ConvertFixGreyLevels();
+ if (UserFunction) // user is allowed to Mirror, TopDown, Rotate, .. the image
+ UserFunction( Raw, FileInternal);
ConvertHandleColor();
return true;
Program: gdcm
Module: $RCSfile: gdcmPixelReadConvert.h,v $
Language: C++
- Date: $Date: 2005/06/17 12:35:00 $
- Version: $Revision: 1.23 $
+ Date: $Date: 2005/07/30 18:27:00 $
+ Version: $Revision: 1.24 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
class RLEFramesInfo;
class JPEGFragmentsInfo;
+typedef void (*VOID_FUNCTION_PUINT8_PFILE_POINTER)(uint8_t *, File *);
+
/**
* \brief Utility container for gathering the various forms the pixel data
* migth take during the user demanded processes.
+ * WARNING : *none* of these functions may be invoked by gdm user
+ * (internal use only)
*/
class GDCM_EXPORT PixelReadConvert : public Base
{
bool BuildRGBImage();
void BuildLUTRGBA();
+ void SetUserFunction( VOID_FUNCTION_PUINT8_PFILE_POINTER userFunc )
+ { UserFunction = userFunc; }
private:
// Use the fp:
void ReadAndDecompress12BitsTo16Bits( std::ifstream *fp )
int BitsStored;
int HighBitPosition;
int SamplesPerPixel;
- int PixelSize;
+ //int PixelSize; // useless
bool PixelSign;
int SwapCode;
uint8_t *LutRedData;
uint8_t *LutGreenData;
uint8_t *LutBlueData;
+
+ File *FileInternal; // must be passed to User Function
+ VOID_FUNCTION_PUINT8_PFILE_POINTER UserFunction;
};
} // end namespace gdcm