Program: gdcm
Module: $RCSfile: gdcmFile.cxx,v $
Language: C++
- Date: $Date: 2004/07/02 13:55:28 $
- Version: $Revision: 1.115 $
+ Date: $Date: 2004/08/26 15:29:53 $
+ Version: $Revision: 1.121 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
typedef std::pair<TagDocEntryHT::iterator,TagDocEntryHT::iterator> IterHT;
-//-----------------------------------------------------------------------------
+//-------------------------------------------------------------------------
// Constructor / Destructor
/**
* \ingroup gdcmFile
* one sets an a posteriori shadow dictionary (efficiency can be
* seen as a side effect).
* @param filename file to be opened for parsing
- * @param exception_on_error whether we throw an exception or not
- * @param enable_sequences = true to allow the header
- * to be parsed *inside* the SeQuences,
- * when they have an actual length
- * \warning enable_sequences *has to be* true for reading PAPYRUS 3.0 files
- * @param ignore_shadow to allow skipping the shadow elements,
- * to save memory space.
- * \warning The TRUE value for this param has to be used
- * with a FALSE value for the 'enable_sequence' param.
- * ('public elements' may be embedded in 'shadow Sequences')
*/
-gdcmFile::gdcmFile(std::string const & filename,
- bool exception_on_error,
- bool enable_sequences,
- bool ignore_shadow)
+gdcmFile::gdcmFile(std::string const & filename )
{
- Header = new gdcmHeader( filename,
- exception_on_error,
- enable_sequences,
- ignore_shadow );
+ Header = new gdcmHeader( filename );
SelfHeader = true;
PixelRead = -1; // no ImageData read yet.
std::string str_PhotometricInterpretation =
Header->GetEntryByNumber(0x0028,0x0004);
- /*if ( str_PhotometricInterpretation == "PALETTE COLOR " )*/
+ // if ( str_PhotometricInterpretation == "PALETTE COLOR " )
// pb when undealt Segmented Palette Color
if ( Header->HasLUT() )
// from Lut R + Lut G + Lut B
uint8_t *newDest = new uint8_t[ImageDataSize];
uint8_t *a = (uint8_t *)destination;
- uint8_t *lutRGBA = Header->GetLUTRGBA();
+ uint8_t *lutRGBA = Header->GetLUTRGBA();
if ( lutRGBA )
{
std::string spp = "3"; // Samples Per Pixel
Header->SetEntryByNumber(spp,0x0028,0x0002);
- std::string rgb= "RGB "; // Photometric Interpretation
+ std::string rgb = "RGB "; // Photometric Interpretation
Header->SetEntryByNumber(rgb,0x0028,0x0004);
std::string planConfig = "0"; // Planar Configuration
Header->SetEntryByNumber(planConfig,0x0028,0x0006);
if ( Header->HasLUT() )
{
/// \todo Let gdcmHeader user a chance to get the right value
- // ImageDataSize /= 3; //dangerous
imgDataSize = ImageDataSizeRaw;
}
bool gdcmFile::WriteRawData(std::string const & fileName)
{
- FILE *fp1;
- fp1 = fopen(fileName.c_str(), "wb");
+ FILE *fp1 = fopen(fileName.c_str(), "wb");
if (fp1 == NULL)
{
printf("Fail to open (write) file [%s] \n", fileName.c_str());
return false;
}
- fwrite (PixelData,ImageDataSize, 1, fp1);
+ fwrite (PixelData, ImageDataSize, 1, fp1);
fclose (fp1);
return true;
*/
bool gdcmFile::WriteBase (std::string const & fileName, FileType type)
{
- FILE *fp1;
-
if ( PixelRead == -1 && type != gdcmExplicitVR)
{
return false;
}
- fp1 = fopen(fileName.c_str(), "wb");
+ FILE *fp1 = fopen(fileName.c_str(), "wb");
if (fp1 == NULL)
{
printf("Failed to open (write) File [%s] \n", fileName.c_str());
uint16_t grPixel = Header->GetGrPixel();
uint16_t numPixel = Header->GetNumPixel();;
- gdcmDocEntry* PixelElement;
-
- PixelElement = GetHeader()->GetDocEntryByNumber(grPixel, numPixel);
+ gdcmDocEntry* PixelElement =
+ GetHeader()->GetDocEntryByNumber(grPixel, numPixel);
if ( PixelRead == 1 )
{
case 4321:
for(i=0; i < lgr/2; i++)
{
- im16[i]= (im16[i] >> 8) | (im16[i] << 8 );
+ im16[i]= (im16[i] >> 8) | (im16[i] << 8 );
}
break;
default:
// ---------------------- Run Length Encoding
if ( Header->IsRLELossLessTransferSyntax() )
{
- bool res = (bool)gdcm_read_RLE_file (fp,destination);
+ bool res = gdcm_read_RLE_file (fp,destination);
Header->CloseFile();
return res;
}
if ( jpg2000 )
{
// JPEG 2000 : call to ???
- res = (bool)gdcm_read_JPEG2000_file (fp,destination); // Not Yet written
+ res = gdcm_read_JPEG2000_file (fp,destination); // Not Yet written
// ------------------------------------- endif (JPEG2000)
}
else if (jpgLossless)
if ( Header->GetBitsStored() == 8)
{
// Reading Fragment pixels
- res = (bool)gdcm_read_JPEG_file (fp,destination);
+ res = gdcm_read_JPEG_file (fp,destination);
}
else
{
// Reading Fragment pixels
- res = (bool)gdcm_read_JPEG_file12 (fp,destination);
+ res = gdcm_read_JPEG_file12 (fp,destination);
}
// ------------------------------------- endif (JPEGLossy)
}