Mercurial > forge
changeset 9170:a5c02244c5d2 octave-forge
revert accidental removal of Kris work. I hope its right now. sorry
author | blondandy |
---|---|
date | Sat, 10 Dec 2011 20:09:53 +0000 |
parents | d382b1f9a2f6 |
children | 05f631eaefe6 |
files | extra/dicom/src/dicominfo.cpp |
diffstat | 1 files changed, 28 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/extra/dicom/src/dicominfo.cpp Sat Dec 10 19:55:26 2011 +0000 +++ b/extra/dicom/src/dicominfo.cpp Sat Dec 10 20:09:53 2011 +0000 @@ -308,13 +308,14 @@ //static const gdcm::Global& g = gdcm::Global::GetInstance(); //static const gdcm::Dicts &dicts = g.GetDicts(); const gdcm::Tag tag = elem->GetTag(); - const gdcm::VR vr = elem->GetVR(); // value representation + gdcm::VR vr = elem->GetVR(); // value representation // skip "Group Length" tags. note: these are deprecated in DICOM 2008 if(tag.GetElement() == (uint16_t)0 || (elem->GetByteValue() == NULL && vr != gdcm::VR::SQ)) return DICOM_NOTHING_ASSIGNED; //const gdcm::DictEntry dictEntry = dicts.GetDictEntry(tag,(const char*)0); + // find dictionary entry for name and to possibly adjust the VR gdcm::DictEntry dictEntry ; if (!is_present(tag)) { char fallbackVarname[64]; @@ -328,9 +329,34 @@ if (!vr.Compatible(vr)) { warning(QUOTED(OCT_FN_NAME)": %s has different VR from dictionary. Using VR from file.", varname.c_str()); } + // find vr from dictionary if it was not in the file + // lines copied from gdcmPrinter::PrintDataElement + if( vr == gdcm::VR::INVALID ) + { + vr = dictvr; + } + else if ( vr == gdcm::VR::UN && vr != gdcm::VR::INVALID ) // File is explicit, but still prefer vr from dict when UN + { + vr = dictvr; + } + else // cool the file is Explicit ! + { + // keep vr from file + } +#if 0 + // gdcmPrinter goes on with the following fix for the + // case where the VR derived from the dictionary is 'dual' (e.g. US_SS). + // However, we cannot do it here as we don't have + // the FILE* F nor the dataset. + // This means that these fields will not be assigned. + if( vr.IsDual() ) // This means vr was read from a dict entry: + { + vr = DataSetHelper::ComputeVR(*F,ds, tag); + } +#endif } - + //int tagVarNameBufLen=127; //char *keyword=(char *)malloc((tagVarNameBufLen+1)*sizeof(char)); //keyword=name2Keyword(keyword,&tagVarNameBufLen,tagName);