connect to PACS system biginner question

All other questions regarding DCMTK

Moderator: Moderator Team

Message
Author
ali.m.habib
Posts: 85
Joined: Sun, 2010-12-26, 17:34

connect to PACS system biginner question

#1 Post by ali.m.habib »

Hi all,

I need sample code / example in how to connect to pacs sustem and test teh connection


your fast reply is highly appreciated

omarelgazzar
Posts: 101
Joined: Wed, 2009-07-08, 16:06
Location: Oldenburg, Germany

#2 Post by omarelgazzar »

I would recommend using the DCMSCU Class
Here is a simplified pseudocode
DcmSCU *SCU = new DcmSCU (this);
OFList<OFString> XferSyntaxes;

if (SCU != NULL)
{
SCU ->setPeerAETitle(PeerAETitle);
SCU ->setPeerHostName(PeerHostName);
SCU ->setPeerPort(PeerPortNumber);
// Add Preferred Outgoing Transfer Syntaxes
XferSyntaxes.push_back (UID_LittleEndianImplicitTransferSyntax);
XferSyntaxes.push_back(UID_LittleEndianExplicitTransferSyntax);
.....
.....
// Add Presentation Context for each required SOP Class UID
SCU ->addPresentationContext(SOPClassUID, XferSyntaxes);
.....
.....
status = SCU ->initNetwork();
status=SCU->negotiateAssociation();
const T_ASC_PresentationContextID presID = SCU->findPresentationContextID(AbstractSyntax,TransferSyntax);
//Send Request on a presentation context ID
...
...

//Close Association
SCU->closeAssociation();
}
Last edited by omarelgazzar on Wed, 2011-05-25, 12:12, edited 3 times in total.

ali.m.habib
Posts: 85
Joined: Sun, 2010-12-26, 17:34

#3 Post by ali.m.habib »

omarelgazzar wrote:There is an example in the documentation for echoscu

However, I would recommend using the DCMSCU Class
SCU = new DcmSCU (this);

if (SCU != NULL)
{
SCU ->setPeerAETitle(PeerAETitle);
SCU ->setPeerHostName(PeerHostName);
SCU ->setPeerPort(PeerPortNumber);
SCU ->addPresentationContexts(PreferredOutgoingSyntax);
status = SCU ->initNetwork();
status=SCU->negotiateAssociation();
SCU->findPresentationContext(..,..)
//Send Request
...
...

//Close Association
SCU->closeAssociation();
}

Hope that helps.
I face a problem while use DCMTK which is

/Users/abduljaleelmalik/full-dcmtk/include/dcmtk/ofstd/ofstream.h:80:0 /Users/abduljaleelmalik/full-dcmtk/include/dcmtk/ofstd/ofstream.h:80:2: error: #error DCMTK needs stringstream or strstream type


#define INCLUDE_CSTDIO
#include "dcmtk/ofstd/ofstdinc.h"
#include <dcmtk/dcmimgle/dcmimage.h>
#include <dcmtk/config/osconfig.h>
#include <dcmtk/dcmimgle/dcmimage.h>

how can I override that

omarelgazzar
Posts: 101
Joined: Wed, 2009-07-08, 16:06
Location: Oldenburg, Germany

#4 Post by omarelgazzar »

First of all, you should include osconfig.h at the top of all other included files. So, your code should look like

#define INCLUDE_CSTDIO
#include <dcmtk/config/osconfig.h>
...
...

ali.m.habib
Posts: 85
Joined: Sun, 2010-12-26, 17:34

#5 Post by ali.m.habib »

omarelgazzar wrote:First of all, you should include osconfig.h at the top of all other included files. So, your code should look like

#define INCLUDE_CSTDIO
#include <dcmtk/config/osconfig.h>
...
...
it gave the same error

Michael Onken
DCMTK Developer
Posts: 2049
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#6 Post by Michael Onken »

Hi,

try to add "-DHAVE_CONFIG_H" to your compiler flags, otherwise including osconfig.h does actually nothing.

Best regards,
Michael

ali.m.habib
Posts: 85
Joined: Sun, 2010-12-26, 17:34

#7 Post by ali.m.habib »

Michael Onken wrote:Hi,

try to add "-DHAVE_CONFIG_H" to your compiler flags, otherwise including osconfig.h does actually nothing.

