Skip to content

Commit

Permalink
Merge pull request #14 from magnostherobot/trh/utility-scripts
Browse files Browse the repository at this point in the history
Move to supporting `czinspect` in utility scripts
  • Loading branch information
sysvinit authored Aug 1, 2018
2 parents 5164930 + 13c811a commit 5e237c0
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 31 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ test:
$(MAKE) test -C src/czinspect

bin: all
ln -s ./src/regions/get_region ./bin/get_region
ln -s ./src/czinspect/czinspect ./bin/czinspect
ln -fs ../src/regions/get_region ./bin/get_region
ln -fs ../src/czinspect/czinspect ./bin/czinspect
62 changes: 37 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CZI Extractor ![Build Status](https://travis-ci.com/magnostherobot/zeiss.svg?branch=master)
# CZI Extractor [![Build Status](https://travis-ci.com/magnostherobot/zeiss.svg?token=w7ew2jpnKbReLg9cZxN1&branch=master)](https://travis-ci.com/magnostherobot/zeiss)

Software for extracting images and metadata from Carl Zeiss Images (`.czi`
files). This format is in use in microscopy.
Expand All @@ -8,10 +8,12 @@ data from already-existing `.czi`s.

## Requirements

### `vips`

These tools require [vips](https://github.com/jcupitt/libvips) version 8 or
greater, and uuid development tools.
greater.

### Ubuntu
#### Ubuntu

Xenial Ubuntu and onward can install vips using `apt-get`:
```bash
Expand All @@ -20,42 +22,54 @@ sudo apt-get install libvips-dev
Older versions may be able to
[build from source](https://github.com/jcupitt/libvips/wiki/Build-for-Ubuntu#building-from-source).

Either way, uuid development headers are also required:
```bash
sudo apt-get install uuid-dev
```

### OSX
#### MacOS

Mac users can install dependencies via [`brew`](https://brew.sh/):
Mac users can install `vips` via [`brew`](https://brew.sh/):
```bash
brew install vips --with-imagemagick --without-graphicsmagick --with-openexr --with-openslide
brew install ossp-uuid
```

### Fedora
#### Fedora
```bash
sudo dnf install vips vips-devel uuid-devel
sudo dnf install vips vips-devel
```

### Debian
#### Debian
```bash
sudo apt-get install libvips-dev uuid-dev
sudo apt-get install libvips-dev
```

### `libuuid` Development Headers

The `libuuid` development headers are also required for building.
These can usually be installed using your system package manager, or can be
[built from source](https://github.com/karelzak/util-linux/tree/master/libuuid).

### `JxrDecApp`

Microsoft's JPEG-XR decoding tool `JxrDecApp` is required on the system's
`PATH`. Some operating systems may have a package for this, or it can be
[built from source](https://github.com/curasystems/jxrlib/blob/master/Makefile)
(only `JxrDecApp` is required from this codebase, so all necessary building can
be done using `make JxrDecApp`).

## Building

Building should be as simple as
```bash
make
```
**Note**: due to a conflict in different `ld` implementations, OSX cannot build
this project right now.
**Note**: due to a conflict in different `ld` implementations, MacOS cannot
build this project right now.

Tests are also available:
```bash
make test
```
To move all of the built binaries to the `bin` folder:
```bash
make bin
```

## Running

Expand All @@ -66,20 +80,18 @@ Each of the utility programs can be found in the appropriate `src` subfolder.
Documentation for the use of these utilities is currently non-existant. All
utilities have help-text that should be kept up-to-date:
```bash
./src/extractjxr/extractjxr --help
./src/regions/get_region --help
./src/czinspect/czinspect --help
get_region -h
czinspect -h
```

### Scripts

Some utility scripts have been supplied in the `bin` folder:

- `deczi.sh` is the main script for handling the extraction and conversion of
`.czi` files.
- `batch.sh` is a script designed to batch-process a bunch of `.czi` files at
once.
- `czi2png.sh` and `jxr2png.sh` are old scripts no longer used.
- `czi2png.sh`, `jxr2png.sh`, and `deczi-extracjxr.sh`
are old scripts no longer used.

### Example Use

Expand All @@ -90,7 +102,7 @@ and you want to extract every image tile (converted to `.png`s)
from each of these files into respective subdirectories under the directory
`extracted-tiles`:
```bash
batch.sh -pd "extracted-tiles" "czi-folder"
batch.sh -Ed "extracted-tiles" "czi-folder"
```
Each set of `.png`s will turn up in a subdirectory of `extracted-tiles` named
after the `.czi` file they came from.
Expand All @@ -102,7 +114,7 @@ residing in the directory `all-extracted`, and now you want a `123x789`-sized
region with its top-left corner at x-y coordinate `3030,2929` of the whole
image. Additionally, you want the output to be a `.png`
called `my-region.png`, and the output image
to be a zoom level 8. The appropriate command would be:
to be at zoom level 8. The appropriate command would be:
```bash
get_region -i "all-extracted" -l 3030 -u 2929 -r 3153 -d 3718 -o "my-region.png" -z 8
```
Expand Down
8 changes: 4 additions & 4 deletions bin/batch.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash -x

set -e

Expand Down Expand Up @@ -26,7 +26,7 @@ error () {
outdir=""
opts=""

while getopts "Ehd:aes:" opt; do
while getopts "EShd:f:gaes:" opt; do
case $opt in
d)
outdir="$OPTARG"
Expand All @@ -35,10 +35,10 @@ while getopts "Ehd:aes:" opt; do
usage
exit 0
;;
E|a|e)
E|S|a|e|g)
opts="$opts -$opt"
;;
s)
s|f)
opts="$opts -$opt $OPTARG"
;;
esac
Expand Down

0 comments on commit 5e237c0

Please sign in to comment.