Skip to content
Snippets Groups Projects
Commit af3f3d65 authored by Constantin Pape's avatar Constantin Pape
Browse files

Update source logic

parent a83a430c
No related branches found
No related tags found
1 merge request!3Refactor sources
[{"modality": "sbem", "stage": "6dpf", "id": "1", "region": "whole"},
{"modality": "prospr", "stage": "6dpf", "id": "1", "region": "whole"},
{"modality": "fibsem", "stage": "6dpf", "id": "1", "region": "parapod"}]
File moved
File moved
#! /g/arendt/pape/miniconda3/envs/platybrowser/bin/python
import argparse
import os
import pandas as pd
......
#! /g/arendt/pape/miniconda3/envs/platybrowser/bin/python
import os
import glob
from scripts.files import get_h5_path_from_xml, copy_xml_with_newpath, write_simple_xml
from shutil import copyfile
from scripts.files import get_h5_path_from_xml, copy_xml_with_newpath, write_simple_xml
def copy_xmls_and_symlink_h5(name_dict, src_folder, trgt_folder):
......
......@@ -2,8 +2,9 @@ import os
import json
from cluster_tools.cluster_tasks import BaseClusterTask
DEFAULT_GROUP = 'kreshuk'
DEFAULT_SHEBANG = '#! /g/arendt/pape/miniconda3/envs/platybrowser/bin/python'
DEFAULT_GROUP = os.environ.get('PLATYBROWSER_GROUP', 'kreshuk')
DEFAULT_SHEBANG = os.environ.get('PLATYBROWSER_SHEBANG',
'#! /g/arendt/pape/miniconda3/envs/platybrowser/bin/python')
DEFAULT_BLOCK_SHAPE = [64, 512, 512]
......
# this folder contains information about the current data sources, see
# https://git.embl.de/tischer/platy-browser-tables/blob/dev/README.md#file-naming
import json
# TODO maybe store this as exteral file in json
# list of the current data sources
SOURCES = [{'modality': 'sbem', 'stage': '6dpf', 'id': '1', 'region': 'whole'},
{'modality': 'prospr', 'stage': '6dpf', 'id': '1', 'region': 'whole'},
{'modality': 'fibsem', 'stage': '6dpf', 'id': '1', 'region': 'parapod'}]
SOURCE_FILE = '../data/sources.json'
SEGMENTATION_FILE = '../data/segmentations.json'
IMAGE_FILE = '../data/images.json'
def get_sources():
return SOURCES
""" Get names of the current data sources.
See https://git.embl.de/tischer/platy-browser-tables/README.md#file-naming
for the source naming conventions.
"""
with open(SOURCE_FILE) as f:
sources = json.load(f)
return sources
def add_source(modality, stage, id=1, region='whole'):
""" Add a new data source
See https://git.embl.de/tischer/platy-browser-tables/README.md#file-naming
for the source naming conventions.
"""
if not isinstance(modality, str):
raise ValueError("Expected modality to be a string, not %s" % type(modality))
if not isinstance(stage, str):
raise ValueError("Expected stage to be a string, not %s" % type(id))
if not isinstance(id, int):
raise ValueError("Expected id to be an integer, not %s" % type(id))
if not isinstance(region, str):
raise ValueError("Expected region to be a string, not %s" % type(id))
sources = get_sources()
sources.append({'modality': modality, 'stage': stage, 'id': str(id), 'region': region})
with open(SOURCE_FILE, 'w') as f:
json.dump(sources, f)
def source_to_prefix(source):
......@@ -20,6 +44,20 @@ def source_to_prefix(source):
def get_name_prefixes():
""" Get the name prefixes corresponding to all sources.
"""
sources = get_sources()
prefixes = [source_to_prefix(source) for source in sources]
return prefixes
def add_image(input_path):
""" Add image volume to the platy browser data.
"""
pass
def add_segmentation():
""" Add segmentation volume to the platy browser data.
"""
pass
#! /g/kreshuk/pape/Work/software/conda/miniconda3/envs/cluster_env37/bin/python
#! /g/arendt/pape/miniconda3/envs/platybrowser/bin/python
import os
import argparse
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment