throw gdcmFileError("gdcmDocument::gdcmDocument(const char *, bool)");
else
{
+ std::cout <<"gdcmDocument::OpenFile cannot open file: "
+ << filename.c_str() << std::endl;
dbg.Verbose(0, "gdcmDocument::OpenFile cannot open file: ",
filename.c_str());
return (NULL);
//--------------------------------
//
- // FIXME
+ // FIXME :right now, both value and voidArea belong to gdcmValue
//
// -------------------------------
-
-/* // to go on compiling
- void *voidArea;
- voidArea = tag->GetVoidArea(); // to go on compiling
- if (voidArea != NULL)
- { // there is a 'non string' LUT, overlay, etc
- fwrite ( voidArea,(size_t)lgr ,(size_t)1 ,_fp); // Elem value
- return;
- }
-*/
+// if (gdcmBinEntry* BinEntry = dynamic_cast< gdcmBinEntry* >(tag) ) {
+ void *voidArea;
+ gdcmBinEntry *BinEntry= (gdcmBinEntry *)tag;;
+ voidArea = BinEntry->GetVoidArea();
+ if (voidArea != NULL)
+ { // there is a 'non string' LUT, overlay, etc
+ fwrite ( voidArea,(size_t)lgr ,(size_t)1 ,_fp); // Elem value
+ return;
+ }
+// }
+
if (vr == "US" || vr == "SS")
{
// some 'Short integer' fields may be mulivaluated
bool gdcmDocument::WriteEntry(gdcmDocEntry *tag, FILE *_fp,FileType type)
{
- guint32 length = tag->GetLength();
- gdcmValEntry * Vtag = (gdcmValEntry *) tag;
-std::cout << "gdcmDocument::WriteEntry Vtag->GetValue() " << Vtag->GetValue() << std::endl;
+ guint32 length = tag->GetLength();
+
+ if (gdcmValEntry* ValEntry = dynamic_cast< gdcmValEntry* >(tag) ) {
// The value of a tag MUST (see the DICOM norm) be an odd number of
- // bytes. When this is not the case, pad with an additional byte:
- if(length%2==1)
- {
- Vtag->SetValue(Vtag->GetValue()+"\0");
- Vtag->SetLength(Vtag->GetReadLength()+1);
- }
+ // bytes. When this is not the case, pad with an additional byte:
+ if(length%2==1) {
+ ValEntry->SetValue(ValEntry->GetValue()+"\0");
+ ValEntry->SetLength(ValEntry->GetReadLength()+1);
+ }
- WriteEntryTagVRLength(Vtag, _fp, type);
+ WriteEntryTagVRLength(ValEntry, _fp, type);
std::cout << "after WriteEntryTagVRLength " << std::endl;
- WriteEntryValue(Vtag, _fp, type);
+ WriteEntryValue(ValEntry, _fp, type);
std::cout << "after WriteEntryValue " << std::endl;
- return true;
+ return true;
+ }
+
+ if (gdcmBinEntry* BinEntry = dynamic_cast< gdcmBinEntry* >(tag) ) {
+ //
+ // FIXME : when voidArea belong to gdcmBinEntry only, fix voidArea length
+ //
+ // The value of a tag MUST (see the DICOM norm) be an odd number of
+ // bytes. When this is not the case, pad with an additional byte:
+ /*
+ if(length%2==1) {
+ Vtag->SetValue(Vtag->GetValue()+"\0");
+ Vtag->SetLength(Vtag->GetReadLength()+1);
+ }
+*/
+
+ WriteEntryTagVRLength(tag, _fp, type);
+ std::cout << "after WriteEntryTagVRLength " << std::endl;
+ WriteEntryValue(tag, _fp, type);
+ std::cout << "after WriteEntryValue " << std::endl;
+ return true;
+ }
}
/**
// Ignore the "shadow" groups
continue;
if ((*tag2).second->GetVR() == "SQ" ) // ignore Sequences
- continue;
- //if ((*tag2).second->GetDepthLevel() != 0) // Not only ignore the SQ element
- // continue;
+ continue;
}
if (! WriteEntry((*tag2).second,_fp,type) ) {
std::cout << "Write Failure " << std::endl;
*/
void * gdcmFile::GetImageData (void) {
PixelData = new char[lgrTotale];
- if (PixelData)
+ if (PixelData) {
GetImageDataIntoVector(PixelData, lgrTotale);
-
+ GetHeader()->SetEntryVoidAreaByNumber(PixelData,
+ GetHeader()->GetGrPixel(),
+ GetHeader()->GetNumPixel());
+ }
PixelRead=0; // no PixelRaw
+
return(PixelData);
}
/// Create a member lgrTotaleRaw ???
lgrTotale /= 3;
PixelData = new char[lgrTotale];
- if (PixelData)
+
+ if (PixelData) {
GetImageDataIntoVectorRaw(PixelData, lgrTotale);
+ GetHeader()->SetEntryVoidAreaByNumber(PixelData,
+ GetHeader()->GetGrPixel(),
+ GetHeader()->GetNumPixel());
+ }
PixelRead=1; // PixelRaw
return(PixelData);
}