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!
Getting values from a sequence that has more than 1 entry
Moderator: Moderator Team
-
- ICSMED DICOM Services
- Posts: 2217
- Joined: Fri, 2004-10-29, 21:38
- Location: Oldenburg, Germany
Hi Ben,
the following should work (not very efficient for a large number of items, though):
Btw, there is code in module "dcmpstat" that reads GSPS objects (incl. the ReferencedSeriesSequence).
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;
}
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?
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?
-
- ICSMED DICOM Services
- Posts: 2217
- Joined: Fri, 2004-10-29, 21:38
- Location: Oldenburg, Germany
Who is online
Users browsing this forum: Ahrefs [Bot] and 1 guest