annotate Database/Formats/Generate.sh @ 476:77f868063bb3

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