2005-01-28 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
- * src/gdcmFile.cxx, gdcmDocument.cxx : fix the bug on the group|element
+ * Remove friend classes between DocEntry and File
+
+2005-01-28 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
+ * src/gdcmFile.cxx, gdcmDocument.cxx : fix the bug on the group|element
0002|0000. The value was incorrect.
2005-01-28 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
Program: gdcm
Module: $RCSfile: gdcmBinEntry.cxx,v $
Language: C++
- Date: $Date: 2005/01/25 15:21:20 $
- Version: $Revision: 1.57 $
+ Date: $Date: 2005/01/28 15:10:56 $
+ Version: $Revision: 1.58 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
os << s.str();
}
+//-----------------------------------------------------------------------------
+// Public
/*
* \brief canonical Writer
* @param fp already open file pointer
fp->seekp(lgr, std::ios::cur);
}
}
-//-----------------------------------------------------------------------------
-// Public
-
-/// \brief Sets the value (non string) of the current Dicom Header Entry
+/**
+ * \brief Sets the value (non string) of the current Dicom Header Entry
+ */
void BinEntry::SetBinArea( uint8_t *area, bool self )
{
if (BinArea && SelfArea)
Program: gdcm
Module: $RCSfile: gdcmBinEntry.h,v $
Language: C++
- Date: $Date: 2005/01/25 15:21:20 $
- Version: $Revision: 1.33 $
+ Date: $Date: 2005/01/28 15:10:56 $
+ Version: $Revision: 1.34 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
uint8_t *GetBinArea() { return BinArea; }
void SetBinArea( uint8_t *area, bool self = true );
+ void SetSelfArea(bool area) { SelfArea = area; };
+ bool IsSelfArea() { return SelfArea; };
private:
/// \brief memory area to hold 'non std::string' representable values
Program: gdcm
Module: $RCSfile: gdcmContentEntry.cxx,v $
Language: C++
- Date: $Date: 2005/01/26 15:03:32 $
- Version: $Revision: 1.6 $
+ Date: $Date: 2005/01/28 15:10:56 $
+ Version: $Revision: 1.7 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
//-----------------------------------------------------------------------------
// Constructor / Destructor
-
-
-//-----------------------------------------------------------------------------
-// Public
-
-//-----------------------------------------------------------------------------
-// Protected
/**
* \brief Constructor for a given DictEntry
* @param e Pointer to existing dictionary entry
ContentEntry::~ContentEntry ()
{
}
+
+//-----------------------------------------------------------------------------
+// Public
+void ContentEntry::Copy(DocEntry *doc)
+{
+ DocEntry::Copy(doc);
+
+ ContentEntry *entry = dynamic_cast<ContentEntry *>(doc);
+ if(entry)
+ Value = entry->Value;
+}
+
+//-----------------------------------------------------------------------------
+// Protected
+
//-----------------------------------------------------------------------------
// Private
Program: gdcm
Module: $RCSfile: gdcmContentEntry.h,v $
Language: C++
- Date: $Date: 2005/01/25 16:32:45 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2005/01/28 15:10:56 $
+ Version: $Revision: 1.3 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
/// into a 'string', event if it's physically stored on disk as an integer
std::string const &GetValue() const { return Value; };
+ void Copy(DocEntry *doc);
+
protected:
// Contructors are protected, not to be invoked by end user.
ContentEntry(DictEntry *e);
Program: gdcm
Module: $RCSfile: gdcmDocEntry.cxx,v $
Language: C++
- Date: $Date: 2005/01/26 09:49:53 $
- Version: $Revision: 1.47 $
+ Date: $Date: 2005/01/28 15:10:56 $
+ Version: $Revision: 1.48 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
namespace gdcm
{
-
-// CLEAN ME
#define MAX_SIZE_PRINT_ELEMENT_VALUE 64
//-----------------------------------------------------------------------------
os << s.str();
}
+//-----------------------------------------------------------------------------
+// Public
/**
* \brief Writes the common part of any ValEntry, BinEntry, SeqEntry
* @param fp already open ofstream pointer
}
}
-//-----------------------------------------------------------------------------
-// Public
-
/**
* \brief Gets the full length of the elementary DocEntry (not only value
* length) depending on the VR.
//-----------------------------------------------------------------------------
// Protected
-
//-----------------------------------------------------------------------------
// Private
//-----------------------------------------------------------------------------
-
} // end namespace gdcm
Program: gdcm
Module: $RCSfile: gdcmDocEntry.h,v $
Language: C++
- Date: $Date: 2005/01/26 11:42:02 $
- Version: $Revision: 1.41 $
+ Date: $Date: 2005/01/28 15:10:56 $
+ Version: $Revision: 1.42 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
uint32_t GetFullLength();
- void Copy(DocEntry *doc);
+ virtual void Copy(DocEntry *doc);
bool IsItemDelimitor();
bool IsSequenceDelimitor();
virtual void Print (std::ostream &os = std::cout, std::string const & indent = "");
protected:
- /// \brief Sets the DicEntry of the current Dicom entry
- /// \remarks Used only by the gdcm::File !!! (possible because of a friend
- /// link between them)
- /// @param newEntry pointer to the DictEntry
- void SetDictEntry(DictEntry *newEntry) { DicomDict = newEntry; };
-
-// Variables
/// \brief pointer to the underlying Dicom dictionary element
DictEntry *DicomDict;
TagKey Key;
private:
- friend class File; // To use SetDictEntry
};
} // end namespace gdcm
//-----------------------------------------------------------------------------
Program: gdcm
Module: $RCSfile: gdcmFile.cxx,v $
Language: C++
- Date: $Date: 2005/01/28 10:34:28 $
- Version: $Revision: 1.204 $
+ Date: $Date: 2005/01/28 15:10:56 $
+ Version: $Revision: 1.205 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
ComputeJPEGFragmentInfo();
CloseFile();
- // Change the created dict entry
- std::string PixelVR;
- // 8 bits allocated is a 'O Bytes' , as well as 24 (old ACR-NEMA RGB)
- // more than 8 (i.e 12, 16) is a 'O Words'
- if ( GetBitsAllocated() == 8 || GetBitsAllocated() == 24 )
- PixelVR = "OB";
- else
- PixelVR = "OW";
+ // Create a new BinEntry to change the the DictEntry
+ // The changed DictEntry will have
+ // - a correct PixelVR OB or OW)
+ // - a VM to "PXL"
+ // - the name to "Pixel Data"
+ BinEntry *oldEntry = dynamic_cast<BinEntry *>(entry);
+ if(oldEntry)
+ {
+ std::string PixelVR;
+ // 8 bits allocated is a 'O Bytes' , as well as 24 (old ACR-NEMA RGB)
+ // more than 8 (i.e 12, 16) is a 'O Words'
+ if ( GetBitsAllocated() == 8 || GetBitsAllocated() == 24 )
+ PixelVR = "OB";
+ else
+ PixelVR = "OW";
+
+ // Change only made if usefull
+ if( PixelVR != oldEntry->GetVR() )
+ {
+ DictEntry* newDict = NewVirtualDictEntry(GrPixel,NumPixel,
+ PixelVR,"1","Pixel Data");
- DictEntry* newEntry = NewVirtualDictEntry(GrPixel, NumPixel,
- PixelVR, "PXL", "Pixel Data");
+ BinEntry *newEntry = new BinEntry(newDict);
+ newEntry->Copy(entry);
+ newEntry->SetBinArea(oldEntry->GetBinArea(),oldEntry->IsSelfArea());
+ oldEntry->SetSelfArea(false);
- // friend class hunting : should we *create* a new entry,
- // instead of modifying its DictEntry,in order not to use 'friend' ?
- entry->SetDictEntry( newEntry );
+ RemoveEntry(oldEntry);
+ AddEntry(newEntry);
+ }
+ }
}
}