ExampleFileScript

From KitwarePublic
Jump to navigationJump to search

Script to generate test MINC2 files that are used in testing the itk MINC2 IO library functions. This also serves as a good example of how to use the MINC2IO library

#! /bin/sh
#
# Generate tests for ITK MINC


# zyx float
seq 0 99 | atof | \
   rawtominc -float -clobber -2 \
      -zyx \
      -xstep 1 -ystep 2 -zstep 4 \
      -xstart -1.0 -ystart -5.0 -zstart -20.0 \
      MINC2IOTestImage01.mnc 10 5 2

# xzy float
mincreshape -clobber -2 -dimorder xspace,zspace,yspace \
   MINC2IOTestImage01.mnc MINC2IOTestImage02.mnc

# xyz float
mincreshape -clobber -2 -dimorder xspace,yspace,zspace \
   MINC2IOTestImage01.mnc MINC2IOTestImage03.mnc

# zyx byte signed
mincreshape -clobber -2 -byte -signed \
   MINC2IOTestImage01.mnc MINC2IOTestImage04.mnc

# zyx byte unsigned
mincreshape -clobber -2 -byte -unsigned \
   MINC2IOTestImage01.mnc MINC2IOTestImage05.mnc

# zyx short signed
mincreshape -clobber -2 -short -signed \
   MINC2IOTestImage01.mnc MINC2IOTestImage06.mnc

# zyx short unsigned
mincreshape -clobber -2 -short -unsigned \
   MINC2IOTestImage01.mnc MINC2IOTestImage07.mnc

# zyx int signed
mincreshape -clobber -2 -int -signed \
   MINC2IOTestImage01.mnc MINC2IOTestImage08.mnc

# zyx int unsigned
mincreshape -clobber -2 -int -unsigned \
   MINC2IOTestImage01.mnc MINC2IOTestImage09.mnc

# zyx double
mincreshape -clobber -2 -double \
   MINC2IOTestImage01.mnc MINC2IOTestImage10.mnc

# -ve steps
seq 0 99 | atof | \
   rawtominc -clobber -2 -float \
      -zyx \
      -xstep -1 -ystep -2 -zstep -0.2 \
      -xstart 0.5 -ystart 1 -zstart 1 \
      MINC2IOTestImage11.mnc 10 5 2

# 2 dimensions
mincreshape -clobber -2 -dimrange xspace=0,0 \
   MINC2IOTestImage01.mnc MINC2IOTestImage12.mnc

# 1 dimension
mincreshape -clobber -2 -dimrange xspace=0,0 -dimrange yspace=0,0 \
   MINC2IOTestImage01.mnc MINC2IOTestImage13.mnc

# direction cosines
seq 0 99 | atof | \
   rawtominc -float -clobber -2 \
      -zyx \
      -xstep 1 -ystep 2 -zstep 0.2 \
      -xstart -0.5 -ystart -1 -zstart -1 \
      -xdircos 1 0 0 -ydircos 0 0 1 -zdircos 0 1 0 \
      MINC2IOTestImage14.mnc 10 5 2