#catmaid-tools
##TileCATMAID
A standalone command line application to export image tiles representing scale level 0 of the tiled scale pyramids for the CATMAID interface from existing CATMAID image stacks. The program enables to crop a box of interest from an existing CATMAID stack and to export only a subset of the tile set. It is thus easily possible (and desired) to parallelize the export on a cluster.
The main utility of the program is to export resliced (xyz, xzy, zyx) representations of existing CATMAID stacks.
Separation of scale level 0 tile generation and scaling is necessary to enable the desired level of parallelization. One would typically generate the scale level 0 tile set parallelized in volumes that cover a moderate number of source tiles. Only after a z-slice is fully exported, it can be used to generate the scale pyramid. I.e., scaling can be parallelized by z-slice but not within a z-slice.
The TileCATMAID main program comes in the fat jar catmaid-tile.jar that can be generated with Eclipse using catmaid-tile.jardesc. It is executed by:
./java -jar ScaleCATMAID.jar -DsourceBaseUrl=http://...
passing parameters as properties to the JVM virtual machine. It accepts the following parameters, type and default in parantheses:
- sourceBaseUrl
- base path of the source CATMAID stack (string, ""), not required if
sourceUrlFormat
includes it - sourceUrlFormat
- URL format String to address CATMAID tiles(string, sourceBaseUrl + "%5$d/%8$d_%9$d_%1$d.jpg").
Tiles are addressed, in this order, by their
- scale_level,
- scale,
- x,
- y,
- z,
- tile width,
- tile height,
- tile row, and
- tile column.
Examples:
- "http://catmaid.org/my-data/xy/%5$d/%8$d_%9$d_%1$d.jpg"
- CATMAID DefaultTileSource (type 1)
- "http://catmaid.org/my-data/xy/?x=%3$d&y=%4$d&width=%6d&height=%7$d&row=%8$d&col=%9$d&scale=%2$f&z=%4$d"
- CATMAID RequestTileSource (type 2)
- "http://catmaid.org/my-data/xy/%1$d/%5$d/%8$d/%9$d.jpg"
- CATMAID LargeDataTileSource (type 5)
- sourceWidth
- width of the source in scale level 0 pixels in xyz orientation (long, 0)
- sourceHeight
- height of the source in scale level 0 pixels in xyz orientation (long, 0)
- sourceDepth
- depth of the source in scale level 0 pixels in xyz orientation (long, 0)
- sourceScaleLevel
- source scale level to be used for export scale level 0 (long, 0)
- sourceTileWidth
- width of source image tiles in pixels (int, 256)
- sourceTileHeight
- height of source image tiles in pixels (int, 256)
- sourceResXY
- source stack x,y-resolution (double, 1.0 )
- sourceResZ
- source stack z-resolution (double, 1.0 )
- minX
- minimum x-coordinate of the box in the source stack to be exported in scale level 0 pixels in xyz orientation (long, 0)
- minY
- minimum y-coordinate of the box in the source stack to be exported in scale level 0 pixels in xyz orientation (long, 0)
- minZ
- minimum z-coordinate of the box in the source stack to be exported in scale level 0 pixels in xyz orientation (long, 0)
- width
- width of the the box in the source stack to be exported in scale level 0 pixels in xyz orientation (long, 0)
- height
- height of the the box in the source stack to be exported in scale level 0 pixels in xyz orientation (long, 0)
- depth
- depth of the the box in the source stack to be exported in scale level 0 pixels in xyz orientation (long, 0)
- orientation
- orientation of exported stack, possible values "xy", "xz", "zy" (string, "xy")
- tileWidth
- width of exported image tiles in pixels (int, 256)
- tileHeight
- height of exported image tiles in pixels (int, 256)
- exportMinZ
- first z-section index to be exported (long, 0)
- exportMaxZ
- last z-section index to be exported (long, depth-1)
- exportMinR
- first row of tiles to be exported (long, 0)
- exportMaxR
- last row of tiles to be exported (long, depth-1)
- exportMinC
- first column of tiles to be exported (long, 0)
- exportMaxC
- last column of tiles to be exported (long, depth-1)
- exportBasePath
- base path for the stakc to be exported (string, "")
- tilePattern
- tilePattern the file name convention for export tile coordinates without extension and base path, must contain "<s>","<z>", "<r>", "<c>" (string, "<z>/<r>_<c>_<s>")
- format
- image tile file format for export, e.g. "jpg" or "png" (string, "jpg")
- quality
- quality for export jpg-compression if format is "jpg" (float, 0.85)
- type
- the type of export tiles, either "rgb" or "gray" (string, "rgb")
- interpolation
- interpolation scheme used, either nearest neighbor "NN" or n-linear "NL" (string, "NN")
Alternatively, it can be executed by the accompanying Bash-script retile that is called with a config file as its single parameter. The config file contains all parameters in key=value rows (escaped according to Bash's needs).
###Examples:
sourceUrlFormat='http://catmaid.org/stack/%5$d/%8$d_%9$d_%1$d.jpg'
sourceWidth=22775
sourceHeight=18326
sourceDepth=462
sourceScaleLevel=2
sourceTileWidth=256
sourceTileHeight=256
sourceResXY=4.0
sourceResZ=45.0
minX=1300
minY=1000
minZ=0
width=2000
height=2000
depth=100
orientation=xy
exportBasePath=/var/www/catmaid/test/xy/
tilePattern="<z>/<r>_<c>_<s>"
format=jpg
quality=0.85
type=gray
interpolation=NL