Search found 329 matches

by martinrame
Tue, 2014-06-24, 15:45
Forum: DCMTK - General
Topic: Invalid stream when trying to read from buffer
Replies: 20
Views: 16137

[SOLVED] Re: Invalid stream when trying to read from buffer

Finally I was able to remove the pixel data from the dataset. The key was using getDataset()->remove( myDcmTagKeyToPixelData ). Here's my commented code: // Create an instance of DcmTagkey pointing to the PixelData tag DcmTagKey pdata(0x7fe0,0x0010); // load the file DcmFileFormat fileFormat; OFCond...
by martinrame
Tue, 2014-06-24, 15:05
Forum: DCMTK - General
Topic: Invalid stream when trying to read from buffer
Replies: 20
Views: 16137

Re: Invalid stream when trying to read from buffer

I understand, this is my code: DcmFileFormat fileFormat; OFCondition cond = fileFormat.read(dataBuf, EXS_Unknown, EGL_noChange, 256); fileFormat.print(cout); It looks like the print method of DcmFileFormat, when access the PixelData tag is populating its content. Is there a way to load all tags exce...
by martinrame
Mon, 2014-06-23, 14:26
Forum: DCMTK - General
Topic: Invalid stream when trying to read from buffer
Replies: 20
Views: 16137

Re: Invalid stream when trying to read from buffer

Jörg, it seems to work, but It's still reading the PixelData, how can I ignore it?. I've tried changing the maxReadLength param to 512 (and even 256) but still no luck: fileFormat.read(dataBuf, EXS_Unknown, EGL_noChange, 512); This is the result: ... (7fe0,0010) OB (PixelSequence #=2) # u/l, 1 Pixel...
by martinrame
Mon, 2014-06-23, 13:48
Forum: DCMTK - General
Topic: Invalid stream when trying to read from buffer
Replies: 20
Views: 16137

Re: Invalid stream when trying to read from buffer

J. Riesmeier wrote:As far as I can see, NO. Reading the man page of fread() you'll notice that you have to swap the second and third parameter.
Great!, that way it worked as expected.

Returning to my original problem, it looks like I'm passing a trashed buffer to DcmFileFormat.
by martinrame
Mon, 2014-06-23, 13:42
Forum: DCMTK - General
Topic: Invalid stream when trying to read from buffer
Replies: 20
Views: 16137

Re: Invalid stream when trying to read from buffer

I just want to read 8192 bytes, Is my code correct?.
by martinrame
Mon, 2014-06-23, 13:31
Forum: DCMTK - General
Topic: Invalid stream when trying to read from buffer
Replies: 20
Views: 16137

Re: Invalid stream when trying to read from buffer

Jörg, here's a small program to show what I'm trying to do: #include <dcmtk/config/osconfig.h> #define INCLUDE_CSTDLIB #define INCLUDE_CSTDIO #define INCLUDE_CSTRING #include "dcmtk/ofstd/ofstdinc.h" #include "dcmtk/dcmdata/dcistrmb.h" #include "dcmtk/dcmdata/dcdict.h" #include <dcmtk/dcmdata/dcfile...
by martinrame
Sat, 2014-06-21, 12:43
Forum: DCMTK - General
Topic: Invalid stream when trying to read from buffer
Replies: 20
Views: 16137

Re: Invalid stream when trying to read from buffer

Can you load that 128k file into a (void *) buffer, then try to open with DcmFileFormat?, then Print it's header (at least the part that can be read)?. That's exactly what I'm trying to do.
by martinrame
Fri, 2014-06-20, 19:01
Forum: DCMTK - General
Topic: Invalid stream when trying to read from buffer
Replies: 20
Views: 16137

Re: Invalid stream when trying to read from buffer

The information in the meta-header indicate that your buffer actually contains the byte stream of a DICOM file... Where is the buffer content coming from? I have a client app that requests an image stored on a http server that serve requests using a CGI app. When part of the data comes to the clien...
by martinrame
Fri, 2014-06-20, 18:53
Forum: DCMTK - General
Topic: Invalid stream when trying to read from buffer
Replies: 20
Views: 16137

Re: Invalid stream when trying to read from buffer

I did some more tests using DcmItem and DcmMetaInfo, instead of DcmDataset. None of them stopped with an "Invalid stream" error, but they (of course) don't get the information I need. Here are the results: DcmMetaInfo: # Dicom-Meta-Information-Header # Used TransferSyntax: Little Endian Explicit (00...
by martinrame
Fri, 2014-06-20, 18:17
Forum: DCMTK - General
Topic: Invalid stream when trying to read from buffer
Replies: 20
Views: 16137

Re: Invalid stream when trying to read from buffer

If you have no DICOM file why do you use DcmFileFormat at all (instead of DcmDataset)? Good question. I modified my code to use a DcmDataset instead of DcmFileFormat: DcmInputBufferStream dataBuf; dataBuf.setBuffer(buffer, buflen); dataBuf.setEos(); DcmDataset dset; OFCondition cond = dset.read(dat...
by martinrame
Fri, 2014-06-20, 17:41
Forum: DCMTK - General
Topic: Invalid stream when trying to read from buffer
Replies: 20
Views: 16137

Re: Invalid stream when trying to read from buffer

So, you receive the DICOM dataset directly to file? Would the "maxReadLength" parameter of DcmFileFormat::loadFile() help? By default, this method only loads element values that have a maximum length of 4 Kbytes (see "DCM_MaxReadLength"). Thanks for your answer Jörg. No, I cannot use loadFile, beca...
by martinrame
Thu, 2014-06-19, 20:16
Forum: DCMTK - General
Topic: Invalid stream when trying to read from buffer
Replies: 20
Views: 16137

Invalid stream when trying to read from buffer

Hi, I need to read some tags from an image my program receives via network, as the files are really big (XA), I would like to load a buffer containing just the first 128kb for example, and look for the info I need. I did some tests by writing my buffer to a file, and using "dcmdump +E -M file.dcm" a...
by martinrame
Fri, 2014-04-04, 11:25
Forum: DCMTK - General
Topic: Can't compile...pthread errror
Replies: 8
Views: 7291

Re: Can't compile...pthread errror

Hi Jörg, I can confirm CMake allowed me to compile the shared libraries without any issue.
by martinrame
Mon, 2014-03-10, 13:47
Forum: DCMTK - General
Topic: Can't compile...pthread errror
Replies: 8
Views: 7291

Re: Can't compile...pthread errror

Thanks Jörg, I'll take a look at CMAKE.
by martinrame
Fri, 2014-03-07, 19:01
Forum: DCMTK - General
Topic: Can't compile...pthread errror
Replies: 8
Views: 7291

Re: Can't compile...pthread errror

I've tested with dcmtk-3.6.1_20131114 and I get the same error if I use this config/Makefile.def (only the # ARCH section): # ARCH = CC = gcc CFLAGS = -fPIC -O2 -I/usr/include/libxml2 -D_REENTRANT -D_XOPEN_SOURCE_EXTENDED -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_POSIX_C_SOURC...