Presentation State with annotations, from multiple DICOM

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Pramod
Posts: 27
Joined: Fri, 2007-09-07, 07:41

Presentation State with annotations, from multiple DICOM

#1 Post by Pramod »

Hi,

Is it possible to create a Presentation State File with standard annotations from multiple DICOM Images, using DCMTK?

I have gone through the documentation of dcmpsmk application and it doesn't provide the information about adding annotations on multiple images.

What I am trying to do here is, I have a study with three images, and I want to save annotations ( Line, Ellipse etc ) and other graphical respresentation to a Presentation State.

Please tell me, the required functions in DCMTK?

Also I would like to know, by using DCMTK, how can I save Presentation State file of a Multiframe Image which include Annotation on different frames.

Thanks!
Pramod

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 »

Is it possible to create a Presentation State File with standard annotations from multiple DICOM Images, using DCMTK?
Yes, of course, since the "dcmpstat" module is the result of an officially supported reference implementation.
I have gone through the documentation of dcmpsmk application and it doesn't provide the information about adding annotations on multiple images.
This is correct, "dcmpsmk" does not support this feature.
What I am trying to do here is, I have a study with three images, and I want to save annotations ( Line, Ellipse etc ) and other graphical respresentation to a Presentation State. Please tell me, the required functions in DCMTK?
See DcmPresentationState::addImageReference().
Also I would like to know, by using DCMTK, how can I save Presentation State file of a Multiframe Image which include Annotation on different frames.
Some aspects of a GSPS object apply to all frames of the referenced images (or to be more precise, to the referenced frames of the referenced images). For other aspects you can choose whether they apply to all referenced images/frames or only to some of them. See API documentation of class DcmPresentationState and DVPresentationState as well as the relevant parts of the DICOM standard for details.

Pramod
Posts: 27
Joined: Fri, 2007-09-07, 07:41

#3 Post by Pramod »

Thank you Jörg for the reply.

Now I can able to create Presentation State file with multiple DICOM images referenced. And also added multiple Graphic Object in Presentation State file .

But, the graphics objects, which I want to come under each of ReferencedSOPInstanceUID sequence are always coming under the first image's ReferencedSOPInstanceUID sequence.

Following is the way I am creating Presentation state file:
Please tell me where the problem is:

Code: Select all

DVPresentationState state;

OFCondition error = state.createFromImage(*datasetfirstImage, overlayActivation, voiActivation,
curveActivation, shutterActivation, presentationActivation, layering, opt_aetitle, 
  opt_filesetID, opt_filesetUID);
  
  
for(int i = 0; i< strDCMFilePathArray.GetSize(); i++)
{
	DcmFileFormat *ff = NULL;
	string strPath = DCMFilePathArray.GetAt(i);

	if (DVPSHelper::loadFileFormat(strPath, ff) == EC_Normal)
	{
		if (ff)
		{
			DcmDataset *dset = ff->getDataset();
			state.addImageReference(*dset);
			
			// Adding grpahic objects to Presentation state
			state.addGraphicLayer("MEASUREMENT", strLayer);
			size_t sz = state.getGraphicLayerIndex("MEASUREMENT");
			DVPSGraphicObject* psGraphics = state.addGraphicObject(sz);
			Float32 data[] = {100,100,250,250};
			psGraphics->setGraphicType(DVPST_polyline);
			psGraphics->setData(2, data, DVPSA_pixels);	
		}
	}
	delete ff;
}

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 »

You should probably separate the addition of the image references from the addition of the graphic layers / annotations.

Pramod
Posts: 27
Joined: Fri, 2007-09-07, 07:41

#5 Post by Pramod »

Thank you Jörg for the response.

As per your suggestion I separated the addition of Image references from the addition of graphic layers.
But still, the graphic objects are coming under the first Image Referance Sequence.

I made the following change in the code.
Please guide me to generate a correct result.

Code: Select all

for(int i = 0; i< nTotalImg; i++)
{
	DcmFileFormat *ff = dcFiles[i];
	if (ff)
	{ 
		DcmDataset *dset = ff->getDataset();
		state.addImageReference(*dset); 
	}
}



for(int i = 0; i< nTotalImg; i++)
{	
	DcmFileFormat *ff = dcFiles[i];
	if (ff)
	{ 
		DcmDataset *dset = ff->getDataset();
		
		state.attachImage(dset, OFFalse);
		// Adding grpahic objects to Presentation state
		state.addGraphicLayer("MEASUREMENT", strLayer);
		size_t sz = state.getGraphicLayerIndex("MEASUREMENT");
		DVPSGraphicObject* psGraphics = state.addGraphicObject(sz);
		Float32 data[] = {100,100,250,250};
		psGraphics->setGraphicType(DVPST_polyline);
		psGraphics->setData(2, data, DVPSA_pixels);
	}
}

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

#6 Post by Jörg Riesmeier »

I just wrote a little sample program that shows how it works in principle. Hope it helps ...

Pramod
Posts: 27
Joined: Fri, 2007-09-07, 07:41

#7 Post by Pramod »

Thank You very much for your response Jörg, I really appreciate it.

I made a little change in the sample program.
In adding graphic object, by default object applicability is for all images.
I changed that to current image.

Again, thank you for your time and your past responses...

Regards
Pramod

Post Reply

Who is online

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