gdcmRLE.cxx \
gdcmParsePixels.cxx \
gdcmDICOMDIR.cxx \
+ gdcmObject.cxx \
gdcmPatient.cxx \
gdcmStudy.cxx \
gdcmSerie.cxx \
}
//Based on Image Number
+
bool gdcmSerieHeaderHelper::ImageNumberOrdering()
{
int min, max, pos;
partition[pos - min]++;
}
- unsigned char mult;
+ unsigned char mult = 1;
for(int i=0; i<n ; i++)
{
mult *= partition[i];
std::string GetInstanceUID();
/**
- * change GetXImagePosition -> GetXOrigin in order not to confused reader
+ * change GetXImagePosition -> GetXOrigin in order not to confuse reader
* -# GetXOrigin can return default value (=0) if it was not ImagePosition
* -# Image Position is different in dicomV3 <> ACR NEMA -> better use generic
* name
}
-
-
-std::string gdcmImage::GetEntryByNumber(guint16 group, guint16 element) {
- return "";
-}
-
-
-std::string gdcmImage::GetEntryByName(TagName name) {
- return "";
-}
-
gdcmImage();
~gdcmImage();
- std::string GetEntryByNumber(guint16 group, guint16 element);
- std::string GetEntryByName(TagName name);
-
-
};
//-----------------------------------------------------------------------------
#include <string>
#include <list>
#include "gdcmCommon.h"
-
+#include "gdcmHeaderEntry.h"
+#include "gdcmParser.h"
//-----------------------------------------------------------------------------
-
-typedef std::list<std::string> lstring;
+class gdcmObject;
+typedef std::list<gdcmObject *> ListContent;
//-----------------------------------------------------------------------------
-
class gdcmObject {
public:
+ std::string GetEntryByNumber(guint16 group, guint16 element);
+ std::string GetEntryByName(TagName name);
- virtual std::string GetEntryByNumber(guint16 group, guint16 element)=0;
- virtual std::string GetEntryByName(TagName name)=0;
-
+ ListTag::iterator beginObj;
+ ListTag::iterator endObj;
+
protected:
-
- //to modify (I don't know the list type) : both iterators (beginning and end)
- lstring::iterator beginIter;
- lstring::iterator endIter;
-
- //pointer to the data list
- lstring *objectData;
-
};
//-----------------------------------------------------------------------------
if ( !OpenFile(exception_on_error))
return;
+
Parse();
LoadHeaderEntries();
+
CloseFile();
wasUpdated = 0; // will be set to 1 if user adds an entry
- printLevel = 1; // 'Heavy' header print by default
+ printLevel = 1; // 'Medium' header print by default
}
/**
*/
gdcmParser::gdcmParser(bool exception_on_error)
{
- enableSequences=0;
+ //enableSequences=0;
SetMaxSizeLoadEntry(MAX_SIZE_LOAD_ELEMENT_VALUE);
Initialise();
{
std::ostringstream s;
- s << "------------ using listEntries ----------------" << std::endl;
+ s << "------------ gdcmParser::Print, using listEntries ----------------" << std::endl;
for (ListTag::iterator i = listEntries.begin();
i != listEntries.end();
++i)
/**
* \ingroup gdcmParser
- * \brief Prints The Dict Entries of THE shadow Dicom Dictionnry
+ * \brief Prints The Dict Entries of the current shadow Dicom Dictionnry
* @return
*/
void gdcmParser::PrintShaDict(std::ostream & os)
// Public
/**
* \ingroup gdcmParser
- * \brief Get the public dictionary used
+ * \brief Get THE public dictionary used
*/
gdcmDict *gdcmParser::GetPubDict(void)
{
/**
* \ingroup gdcmParser
- * \brief Get the shadow dictionary used
+ * \brief Get the current shadow dictionary
*/
gdcmDict *gdcmParser::GetShaDict(void)
{
* \brief Set the shadow dictionary used
* \param dictName name of the dictionary to use in shadow
*/
-bool gdcmParser::SetShaDict(DictKey dictName)
-{
+bool gdcmParser::SetShaDict(DictKey dictName) {
RefShaDict=gdcmGlobal::GetDicts()->GetDict(dictName);
return(!RefShaDict);
}
bool gdcmParser::IsReadable(void)
{
std::string res = GetEntryByNumber(0x0028, 0x0005);
- if ( res != GDCM_UNFOUND && atoi(res.c_str()) > 4 )
- {
+ if ( res != GDCM_UNFOUND && atoi(res.c_str()) > 4 ) {
+ //std::cout << "error on : 28 5" << std::endl;
return false; // Image Dimensions
}
- if ( !GetHeaderEntryByNumber(0x0028, 0x0100) )
+ if ( !GetHeaderEntryByNumber(0x0028, 0x0100) ) {
+ //std::cout << "error on : 28 100" << std::endl;
return false; // "Bits Allocated"
- if ( !GetHeaderEntryByNumber(0x0028, 0x0101) )
+ }
+ if ( !GetHeaderEntryByNumber(0x0028, 0x0101) ){
+ // std::cout << "error on : 28 101" << std::endl;
return false; // "Bits Stored"
- if ( !GetHeaderEntryByNumber(0x0028, 0x0102) )
+ }
+ if ( !GetHeaderEntryByNumber(0x0028, 0x0102) ) {
+ //std::cout << "error on : 28 102" << std::endl;
return false; // "High Bit"
- if ( !GetHeaderEntryByNumber(0x0028, 0x0103) )
+ }
+ if ( !GetHeaderEntryByNumber(0x0028, 0x0103) ) {
+ //std::cout << "error on : 28 103" << std::endl;
return false; // "Pixel Representation"
+ }
return true;
}
*
* @return True when ImplicitVRLittleEndian found. False in all other cases.
*/
-bool gdcmParser::IsImplicitVRLittleEndianTransferSyntax(void)
-{
+bool gdcmParser::IsImplicitVRLittleEndianTransferSyntax(void) {
gdcmHeaderEntry *Element = GetHeaderEntryByNumber(0x0002, 0x0010);
if ( !Element )
return false;
* \brief Searches within Header Entries (Dicom Elements) parsed with
* the public and private dictionaries
* for the element value of a given tag.
- * \warning Don't use any longer : use GetPubEntryByName
* @param tagName name of the searched element.
* @return Corresponding element value when it exists,
* and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise.
/**
* \ingroup gdcmParser
* \brief Request a new virtual dict entry to the dict set
- * @param group group of the underlying DictEntry
- * @param elem element of the underlying DictEntry
- * @param vr VR of the underlying DictEntry
- * @param fourth owner group
- * @param name english name
+ * @param group group of the underlying DictEntry
+ * @param element element of the underlying DictEntry
+ * @param vr VR of the underlying DictEntry
+ * @param fourth owner group
+ * @param name english name
*/
gdcmDictEntry *gdcmParser::NewVirtualDictEntry(guint16 group, guint16 element,
std::string vr,
static const unsigned int HEADER_LENGTH_TO_READ;
static const unsigned int MAX_SIZE_LOAD_ELEMENT_VALUE;
-
+protected:
+ int enableSequences;
private:
// Read
void Parse(bool exception_on_error = false) throw(gdcmFormatError);
TagHeaderEntryHT tagHT; // H Table (multimap), to provide fast access
ListTag listEntries; // chained list, to keep the 'spacial' ordering
- int enableSequences;
+
// true if a gdcmHeaderEntry was added post parsing
int wasUpdated;
gdcmPatient::~gdcmPatient() {
-
-}
-
-
-
-std::string gdcmPatient::GetEntryByNumber(guint16 group, guint16 element) {
- return "";
-}
-
-
-std::string gdcmPatient::GetEntryByName(TagName name) {
- return "";
+ lStudy::iterator cc = GetStudies().begin();
+ while (cc != GetStudies().end() ) {
+ delete *cc;
+ ++cc;
+ }
}
//-----------------------------------------------------------------------------
-typedef std::list<gdcmStudy> lStudy;
+typedef std::list<gdcmStudy *> lStudy;
//-----------------------------------------------------------------------------
gdcmPatient();
~gdcmPatient();
- std::string GetEntryByNumber(guint16 group, guint16 element);
- std::string GetEntryByName(TagName name);
-
- inline lStudy GetStudies() {return studies;};
-
+ inline lStudy &GetStudies() {return studies;};
+
+ lStudy studies;
private:
- lStudy studies;
};
gdcmSerie::~gdcmSerie() {
-
-}
-
-
-
-std::string gdcmSerie::GetEntryByNumber(guint16 group, guint16 element) {
- return "";
-}
-
-
-std::string gdcmSerie::GetEntryByName(TagName name) {
- return "";
+ lImage::iterator cc = GetImages().begin();
+ while (cc != GetImages().end() ) {
+ delete *cc;
+ ++cc;
+ }
}
//-----------------------------------------------------------------------------
-typedef std::list<gdcmImage> lImage;
+typedef std::list<gdcmImage *> lImage;
//-----------------------------------------------------------------------------
gdcmSerie();
~gdcmSerie();
- std::string GetEntryByNumber(guint16 group, guint16 element);
- std::string GetEntryByName(TagName name);
-
- inline lImage GetImages() {return images;};
-
+ inline lImage &GetImages() {return images;};
+
+ lImage images;
+
private:
- lImage images;
};
gdcmStudy::~gdcmStudy() {
-
-}
-
-
-
-std::string gdcmStudy::GetEntryByNumber(guint16 group, guint16 element) {
- return "";
+ lSerie::iterator cc = GetSeries().begin();
+ while (cc != GetSeries().end() ) {
+ delete *cc;
+ ++cc;
+ }
}
-
-
-std::string gdcmStudy::GetEntryByName(TagName name) {
- return "";
-}
-
//-----------------------------------------------------------------------------
-typedef std::list<gdcmSerie> lSerie;
+typedef std::list<gdcmSerie *> lSerie;
//-----------------------------------------------------------------------------
gdcmStudy();
~gdcmStudy();
- std::string GetEntryByNumber(guint16 group, guint16 element);
- std::string GetEntryByName(TagName name);
-
- inline lSerie GetSeries() {return series;};
-
+ inline lSerie &GetSeries() {return series;};
+
+ lSerie series;
+
private:
- lSerie series;
};
eatwhite(from);
from.getline(buff, 1024, ' ');
key = buff;
+ if(key.size()%2==1)
+ key.push_back(0);
+
eatwhite(from);
from.getline(buff, 1024, '\n');
name = buff;