/catmaid-tools

Utilities for CATMAID, mostly ImgLib2 based

Primary LanguageJava

catmaid-tools

  • TileCATMAID Export scale level 0 tiled subvolumes from an existing stack.
  • ScaleCATMAID Create tiled scale pyramid from existing scale level 0 tiles.

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 catmaid-tile.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

  1. scale_level,
  2. scale,
  3. x,
  4. y,
  5. z,
  6. tile width,
  7. tile height,
  8. tile row, and
  9. 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

ScaleCATMAID

A standalone command line application to create a tiled scale pyramid from an existing scale level 0 tiled CATMAID image stack. The size of the existing stack is determined by the existence of tile files.

The ScaleCATMAID main program comes in the fat jar catmaid-scale.jar that can be generated with Eclipse using catmaid-scale.jardesc. It is executed by:

./java -jar catmaid-scale.jar -DminZ=...

passing parameters as properties to the JVM virtual machine. It accepts the following parameters, type and default in parantheses:

basePath
base path of the source CATMAID stack (string, "")
tileFormat
path format String to address CATMAID tiles, overrides basePath if provided (string, basePath + "%5$d/%8$d_%9$d_%1$d.jpg").

Tiles are addressed, in this order, by their

  1. scale level,
  2. scale,
  3. x,
  4. y,
  5. z,
  6. tile width,
  7. tile height,
  8. tile row, and
  9. tile column.

Examples:

"/my-data/xy/%5$d/%8$d_%9$d_%1$d.jpg"
CATMAID DefaultTileSource (type 1)
"/my-data/xy/%1$d/%5$d/%8$d/%9$d.jpg"
CATMAID LargeDataTileSource (type 5)
tileWidth
width of image tiles in pixels (int, 256)
tileHeight
height of image tiles in pixels (int, 256)
minZ
first z-section index to be exported (long, 0)
maxZ
last z-section index to be exported (long, long max)
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")

Alternatively, it can be executed by the accompanying Bash-script scale 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:

tileWidth=256
tileHeight=256
minZ=0
tileFormat='/home/me/catmaid/test/xz/%5$d/%8$d_%9$d_%1$d.jpg'
format=jpg
quality=0.85
type=gray