Best regards,
Michael
how can I do that in xcode , there're no direct compiler flag

there're
OpenMP linker flags
other linker flags
symbol ordering flags
warning linker flag

I tried add it to other linker flags , but the same error appeared

I tried also to add

#undef verifty
#define INCLUDE_CSTDIO
#include <dcmtk/config/osconfig.h>
#include <dcmtk/dcmimgle/dcmimage.h>

but the error /DCMTK_BINARY/include/dcmtk/ofstd/ofstream.h:80:0 /DCMTK_BINARY/include/dcmtk/ofstd/ofstream.h:80:2: error: #error DCMTK needs stringstream or strstream type

still appear in ofstream.h

#include <iostream.h>
#include <fstream.h>
// For old STREAMS library: preference for strstream
#if defined(HAVE_STRSTREA_H) || defined(HAVE_STRSTREAM_H)
#ifdef HAVE_STRSTREA_H
#include <strstrea.h>
#else
#include <strstream.h>
#endif
#elif defined(HAVE_SSTREAM_H)
#include <sstream.h>
#define USE_STRINGSTREAM
#else
#error DCMTK needs stringstream or strstream type
#endif
#include <iomanip.h>

Michael Onken
DCMTK Developer
Posts: 2049
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#8 Post by Michael Onken »

Hi,

It is not a Linker flag, it is a compiler flag. First, every .cc file is compiled into an object file, then in the end, they are linked together into applications. You can recognize an application if one of the objects (and only one) contains a main() function.

I do not have a mac here, but there will surely be change to change the compile flags, not only the linker flags. Just right-click on file to be compiled, and look for compiler or build flags. Maybe again, google may help.

This is not a dcmtk-related problem.

Best regards,
Michael

ali.m.habib
Posts: 85
Joined: Sun, 2010-12-26, 17:34

#9 Post by ali.m.habib »

Michael Onken wrote:Hi,

It is not a Linker flag, it is a compiler flag. First, every .cc file is compiled into an object file, then in the end, they are linked together into applications. You can recognize an application if one of the objects (and only one) contains a main() function.

I do not have a mac here, but there will surely be change to change the compile flags, not only the linker flags. Just right-click on file to be compiled, and look for compiler or build flags. Maybe again, google may help.

This is not a dcmtk-related problem.

Best regards,
Michael
I build dcmtk succesfuly my problem in using it
the error appear while usiing it

Michael Onken
DCMTK Developer
Posts: 2049
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#10 Post by Michael Onken »

Right, and I said you would to do (add a compile flag); the rest is now up to you: learning how to do that with your compiler (Xcode/gcc).

ali.m.habib
Posts: 85
Joined: Sun, 2010-12-26, 17:34

#11 Post by ali.m.habib »

Michael Onken wrote:Right, and I said you would to do (add a compile flag); the rest is now up to you: learning how to do that with your compiler (Xcode/gcc).
it compiled corectly ,

I need example to
-test the connection with pacs I missed omarelgazar reply
- read local dicom file and convert it to buffer data

any suggestion please

Michael Onken
DCMTK Developer
Posts: 2049
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#12 Post by Michael Onken »

Hi,

Omar's code snippet was just fine. If you need a full example, look might look at the demo SCU from the CTK project.

Good luck,
Michael

ali.m.habib
Posts: 85
Joined: Sun, 2010-12-26, 17:34

#13 Post by ali.m.habib »

Michael Onken wrote:Hi,

Omar's code snippet was just fine. If you need a full example, look might look at the demo SCU from the CTK project.

Good luck,
Michael
thanks alot ,
what about read local dcm file , I need to read the image data as buffer

any suggestion please

Michael Onken
DCMTK Developer
Posts: 2049
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#14 Post by Michael Onken »

Hi,

have a look at the dcmdata online documentation.

Michael

ali.m.habib
Posts: 85
Joined: Sun, 2010-12-26, 17:34

#15 Post by ali.m.habib »

Michael Onken wrote:Hi,

have a look at the dcmdata online documentation.

Michael
final question, and sorry for my naive questions, I am in my first steps in imaging

how to get the following information using DCMTK
bitsPerComponent;
bitsPerPixel;
bytesPerRow;

from the DCM file

Post Reply

Who is online

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