problem using dcmodify

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
lina
Posts: 3
Joined: Thu, 2012-11-22, 09:09

problem using dcmodify

#1 Post by lina »

Hi,

I met a problem when using dcmodify.I have some dicom files under a directory that I would like to apply dcmodify on them.

WHen I typed "dcmodify +g <filename>" on command line, no problem.


But if I call them from a php script running at server side(combined with Apache)as follows:

putenv("DCMDICTPATH=/home/webmc/dcmtk-3.6.0-linux-i686-static/share/dcmtk/dicom.dic;/home/webmc/dcmtk-3.6.0-linux-i686-static/share/dcmtk/private.dic;/home/webmc/dcmtk-3.6.0-linux-i686-static/share/dcmtk/diconde.dic");

for($i=0; $i<sizeof($fileNames); $i++) {
$file2Conv = $fileNames[$i];
echo "\n file to convert:".$file2Conv."\n";
$retval = 0;
passthru('dcmodify +g '. $file2Conv, $retval);
echo "\n result:".$retval . "\n";
//exec('dcmodify -g '.$file2Conv); this did not work either
}

No matter I use passthru or exec, it always gave error as follows:
src:/home/webmc/dcmConvert//21Apr2014-14-22-48-868000/RD.1.2.246.352.71.7.584509055672.1682886.20140206102511.dcmdest:/home/webmc/op_data/users/xchen/plans//21Apr2014-14-22-48-868000/RD.1.2.246.352.71.7.584509055672.1682886.20140206102511.dcmimgName:/home/webmc/dcmConvert//21Apr2014-14-22-48-868000/RT.1.2.246.352.71.4.584509055672.223654.20140228191753.dcm
E: DcmElement: ContourData (3006,0050) larger (12352) than remaining bytes in file
E: unable to load file /home/webmc/dcmConvert//21Apr2014-14-22-48-868000/RT.1.2.246.352.71.4.584509055672.223654.20140228191753.dcm: I/O suspension or premature end of stream
E: There was 1 error
E: DcmElement: ContourData (3006,0050) larger (11156) than remaining bytes in file
E: unable to load file /home/webmc/dcmConvert//21Apr2014-14-22-48-868000/RT.1.2.246.352.71.4.584509055672.223654.20140228191753.dcm: I/O suspension or premature end of stream
E: There was 1 error


Do anyone know what is the problem? Is there any environment variable I need to include? I include the path to the dictionary already.


thanks!

J. Riesmeier
DCMTK Developer
Posts: 2503
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: problem using dcmodify

#2 Post by J. Riesmeier »

First of all, why do you use dcmodify with option +g only? Then, the given output is not from your script, right?

And, you should also reread the Environment section of the dcmodify manpage.

lina
Posts: 3
Joined: Thu, 2012-11-22, 09:09

Re: problem using dcmodify

#3 Post by lina »

Hi,

Thanks for your reply. Here is the story behind, I am using DCM4CHEE server and legacy computing server for my project. My legacy computing server needs to import dicom RT, PL and CT files to do computation of dose. I found that all the dicom files I retrieved from dCM4CHEE server are all the same with original dicom files I imported, except that the sequences length was chopped off. The legacy computing server reports error without the sequence length.

I emailed DCM4CHEE team, they do not have solution for now.
But I later found a workaround by using dcmodify tool.
If I use "dcmodify +g <dicom files retrieved from DCM4CHEE>" and then use "dcmodify -g <resultant dicom files from dcmoify +g command>", I got the original dicom files I imported.

However, when I used "dcmodify +g ..." and "dcmodify -g ..." in linux command line, no problem! But if I inserted these two commands in my php server script, I got error, even I used putenv to put the dictionaries in.(The error "could not find dictionary" went away after I put "putenv" statement. But the error message still stayed.)

Anyone knows how to fix this?

Thanks

J. Riesmeier
DCMTK Developer
Posts: 2503
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: problem using dcmodify

#4 Post by J. Riesmeier »

dcmodify is the wrong tool. You should use dcmconv instead:

Code: Select all

  length encoding in sequences and items:
    +e   --length-explicit      write with explicit lengths (default)
    -e   --length-undefined     write with undefined lengths
Please note that dcmconv needs two filenames, one for the input and one for the output.

Apart from that, I have no idea what's wrong with your PHP script. This is probably no DCMTK-specific issue, right?

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Baidu [Spider] and 1 guest