Skip to content

Instantly share code, notes, and snippets.

@emilroz
Created April 18, 2018 10:39
Show Gist options
  • Save emilroz/9956daab41405b8b27b0ef1510893160 to your computer and use it in GitHub Desktop.
Save emilroz/9956daab41405b8b27b0ef1510893160 to your computer and use it in GitHub Desktop.
#!/bin/bash
# ./parade.test number_of_datasets number_of_images /ouput/directory /where/is/your/OMERO -s omero.server.address -u user.name -w password
NUMBER_OF_DATASETS=$1
NUMBER_OF_IMAGES=$2
OUTPUT_DIR=$3
OMERO_HOME=$4
OMERO_ARGUMENTS="${@:5}"
PROJECT_NAME="Parade.Test"
DATASET_PREFIX="Dataset_"
IMAGE_PREFIX="Image_"
IMAGE_SETTINGS="pixelType=uint8&sizeX=1280&sizeY=1280"
OMERO="${OMERO_HOME}/bin/omero"
${OMERO} login ${OMERO_ARGUMENTS}
OMERO_PROJECT_ID=$( \
${OMERO} ${OMERO_ARGUMENTS} \
obj new Project "name=${PROJECT_NAME}" \
| cut -d ':' -f 2)
echo "Created ${PROJECT_NAME}:${OMERO_PROJECT_ID}"
for i in $(seq 1 ${NUMBER_OF_DATASETS});
do
DATASET_NAME="${DATASET_PREFIX}$i"
echo "Creating ${DATASET_NAME}"
# create dataset
OMERO_DATASET_ID=$( \
${OMERO} ${OMERO_ARGUMENTS} \
obj new Dataset "name=${DATASET_NAME}" \
| cut -d ':' -f 2)
# link dataset to project
${OMERO} ${OMERO_ARGUMENTS} \
obj new ProjectDatasetLink \
parent=Project:${OMERO_PROJECT_ID} child=Dataset:${OMERO_DATASET_ID}
# create dataset dir
DATASET_PATH="${OUTPUT_DIR}/${DATASET_NAME}"
mkdir ${DATASET_PATH}
for j in $(seq 1 ${NUMBER_OF_IMAGES});
do
IMAGE_NAME="${IMAGE_PREFIX}$i.$j&${IMAGE_SETTINGS}.fake"
echo " Creating ${IMAGE_NAME}"
IMAGE_PATH="${DATASET_PATH}/${IMAGE_NAME}"
touch ${IMAGE_PATH}
done
${OMERO} ${OMERO_ARGUMENTS} import -d ${OMERO_DATASET_ID} ${DATASET_PATH}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment