Program: gdcm
Module: $RCSfile: gdcmFile.cxx,v $
Language: C++
- Date: $Date: 2004/11/16 05:03:35 $
- Version: $Revision: 1.156 $
+ Date: $Date: 2004/11/16 16:20:23 $
+ Version: $Revision: 1.157 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmFile.h"
#include "gdcmDebug.h"
#include "gdcmUtil.h"
+#include "gdcmBinEntry.h"
#include <fstream>
namespace gdcm
ImageDataSize = ImageDataSizeRaw;
}
- PixelConverter = new PixelConvert; //LEAK !
+ PixelConverter = new PixelConvert;
PixelConverter->GrabInformationsFromHeader( HeaderInternal );
}
SaveInitialValues();
InitialRedLUTData = 0;
InitialGreenLUTData = 0;
InitialBlueLUTData = 0;
-
+
if ( HeaderInternal->IsReadable() )
{
// the following values *may* be modified
*/
void File::DeleteInitialValues()
{
-
// InitialLutDescriptors and InitialLutData
// will have to be deleted if the don't belong any longer
// to the Header H table when the header is deleted...
- if ( InitialRedLUTDescr )
+// FIXME
+// We don't know if the InitialLutData are still in the header or not !
+/* if ( InitialRedLUTDescr )
delete InitialRedLUTDescr;
if ( InitialGreenLUTDescr )
delete InitialGreenLUTDescr;
- if ( InitialBlueLUTDescr )
- delete InitialBlueLUTDescr;
+ if ( InitialBlueLUTDescr )
+ delete InitialBlueLUTDescr;
- if ( InitialRedLUTData )
+ if ( InitialRedLUTData )
delete InitialRedLUTData;
- if ( InitialGreenLUTData != NULL)
+ if ( InitialGreenLUTData )
delete InitialGreenLUTData;
- if ( InitialBlueLUTData != NULL)
- delete InitialBlueLUTData;
+ if ( InitialBlueLUTData )
+ delete InitialBlueLUTData;*/
}
//-----------------------------------------------------------------------------
}
// We say the value *is* loaded.
- GetHeader()->SetEntryByNumber( GDCM_BINLOADED,
- GetHeader()->GetGrPixel(), GetHeader()->GetNumPixel());
-
- // Will be 7fe0, 0010 in standard case
- GetHeader()->SetEntryBinAreaByNumber( pixelData,
- GetHeader()->GetGrPixel(), GetHeader()->GetNumPixel());
+ SetPixelData(pixelData);
// END PIXELCONVERT CLEANME
return pixelData;
"than caller's expected MaxSize");
return 0;
}
- memmove( destination,
- (void*)PixelConverter->GetRGB(),
- PixelConverter->GetRGBSize() );
+ memcpy( destination,
+ (void*)PixelConverter->GetRGB(),
+ PixelConverter->GetRGBSize() );
return PixelConverter->GetRGBSize();
}
"than caller's expected MaxSize");
return 0;
}
- memmove( destination,
- (void*)PixelConverter->GetDecompressed(),
- PixelConverter->GetDecompressedSize() );
+ memcpy( destination,
+ (void*)PixelConverter->GetDecompressed(),
+ PixelConverter->GetDecompressedSize() );
return PixelConverter->GetDecompressedSize();
}
}
// We say the value *is* loaded.
- GetHeader()->SetEntryByNumber( GDCM_BINLOADED,
+/* GetHeader()->SetEntryByNumber( GDCM_BINLOADED,
GetHeader()->GetGrPixel(), GetHeader()->GetNumPixel());
// will be 7fe0, 0010 in standard cases
GetHeader()->SetEntryBinAreaByNumber( decompressed,
- GetHeader()->GetGrPixel(), GetHeader()->GetNumPixel());
+ GetHeader()->GetGrPixel(), GetHeader()->GetNumPixel());*/
+ SetPixelData(decompressed);
PixelRead = 1; // PixelRaw
// END PIXELCONVERT CLEANME
return PixelConverter->GetLutRGBA();
}
+//-----------------------------------------------------------------------------
+// Private
+void File::SetPixelData(uint8_t* data)
+{
+ GetHeader()->SetEntryByNumber( GDCM_BINLOADED,
+ GetHeader()->GetGrPixel(), GetHeader()->GetNumPixel());
+
+ // Will be 7fe0, 0010 in standard case
+ DocEntry* currentEntry = GetHeader()->GetDocEntryByNumber(GetHeader()->GetGrPixel(), GetHeader()->GetNumPixel());
+ if ( currentEntry )
+ {
+ if ( BinEntry* binEntry = dynamic_cast<BinEntry *>(currentEntry) )
+ // Flag is to false because datas are kept in the gdcmPixelConvert
+ binEntry->SetBinArea( data, false );
+ }
+}
+
+//-----------------------------------------------------------------------------
} // end namespace gdcm