Once Zegami has been installed a collection of images can be made by using the Command Line Interface or CLI for short.

The CLI can be accessed by opening up the terminal or command prompt and running the following command:

$ sudo su zegami
$ cd /opt/zegami
$ python bin/zegami.pyc

Zegami CLI

Collection Creation

The collection we are going to create in this tutorial is of Xenopus embryo (a type of frog used in research) at different stages of life cycle (STAGE). These have had certain genes (TARGET GENE) that are shown to be expressed in the embryo which highlighted by the dark staining. CONCENTRATION is concentration of morpholino which is used to modify the gene expression.

The example source data and configuration files can be downloaded from here (~3 Mb). These images have kindly been donated from Roger Patient’s lab in Oxford (http://www.imm.ox.ac.uk/roger-patient). Download and extract these files to a location that can be accessed by Zegami. For Linux extract them to /zegami/data-source/xenopus. For Windows extract them to C:\zegami\data-source\xenopus.

Processing a Collection using Zegami CLI

Once the tutorial files have been downloaded and extracted the Xenopus collection can be processed. If the files were extracted to a location other than the recommended locations listed above then the locations in both the datasource.conf and imagesource.conf will need to be updated. If you have a problem processing a collection please ensure to include the contents of these files in any support request.


This file contains the details about the location of the images. It uses the imagesPath value to retrieve the images. The path is also dynamic, meaning that it is data bound to the corresponding row in the data source.

For example if the data source has a column called path which contains values like "image001.jpg", "image002.jpg" and "image003.jpg"... the value of the path column can be included in the path string by enclosing it in double {{ and }}, like so: {{path}}.

The structure of the file is as follows, with comments.

# The location of the source images (will require a different path for windows)


This file contains the details about the location and structure of the metadata. The structure of the file is as follows, with comments.

# The location of the tab or csv file for the metadata (will require a different path for windows)
# the id column, this should be an incremental integer
# the delimiter for the columns eg , or \t (tab)


For Linix open a terminal and run the following command:

$ sudo su zegami
$ cd /opt/zegami
$ python bin/zegami.pyc  collections create xenopus /zegami/data-source/xenopus/datasource.conf /zegami/data-source/xenopus/imagesource.conf

For Windows open the command prompt and navigate to C:\Program Files (x86)\Zegami and run the following command:

python "C:\Program Files (x86)\Zegami\zegami.pyc" collections create xenopus C:\zegami\data-source\xenopus\datasource.conf C:\zegami\data-source\xenopus\imagesource.conf

The collection will now be created and processing will commence. Once completed the collection details will be displayed:

====== Creating Collection ======

Name: xenopus
Url: /xenopus
ID: 57b1e0df2cff4d7d24178b93
Total Items: 324
Last Processed: 2016-08-15 16:33:57.275680
Data Source URL: /api/collections/57b1e0df2cff4d7d24178b93/datasource.tsv
Deep Zoom URL:   /api/collections/57b1e0df2cff4d7d24178b93/dz/57b1e0df2cff4d7d24178b94/collection.json
Snapshot URL:/api/collections/57b1e0df2cff4d7d24178b93

For more details on using Zegami CLI see our detailed guide of all the commands.

Hosting the collection

Once the collection has finished processing a HTML page needs to be created in order to host Zegami. When Zegami is first installed a demo.html file is created in the /zegami/html directory which we can use as an base for other collections. The NGINX web server is set up to look in this folder for new collections.

Run the following to copy the example index.html into the /zegami/html directory.

cp /opt/zegami/examples/index.html /zegami/html/xenopus.html

Copy the ID value and open the /zegami/html/xenopus.html in a text editor. Set the collection Id properties ('57b1e0df2cff4d7d24178b93' in the example above) by replacing the collection id from the copied collection highlighted in red. Then update the tileManagers url property by replacing the Deep Zoom id highlighted in blue with the Deep Zoom URL id (57b1e0df2cff4d7d24178b94 in the example above) and save the file.

title: 'xenopus',
collectionId: '57b1e0df2cff4d7d24178b93',
loader: {type: 'TabData', options: {
id: 'id',
url: 'api/collections/57b1e0df2cff4d7d24178b93/datasource.tsv',
tileManagers: {
'dz': {type: 'DeepZoom', options: {sources: [
name: 'main',
sourceId: '57b1e0df2cff4d7d24178b94',
url: '/api/collections/57b1e0df2cff4d7d24178b93/dz/57b1e0df2cff4d7d24178b94/collection.json'
views: [
{name: 'grid', type: 'Grid', options: {icon: 'fa-th', tileManager: 'dz'}},
{name: 'graph', type: 'Graph', options: {icon: 'fa-bar-chart', tileManager: 'dz'}},
{name: 'table', type: 'Table', options: {icon: 'fa-th', tileManager: 'dz'}}
facetTypes: { string: { itemLimit: 50 } },
scaleMode: 'nearest',
colors: { primary: '#006CC2', primaryDark: '#00508f' },
toolbar: [
{type: 'snapshot', url: '/api/collections/57b1e0df2cff4d7d24178b93'},

You can now access the collection at http://localhost/xenopus.html. Please note, do not create a file called index.html as this will break the index page.

Congratulations, you have successfully created a collection in Zegami! If not please review the instructions above again but if you are really stuck email help@zegami.com with details on the problem including operating system and any error messages you receive.