All other questions regarding DCMTK
Moderator: Moderator Team
hollebolle
Posts: 28 Joined: Tue, 2005-09-20, 10:09
#1
Post
by hollebolle » Wed, 2009-09-09, 10:44
Hi everybody,
I am trying to develop a WADO-server, where dcmj2pnm converts a DICOM-file to JPG with
Code: Select all
dcmj2pnm +oj +Jq 90 +Wi 1 C:\dicom\test.dcm
So, I am not creating a file, I am using the STDOUT for my Outputstream in the webserver-software with
content-type: image/jpeg .
The generated jpg in my Browser looks like:
instead of
Has anybody an idea what this could be? Is dcmj2pnm working correctly with STDOUT?
Thanks in advance and kind regards.
Jörg Riesmeier
ICSMED DICOM Services
Posts: 2217 Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany
#2
Post
by Jörg Riesmeier » Wed, 2009-09-09, 10:53
In your case, the output is binary data (JPEG) and you seem to use Windows. I'm not sure whether Windows really supports binary data on stdout ... but this is just a guess.
Using a temporary file should always work.
hollebolle
Posts: 28 Joined: Tue, 2005-09-20, 10:09
#3
Post
by hollebolle » Wed, 2009-09-09, 11:02
Hi Jörg,
yes, that is possible. I'm working on windows. With a temporary file it's working fine. But that would have been too easy
.
Jörg Riesmeier
ICSMED DICOM Services
Posts: 2217 Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany
#4
Post
by Jörg Riesmeier » Wed, 2009-09-09, 11:10
It seems that Windows always opens the standard output in text mode. Maybe, something like the following works in order to overcome this:
However, I haven't tested it. Searching for this issue on the Internet might also help ...
gurbuz
Posts: 1 Joined: Wed, 2010-04-21, 03:39
#5
Post
by gurbuz » Thu, 2010-04-22, 17:52
You can see from Joerg's comments in dcm2pnm that stdout has not been verified for Windows:
Revision 1.50 2001/11/09 16:35:20 joergr
...
Added support for the direct output of the converted PNM/PGM/BMP image to the 'stdout' stream (not yet tested under Windows).
Try this fix. It worked for us.
Code: Select all
#ifdef WIN32
setmode(fileno(stdout), O_BINARY);
#endif
Jörg Riesmeier
ICSMED DICOM Services
Posts: 2217 Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany
#6
Post
by Jörg Riesmeier » Fri, 2010-04-23, 08:39
Thank you for the follow-up. We will add this code line to the prepareCmdLineArgs() function for Windows systems.
Users browsing this forum: Ahrefs [Bot] and 1 guest