comparison Database/Formats/Generate.sh @ 21:2a29bcff60a7

tests of image decoding
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 22 Jun 2015 14:14:37 +0200
parents
children
comparison
equal deleted inserted replaced
20:f3d08a75a636 21:2a29bcff60a7
1 #!/bin/bash
2
3 set -e
4
5 # http://gdcm.sourceforge.net/html/gdcmconv.html
6
7 gdcmconv -i ../Brainix/Epi/IM-0001-0001.dcm -o JpegLossless.dcm -L
8 gdcmconv -i ../Brainix/Epi/IM-0001-0001.dcm -o Jpeg.dcm -J
9 gdcmconv -i ../Brainix/Epi/IM-0001-0001.dcm -o Rle.dcm -R
10
11 # Generate study/series/sop instance UID++++
12 dcmodify -e '(0008,0005)' -m '(0010,0020)=FromGDCM' -gin -gst -gse JpegLossless.dcm
13 dcmodify -e '(0008,0005)' -m '(0010,0020)=FromGDCM' -gin -gst -gse Jpeg.dcm
14 dcmodify -e '(0008,0005)' -m '(0010,0020)=FromGDCM' -gin -gst -gse Rle.dcm
15
16 rm -f JpegLossless.dcm.bak Jpeg.dcm.bak Rle.dcm.bak
17
18 gdcmraw -t PixelData ../Brainix/Epi/IM-0001-0001.dcm PixelData.raw
19 convert -define png:include-chunks=none -define png:compression-level=9 -size 256x256 -depth 16 gray:PixelData.raw Brainix.png
20
21 gdcmraw -t PixelData ../KarstenHilbertRF.dcm PixelData.raw
22 convert -define png:include-chunks=none -define png:compression-level=9 -size 512x464 -depth 8 gray:PixelData.raw KarstenHilbertRF.png
23
24 # Decompress the multiframe image
25 gdcmconv -w ../Multiframe.dcm tmp.dcm
26 gdcmraw -t PixelData ./tmp.dcm PixelData.raw
27 SIZE=$((512*512))
28 dd if=PixelData.raw of=PixelData2.raw bs=$SIZE count=1 skip=0 &> /dev/null
29 convert -define png:include-chunks=none -define png:compression-level=9 -size 512x512 -depth 8 gray:PixelData2.raw Multiframe0.png
30 dd if=PixelData.raw of=PixelData2.raw bs=$SIZE count=1 skip=75 &> /dev/null
31 convert -define png:include-chunks=none -define png:compression-level=9 -size 512x512 -depth 8 gray:PixelData2.raw Multiframe75.png
32
33 # Decompress the signed CT image, ignoring the fact that the data is signed
34 gdcmraw -t PixelData ../SignedCT.dcm PixelData.raw
35 convert -define png:include-chunks=none -define png:compression-level=9 -size 512x512 -depth 16 gray:PixelData.raw SignedCT.png
36
37 rm -f PixelData.raw PixelData2.raw tmp.dcm