Getting values from a sequence that has more than 1 entry

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
wrgben
Posts: 20
Joined: Thu, 2005-01-06, 10:53

Getting values from a sequence that has more than 1 entry

#1 Post by wrgben »

Hi Marco, Joerg, Thomas and the world,

I'm sure Im going to kick myself, but...

How do I find an item in a sequence when there is possibly more than one item of the same type in the sequence (e.g. the Referenced Series Instance UID(s) in a Presentation State's Referenced Series Sequence)?

Currently I'm using

seqCond = pRecord->findAndGetSequenceItem(DCM_ReferencedSeriesSequence,
refSeriesSeq,seriesItem++);
while (seqCond != EC_TagNotFound)
{

refSeriesSeq->findAndGetString(DCM_SeriesInstanceUID,tempString);

As I said, I'm sure I'll kick myself when it gets pointed out to me!

Cheerio!

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#2 Post by Jörg Riesmeier »

Hi Ben,

the following should work (not very efficient for a large number of items, though):

Code: Select all

DcmItem *item = NULL;
signed long itemNum = 0;
while (dataset->findAndGetSequenceItem(DCM_ReferencedSeriesSequence, item, itemNum++).good()) 
{
  if (item->findAndGetOFString(DCM_SeriesInstanceUID, tmpString).good())
    cout << "#" << itemNum << ": " << tmpString << endl;
  else
    cout << "#" << itemNum << ": no SeriesInstanceUID" << endl;
}
Btw, there is code in module "dcmpstat" that reads GSPS objects (incl. the ReferencedSeriesSequence).

wrgben
Posts: 20
Joined: Thu, 2005-01-06, 10:53

#3 Post by wrgben »

Thanks for the help Joerg, I had something like this but there was a little hole in my logic somwhere else :-)

On a different topic, I have been hacking dcmpstat.lib to use it for rendering print jobs, and for some reason my GSPS annotations (lines, boxes etc.) are not being rendered. My code looks something like this (it looks suspiciously like dcmpsprt :-):

DcmFileFormat * psfile = new DcmFileFormat;

psfile->loadFile("C:\\Program Files\\DICOMscope351\\database\\PSg_4222fffaffb2e76d.dcm");
DcmDataset * psdataset = psfile->getDataset();

DVInterface * dvi = new DVInterface;
dvi->getPrintHandler().setImageDisplayFormat(1,1);
dvi->getPrintHandler().setFilmSizeID("14INX17IN");
dvi->getPrintHandler().setMagnificationType("CUBIC");
dvi->getPrintHandler().setResolutionID("HIGH");
dvi->getPrintHandler().setFilmOrientation(DVPSF_landscape);
dvi->setPrinterNumberOfCopies(1);
dvi->setPrinterMediumType("BLUE FILM");
dvi->setPrinterFilmDestination("PROCESSOR");

dvi->loadPState(psdataset,"C:\\Program Files\\DICOMscope351\\database\\DX_4222f6487b9efce1.dcm");
unsigned long bitmapSize = dvi->getCurrentPState().getPrintBitmapSize();
void * pixelData = new char[bitmapSize];
unsigned long width=0, height=0;
dvi->getCurrentPState().getPrintBitmapWidthHeight(width,height);
dvi->getCurrentPState().getPrintBitmap(pixelData, bitmapSize, false);
double pixelAspectRatio = dvi->getCurrentPState().getPrintBitmapPixelAspectRatio();
OFCondition result = dvi->saveHardcopyGrayscaleImage("HCTEMP.dcm",pixelData, width, height, pixelAspectRatio);

It works fine in DicomScope (of course)...am I missing something really obvious?

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#4 Post by Jörg Riesmeier »

In fact, some aspects of the GSPS object (e.g. the graphical annotations) are rendered by the Java and not by the C++ code of DICOMscope. This is because we found it much easier to render graphical and textual annotations using the JDK.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 1 guest