DICOM @ OFFIS

Discussion Forum for OFFIS DICOM Tools - For registration, send email with desired user name to the OFFIS DICOM team
It is currently Fri, 2018-04-20, 11:19

All times are UTC + 1 hour




Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Thu, 2017-09-28, 21:07 
Offline

Joined: Thu, 2015-09-03, 09:36
Posts: 30
To workaround the problem - I tried the just discovered new option '+Fn' to extract the pixel data in parts. The manpage writes: 'use absolute frame number for filenames'. If I want to extract only 2 or 800 frames, the option always adds 20 frames, e.g.:

Code:
macbook:~ jb$ ./dcmj2pnm +Fr 21 22 +Fn +op -O --log-level info A0000 mf
I: reading DICOM file: A0000
I: preparing pixel data
I: writing frame 21 to mf.f21.ppm
I: writing frame 22 to mf.f22.ppm
I: writing frame 23 to mf.f23.ppm
I: writing frame 24 to mf.f24.ppm
I: writing frame 25 to mf.f25.ppm
I: writing frame 26 to mf.f26.ppm
I: writing frame 27 to mf.f27.ppm
I: writing frame 28 to mf.f28.ppm
I: writing frame 29 to mf.f29.ppm
I: writing frame 30 to mf.f30.ppm
I: writing frame 31 to mf.f31.ppm
I: writing frame 32 to mf.f32.ppm
I: writing frame 33 to mf.f33.ppm
I: writing frame 34 to mf.f34.ppm
I: writing frame 35 to mf.f35.ppm
I: writing frame 36 to mf.f36.ppm
I: writing frame 37 to mf.f37.ppm
I: writing frame 38 to mf.f38.ppm
I: writing frame 39 to mf.f39.ppm
I: writing frame 40 to mf.f40.ppm
I: writing frame 41 to mf.f41.ppm
I: writing frame 42 to mf.f42.ppm
I: cleaning up memory


Is this a feature?

Anyway - this option seems to be the solution for now ...


Jens

Jens


Top
 Profile  
 
PostPosted: Thu, 2017-09-28, 21:12 
Offline
DCMTK Developer

Joined: Tue, 2011-05-03, 14:38
Posts: 1928
Location: Oldenburg, Germany
Maybe, you misinterpreted the second value after option +Fr?
Code:
    +Fr   --frame-range         [n]umber [c]ount: integer
                                select c frames beginning with frame n


Top
 Profile  
 
PostPosted: Thu, 2017-09-28, 21:25 
Offline

Joined: Thu, 2015-09-03, 09:36
Posts: 30
Sorry, shame on me.

Jens


Top
 Profile  
 
PostPosted: Fri, 2017-09-29, 06:48 
Offline

Joined: Thu, 2015-09-03, 09:36
Posts: 30
J. Riesmeier wrote:
Quote:
I would rather recommend to implement the following command line option from dcm2avi also for dcm[j]2pnm:
Code:
memory handling:

  -fm   --frames-in-memory  [f]rame count: integer
          number of frames in memory (default: all)


I would highly appreciate this. Will this be a lot of work?

Jens


Top
 Profile  
 
PostPosted: Fri, 2017-09-29, 09:53 
Offline
DCMTK Developer

Joined: Tue, 2011-05-03, 14:38
Posts: 1928
Location: Oldenburg, Germany
I would expect the required effort to be a couple of hours (plus testing). I've added this as a feature request to the issue tracker.


Top
 Profile  
 
PostPosted: Sat, 2017-09-30, 12:33 
Offline

Joined: Thu, 2015-09-03, 09:36
Posts: 30
For now, I'm using this workaround in my shellscript to extract 500 frames per run. The +Fr option becomes very handy here ...
Code:
   # How many frames per run should be extracted
   FRAMECOUNT=500
   # how man full runs with $FRAMECOUNT are needed
   FULLRUNS=$(echo "${NumberOfFrames}/${FRAMECOUNT}" | bc)
   # how many frames have to be extracted during the last run
   RESTFRAMES=$(echo "${NumberOfFrames}%${FRAMECOUNT}" | bc)
   # A while loop calls dcmj2pnm multiple times ($FULLRUNS) with an amount of $FRAMECOUNT frames
   FULLRUNCOUNT=1
   STARTCOUNT=1
   while [ ${FULLRUNCOUNT} -le ${FULLRUNS} ]; do
      ${BINDIR}/dcmj2pnm --frame-range ${STARTCOUNT} ${FRAMECOUNT} ${dcmj2pnm_us_opts[@]} ${FILE} ${FRAMEDIR}/mf || error "'${FILE}' failed"
      STARTCOUNT=$[STARTCOUNT +${FRAMECOUNT}]
       FULLRUNCOUNT=$[FULLRUNCOUNT +1]
   done
   # then the remainding frames will be processed ... if the $NumberOfFrames is lower than $FRAMECOUNT, this run of dcmj2pnm is executed only ...
   if [ ${RESTFRAMES} -gt 0 ]; then
      ${BINDIR}/dcmj2pnm --frame-range ${STARTCOUNT} ${RESTFRAMES} ${dcmj2pnm_us_opts[@]} ${FILE} ${FRAMEDIR}/mf || error "'${FILE}' failed"
   fi


Many thanks for your awesome and very professional support!

Jens


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group