Script for loading Murphy lab image collections into OMERO.servers.
- Install homebrew.
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Tap the OMERO homebrew tap.
$ brew tap ome/alt
- Install python through homebrew. This python will be located in
/usr/local/bin/
.
$ brew install python
- Install OMERO's version of Ice through homebrew with python bindings.
$ brew install zeroc-ice35 --with-python
- Install numpy (this must be installed first, at least before javabridge).
$ /usr/local/bin/pip install numpy
- Install the rest of the required python packages: Pillow, javabridge, and python-bioformats.
$ /usr/local/bin/pip install Pillow javabridge python-bioformats
- Download and unzip OMERO.py (link might not be latest version).
Before running any of the scripts, you need to set your PYTHONPATH
environment variable to know about OMERO.py:
$ export PYTHONPATH=$PYTHONPATH:/path/to/OMERO.py/lib/python
Then, you can run any of the scripts using the homebrew python:
$ /usr/local/bin/python /path/to/script <arg> ...
Make sure the OMERO_ROOT
variable is set to the url of the right OMERO server (defaults to MurphyLab's OMERO server).
$ python sample_synthetic_images.py -h
usage: sample_synthetic_images.py [-h] [--dimensionality DIMENSIONALITY]
[--cell-line CELL_LINE]
[--downsampling-factor DOWNSAMPLING_FACTOR]
[--number-of-images NUMBER_OF_IMAGES]
[--channel0-model-class CHANNEL0_MODEL_CLASS]
[--channel0-model-type CHANNEL0_MODEL_TYPE]
[--channel1-model-class CHANNEL1_MODEL_CLASS]
[--channel1-model-type CHANNEL1_MODEL_TYPE]
[--channel2-model-class CHANNEL2_MODEL_CLASS]
[--channel2-model-type CHANNEL2_MODEL_TYPE]
[--output-dir OUTPUT_DIR]
Download synthetic images from an OMERO server
optional arguments:
-h, --help show this help message and exit
--dimensionality DIMENSIONALITY
2D or 3D (default: 2D)
--cell-line CELL_LINE
type of cell line (default: HeLa)
--downsampling-factor DOWNSAMPLING_FACTOR
amount to downsample the images by using bicubic
interpolation (default: None)
--number-of-images NUMBER_OF_IMAGES
number of images to download (default: 1)
--channel0-model-class CHANNEL0_MODEL_CLASS
model class for channel 0 (e.g. framework) (default:
None)
--channel0-model-type CHANNEL0_MODEL_TYPE
model type for channel 0 (e.g. cylindrical,
diffeomorphic) (default: None)
--channel1-model-class CHANNEL1_MODEL_CLASS
model class for channel 1 (e.g. framework) (default:
None)
--channel1-model-type CHANNEL1_MODEL_TYPE
model type for channel 1 (e.g. ratio, diffeomorphic)
(default: None)
--channel2-model-class CHANNEL2_MODEL_CLASS
model class for channel 2 (e.g. vesicles, microtubule)
(default: None)
--channel2-model-type CHANNEL2_MODEL_TYPE
model type for channel 2 (e.g. gmm, network) (default:
None)
--output-dir OUTPUT_DIR
directory to save the images in (default: .)
If downsampling is requested, the image is resized using bicubic interpolation to the nearest size that would result in downsampling less than or equal to the amount requested in each axis. For example, an 11x14 image with requested downsampling of 2 would be resized to 6x7, with a downsampling factor of 1.83 in the x dimension and 2 in the y dimension.
Metadata such as resolution and PhysicalSize attributes are updated appropriately. In addition, metadata containing the details of the downsampling requested and performed is stored in the OME XML embedded metadata. Under the StructureAnnotations element, the following DoubleAnnotation elements are stored (with corresponding Description and Value sub-elements):
ID | Description |
---|---|
Annotation:RequestedDownsamplingFactor | downsampling factor requested |
Annotation:XDownsamplingFactor | downsampling factor performed in the x dimension |
Annotation:YDownsamplingFactor | downsampling factor performed in the y dimension |
Annotation:OriginalPhysicalSizeX | original length of a pixel in the x dimension before downsampling (see the PhysicalSizeX attribute of the Pixels element) |
Annotation:OriginalPhysicalSizeY | original length of a pixel in the y dimension before downsampling (see the PhysicalSizeY attribute of the Pixels element) |
Example OME XML might look like:
<OME ...>
<Image ...>
...
</Image>
<StructuredAnnotations>
...
<DoubleAnnotation ID="Annotation:RequestedDownsamplingFactor">
<Description>This element contains the requested downsampling factor the client passed to the OMERO server.</Description>
<Value>1.05</Value>
</DoubleAnnotation>
<DoubleAnnotation ID="Annotation:XDownsamplingFactor">
<Description>This is the amount by which the x dimension of the image was downsampled by the OMERO server.</Description>
<Value>1.0375</Value>
</DoubleAnnotation>
<DoubleAnnotation ID="Annotation:YDownsamplingFactor">
<Description>This is the amount by which the y dimension of the image was downsampled by the OMERO server.</Description>
<Value>1.03448275862</Value>
</DoubleAnnotation>
<DoubleAnnotation ID="Annotation:OriginalPhysicalSizeX">
<Description>This is the PhysicalSizeX attribute of the Pixels object before the downsampling was performed on the image.</Description>
<Value>0.049</Value>
</DoubleAnnotation>
<DoubleAnnotation ID="Annotation:OriginalPhysicalSizeY">
<Description>This is the PhysicalSizeY attribute of the Pixels object before the downsampling was performed on the image.</Description>
<Value>0.049</Value>
</DoubleAnnotation>
</StructuredAnnotations>
</OME>
- On the OMERO server, install the needed dependencies.
$ sudo apt-get install python-lxml
$ sudo pip install tifffile
- Make a new webapps directory in the home directory (for example).
$ mkdir ~/webapps
- Add this directory to your PYTHONPATH on login by adding the following line to your
~/.profile
(in this case, the user is named 'omero').
export PYTHONPATH=$PYTHONPATH:/home/omero/webapps
- Source
~/.profile
so the changes take effect in the current session.
$ source ~/.profile
- Move the syntheticsampler directory into the newly created webapps directory.
$ mv /path/to/syntheticsampler/ ~/webapps/
- In
syntheticsampler/views.py
, update theSYNTHETIC_DATASETS
variable according to the instructions in the file. - Tell OMERO about the webapp.
$ omero config append omero.web.apps '"syntheticsampler"'
- Restart the OMERO web server.
$ omero web restart