Skip to content

Usage examples

John Bogovic edited this page Feb 19, 2019 · 30 revisions

Prerequisites

  1. Install this repository's code into your Fiji
  2. Install the image transformer script into your Fiji
  3. Download the following for these examples:
  1. Unzip the bridging transformation files, and convert the affine part to a text file with ANTs:
ConvertTransformFile 3 JRC2018F_JFRC2010_GenericAffine.mat JRC2018F_JFRC2010_Affine.mat --hm

Sample data

Some of these examples use sample data that can be downloaded from figshare.

Transforming images

We recommend using the transformImage shell script for transforming images.

Usage: transformImage [-v] [--interpolation=<interpolation>] [-j=<nThreads>]
                    [-s=<outputSize>] -i=<inputFiles> [-i=<inputFiles>]...
                    -o=<outputFiles> [-o=<outputFiles>]...
                    [-r=<outputResolution>[,<outputResolution>...]]...
                    [-t=<transformFiles>]...
      --interpolation=<interpolation>
                             Interpolation {LINEAR, NEAREST, LANCZOS}
  -i, --input=<inputFiles>   Image file to transform
  -j, --nThreads=<nThreads>  Number of rendering threads (default=1)
  -o, --output=<outputFiles> Output file for transformed image
  -r, --output-resolution=<outputResolution>[,<outputResolution>...]
                             The resolution at which to write the output
  -s, --outputImageSize=<outputSize>
                             Size of image output in pixels
  -t, --transform=<transformFiles>
                             Transformation file.
  -v, --version              Prints version information and exits.

Examples

FCWB template to JRC2018F

Uses this sample data.

transformImage -i FCWB_small.nrrd \
    -o fcwb-to-jrc18f.nrrd \
    -f JRC2018_FEMALE_small.nrrd \
    -t JRC2018F_FCWB_small.h5 \
    -j 4

Summary of arguments:

  • -i FCWB_small.nrrd
    • the input image we to transform is the FCWB template
  • -o fcwb-to-jrc18f.nrrd
    • give the name of the output image
  • -f JRC2018_FEMALE_small.nrrd
    • the field-of-view and image resolutions of the output image should be that of the JRC2018F template
  • -t JRC2018F_FCWB_small.h5
    • use the transform mapping JRC2018F to FCWB see here for details on this nomenclature and directions of transforms

Transforming skeletons

We recommend using the transformSwc shell script or the transform_swc fiji script.

Shell script options

You can see a summary of the options by running

$ transformSwc --help
Usage: input parser [options]
  Options:
    -d, --directory
       Directory containing skeletons
    --exclude
       Exclusion pattern: Files matching the given regular expression will be
       ignored. Only relevant when pass a directory
    -h, --help
       Print this help message
       Default: false
    --include
       Matching pattern: Files not matching the given regular expression will be
       ignored.  Only relevant when passing a directory
    -o, --output
       Output skeleton file names. Must have one output for every input
       skeleton, and pass outputfile paths in the same order as the input sketons.
    -s, --skeleton
       Input skeletons. Can pass multiple skeletons
    --suffix
       Suffix applied to output files when passing a directory.
       Default: _transformed
    -t, --transform
       Transforms
Basic usage

Transform an skeleton and write it to an output file

transformSwc -s <swc skeleton file> -o <output file> -t <transform file>

Transform multiple skeletons with the same transforms:

transformSwc \
   -s <swc skeleton file 1> -o <output file 1> \ 
   -s <swc skeleton file 2> -o <output file 2> \
   -t <transform file>

Transform a skeleton with a sequence of transforms (some inverted). In this example the inverse of the third transform is applied:

transformSwc \
   -s <swc skeleton file> -o <output file> \ 
   -t <transform file 1> -t <transform file 2> -t inverse <transform file 3>

Tutorial

FCWB space JRC2018F space
Clone this wiki locally