All other questions regarding DCMTK
Moderator: Moderator Team
ancrou
Posts: 13 Joined: Tue, 2008-07-01, 16:54
Location: Nancy France
#1
Post
by ancrou » Fri, 2008-07-11, 17:14
Hi,
I would like to initialize a DcmFileFormat with buffer.
I have got :
const void *buff //a pointer to the receiver’s contents
unsigned long bufLen //the number of bytes contained in the receiver.
What should I do ?
I tried :
Code: Select all
DcmInputBufferStream* buffer= new DcmInputBufferStream();
buffer->setBuffer(buff, bufLen);
But after that ?
Thinks
Anth
budric
Posts: 29 Joined: Thu, 2007-06-28, 20:48
#2
Post
by budric » Thu, 2008-07-17, 20:09
I haven't done it myself but I assume you'd use something like
Code: Select all
virtual OFCondition read (DcmInputStream &inStream, const E_TransferSyntax xfer=EXS_Unknown, const E_GrpLenEncoding glenc=EGL_noChange, const Uint32 maxReadLength=DCM_MaxReadLength)
http://support.dcmtk.org/docs/classDcmDataset.html
to create your dataset.
then initialize DcmFileFormat with the dataset.
Marco Eichelberg
OFFIS DICOM Team
Posts: 1445 Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:
#3
Post
by Marco Eichelberg » Fri, 2008-07-18, 08:30
Something like this will do. Note the call to setEos which is important because it tells the buffer stream that the buffer will not be refilled (e.g. from a network connection) once it has been read completely.
Code: Select all
DcmInputBufferStream dataBuf;
dataBuf.setBuffer(buff, bufLen);
dataBuf.setEos();
DcmFileFormat dfile;
dfile.transferInit();
OFCondition cond = dfile.read(dataBuf);
dfile.transferEnd();
if( cond.bad() )
{
// something went wrong.
}
ancrou
Posts: 13 Joined: Tue, 2008-07-01, 16:54
Location: Nancy France
#4
Post
by ancrou » Mon, 2008-07-21, 08:43
Marco Eichelberg wrote: Something like this will do. Note the call to setEos which is important because it tells the buffer stream that the buffer will not be refilled (e.g. from a network connection) once it has been read completely.
It's working
Thank you a lot.
Anthony
Users browsing this forum: No registered users and 1 guest