-
Gert Wollny authored3786bfcf
antodc.cc 73.26 KiB
static const char *CopyrightIdentifier(void) { return "@(#)antodc.cc Copyright (c) 1993-2018, David A. Clunie DBA PixelMed Publishing. All rights reserved."; }
#if USESTANDARDHEADERSWITHOUTEXTENSION == 1
#include <cctype>
#else
#include <ctype.h>
#endif
#if EMITUSINGSTDNAMESPACE == 1
using namespace std;
#endif
#include "attrmxls.h"
#include "attrtype.h"
#include "attrval.h"
#include "elmconst.h"
#include "mesgtext.h"
#include "dcopt.h"
static bool
isPrivateCreatorPresent(AttributeList &list,Uint16 group,Uint16 element,const char *creator)
{
//cerr << "isPrivateCreatorPresent: (" << hex << group << "," << element << dec << ") want <" << creator << ">" << endl;
bool same=false;
Assert(creator
&& strlen(creator) > 0
&& creator[strlen(creator)-1] != ' '); // no trailing blanks
//cerr << "isPrivateCreatorPresent: looking for attribute" << endl;
Attribute *a=list[Tag(group,element)];
char *value=0;
//cerr << "isPrivateCreatorPresent: checking attribute" << endl;
if (a && a->isString() && a->getValue(0,value) && value) {
//cerr << "isPrivateCreatorPresent: found value <" << value << ">" << endl;
char *p = value+strlen(value);
while (p-- > value && *p == ' ') *p=0; // remove trailing spaces
//cerr << "isPrivateCreatorPresent: checking against <" << value << ">" << endl;
if (strcmp(value,creator) == 0) {
//cerr << "isPrivateCreatorPresent: same" << endl;
same=true;
}
}
//cerr << "isPrivateCreatorPresent: done" << endl;
if (value) delete[] value;
//cerr << "isPrivateCreatorPresent: result " << (same ? "T" : "F") << endl;
return same;
}
static Attribute *
findPrivateAttribute(AttributeList &list,Uint16 group,const char *creatorID,Uint16 element) {
Attribute *a=NULL;
int tryBlock;
for (tryBlock=0; tryBlock < 0x0100; ++tryBlock) {
if (isPrivateCreatorPresent(list,group,tryBlock,creatorID)) {
//cerr << "findPrivateAttribute: found " << creatorID << " " << hex << group << "," << ((tryBlock<<8)|(element&0x00ff)) << dec << endl;
a=list[Tag(group,(tryBlock<<8)|(element&0x00ff))];
break;
}
}
return a;
}
static void
AcrNEMA_FixImagePlaneModule(ManagedAttributeList &list)
{
//cerr << "AcrNEMA_FixImagePlaneModule:" << endl;
//cerr << "AcrNEMA_FixImagePlaneModule: SliceLocation" << endl;