Using DCMPRINT low level

Questions regarding the DCMPRINT library, a DCMTK add-on that implements a DICOM Print Management SCP and SCU

Moderator: Moderator Team

Post Reply
Message
Author
kubilay
Posts: 3
Joined: Fri, 2007-07-27, 20:40

Using DCMPRINT low level

#1 Post by kubilay »

Hi all,

I am developing DICOM viewer application with MS Visual Studio 2005.
I have evaluation lisence of DCMPRINT. The Documantation is too poor.(maybe reason evaluation lisence?) There is no documantation on DCMPRINT classes and their functions.

- Is there any way to print DcmFileFormat class or DicomImage class without save to x.dcm file on local drive. (For example rendered annotation and/or length measurements over orginal image. (to gain time) )

- Is there any way to print N-th frame from multiframe images using tcpprt.

Thank in advance.

Kubilay
Kubilay

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1437
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

#2 Post by Marco Eichelberg »

While the documentation certainly leaves much to be deserved, you can generate hypertext API documentation with doxygen, together with the DCMTK sources. I am writing this from memory, but in principle using the print client works as follows:
  • Create a DicomImage instance (using DCMTK's DicomImage class from module dcmimgle/dcmimage to manage the DICOM image you want to print. This class has methods to apply window level/width, VOI LUTs, etc.
  • Create an instance of class PSVDicomObject (declared in dcmtk/dcmprint/psvdic1.h) and use getDataset() to retrieve a pointer to the dataset managed by this object
  • write the frame you want to have printed into this dataset using DicomImage::writeFrameToDataset()
  • send the pixel data to the print server using PSVModelImageBox::downloadImageObject(), which takes a reference to the PSVDicomObject instance as a parameter
Of course this implies that the network connection has already been established, a basic film session and a basic film box been created.

kubilay
Posts: 3
Joined: Fri, 2007-07-27, 20:40

#3 Post by kubilay »

Hi Marco,

Thanks for answer.

Your descriptions very helpfull for me. But I am trying easyer way:

-I create new class in psvaoutoi.cxx (I dont want to chance psvauto.cxx):
class PSVAutoImageView : public PSVView
That is same as yours PSVAutomaticView class except OFList<OFString>& fileNames. I replace that with PSVDicomObject. Main chances below

private: System::Void button11_Click(System::Object^ sender, System::EventArgs^ e) {
const char *local_aetitle=NULL;
const char *printer_aetitle=NULL;
const char *printer_address=NULL;

WSAData winSockData;
WORD winSockVersionNeeded = MAKEWORD( 1, 1 );
WSAStartup(winSockVersionNeeded, &winSockData);

PSVDebug debug(LOGFILENAME,1);

const char *opt_automode = "1";
PSVDicomObject *ImageList;

const char *opt_cfgfile=CFGFILENAME;
ImageList = new PSVDicomObject("C:\\DICOM Images\\Demo\\VOLBRAIN.DCM", debug);

DIMSE_debug(OFFalse);
OFBool opt_verbose=Parameter->Verbose;
dcmConnectionTimeout.set(OFstatic_cast(Sint32, Parameter->ConnectionTimeout));

PSVDicomStringAE clientAE(debug);
PSVDicomStringAE serverAE(debug);

local_aetitle=Parameter->pLocalAETitle;
clientAE = local_aetitle;

printer_aetitle=Parameter->pServerAETitle;
serverAE=printer_aetitle;

STD_NAMESPACE ifstream cfgfile(opt_cfgfile);
if (!cfgfile) {
return;
}
PSVConfig config(cfgfile,debug);

PSVString autoDF(debug);
if (opt_automode)
autoDF = opt_automode;

long maxPDU = ASC_DEFAULTMAXPDU;
dcmEnableBackwardCompatibility.set(0x100); // enable DUL compatibility options
PSVNetwork network(0, 0, 30, OFFalse, OFFalse, debug, OFstatic_cast(DIC_UL, maxPDU));
if (! network.statusOK()) {
return;
}

PSVTCPIostreamClient tcpclient(config, clientAE, serverAE, OFFalse, Parameter->pTarget, debug);
tcpclient.startAssociationRequest(network);
if (tcpclient.associationEstablished()) {
PSVModelPrinter printer(tcpclient, debug);
PSVModelBasicFilmSession session(config, tcpclient, debug);
unsigned short status = session.initialize();
if (!STATUS_IS_SUCCESS(status)) {
return;
}
PSVAutoImageView autoview(session, autoDF, config, ImageList, debug);
autoview.execute(CERR);
// release association
tcpclient.releaseAssociation();
} else {
PSVAssociation *assoc = tcpclient.getAssociation();
if (assoc && assoc->associationEstablished())
assoc->abort();
return;
}
delete ImageList;
WSACleanup();
return;
}
(I will create PSVDicomObject from DicomImage as your suggestion later)
...
// find entry j+fileOffset
/* if (ImageList.size() <= (unsigned long)j+fileOffset) tmpstring = "";
else
{
first = ImageList.begin();
for (l = j+fileOffset; l; --l) ++first;
}
if (tmpstring.length() > 0)
{
out << AUTO_DOWNLOAD << tmpstring << OFendl;
*/
pconfig->save_cursor();

/////////////////////////////////////////////////////////////////////////////////

status = imageBox->downloadImageObject(*pconfig,*ImageList,"");
// status = imageBox->downloadImageFile(*pconfig, tmpstring.getpchar());

//////////////////////////////////////////////////////////////////////////////////


pconfig->restore_cursor();
if (status != 0)
out << AUTO_STATUS << imageBox->translateStatus(status) << OFendl;
else
{
pconfig->set_section(0, L0_FRAME);
if (pconfig->section_valid(0))
{
tmpstring = pconfig->get_key_value();
tmpstring.convertto(j);
k = imageBox->countNumberOfFrames();
if (k>1)
{
if (j>0) j-=1; else j=0;
if (j >= k) j=k-1;
out << AUTO_SETFRAME << j+1 << OFendl;
pconfig->save_cursor();
status = imageBox->setFrame(*pconfig, j);
if (status != 0)
out << AUTO_STATUS << imageBox->translateStatus(status) << OFendl;
pconfig->restore_cursor();
}
}
pconfig->set_section(0, L0_VOI);
if (pconfig->section_valid(0))
{
tmpstring = pconfig->get_key_value();
tmpstring.convertto(j);
k = imageBox->countVOIs();
k=2;
if (k>0)
{
if (j>0) j-=1; else j=0;
if (j >= k) j=k-1;
out << AUTO_SETVOI << j+1 << OFendl;
pconfig->save_cursor();
status = imageBox->setVOI(*pconfig, j);
if (status != 0)
out << AUTO_STATUS << imageBox->translateStatus(status) << OFendl;
pconfig->restore_cursor();
}
}
}
pconfig->set_section(0, L0_POLARITY);
if (pconfig->section_valid(0))
{
tmpstring = pconfig->get_key_value();
out << AUTO_SETPOLARITY << tmpstring << OFendl;
pconfig->save_cursor();
status = imageBox->setPolarity(tmpstring.getpchar());
if (status != 0)
out << AUTO_STATUS << imageBox->translateStatus(status) << OFendl;
pconfig->restore_cursor();
}
pconfig->set_section(0, L0_MAGNIFICATION);
if (pconfig->section_valid(0))
{
tmpstring = pconfig->get_key_value();
out << AUTO_SETIMAGNIFICATION << tmpstring << OFendl;
pconfig->save_cursor();
status = imageBox->setMagnification(tmpstring.getpchar());
if (status != 0)
out << AUTO_STATUS << imageBox->translateStatus(status) << OFendl;
pconfig->restore_cursor();
}
pconfig->set_section(0, L0_SMOOTHING);
if (pconfig->section_valid(0))
{
tmpstring = pconfig->get_key_value();
out << AUTO_SETISMOOTHING << tmpstring << OFendl;
pconfig->save_cursor();
status = imageBox->setSmoothing(tmpstring.getpchar());
if (status != 0)
out << AUTO_STATUS << imageBox->translateStatus(status) << OFendl;
pconfig->restore_cursor();
}
pconfig->set_section(0, L0_REQUESTEDSIZE);
if (pconfig->section_valid(0))
{
tmpstring = pconfig->get_value();
tmpstring.convertto(dbl);
out << AUTO_SETIMAGESIZE << dbl << "mm" << OFendl;
pconfig->save_cursor();
status = imageBox->setRequestedImageSize(dbl);
if (status != 0)
out << AUTO_STATUS << imageBox->translateStatus(status) << OFendl;
pconfig->restore_cursor();
}
// }


I can print images but images as VOILUT=1 in tcpprt.conf remarked.
Images too dark. But images ok when I send to same image with tcpprt_e.exe with same tcpprt.cnf file. Where is the mistake I couldn't find?

Comments:
-imageBox->countVOIs(); value =0
-PSVModelImageBox::imageObjectOwned will not set 1. Because that variable private.

Thanks in advance.
Kubilay

kubilay
Posts: 3
Joined: Fri, 2007-07-27, 20:40

#4 Post by kubilay »

I solved that problem. I anyone ask I can send final source code.

Last Question before permannent Licencing:

- My evaluation licenced tool not included tcpsvr source code. Is permanent licenced included that.
Kubilay

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1437
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

#5 Post by Marco Eichelberg »

My evaluation licenced tool not included tcpsvr source code. Is permanent licenced included that.
There are different permanent licenses available - with or without full source code access to the print server component, at different prices. The print client component is always shipped in source code, because you need that to integrate with your own application. For details send e-mail to dicom /at/ offis /dot/ de.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest