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

Add bigdataserver file

parent d541b89f
No related branches found
No related tags found
1 merge request!2Merge versioning and scripts into master
......@@ -6,7 +6,7 @@ from shutil import copyfile
from scripts.files import make_folder_structure
from scripts.export import export_segmentation
from scripts.files import copy_xml_with_abspath, write_simple_xml
from scripts.files import copy_files_with_pattern
from scripts.files import copy_files_with_pattern, make_bdv_server_file
from scripts.attributes import make_nucleus_tables, make_cell_tables
......@@ -108,6 +108,11 @@ def make_initial_version():
make_tables(folder)
# make the bdv server file
make_bdv_server_file([os.path.join(folder, 'images'),
os.path.join(folder, 'segmentations')],
os.path.join(folder, 'misc', 'bdvserver.txt'))
if __name__ == '__main__':
make_initial_version()
......@@ -2,3 +2,4 @@ from .copy_helper import copy_tables, copy_segmentation, copy_static_files
from .copy_helper import copy_files_with_pattern
from .folders import make_folder_structure
from .xml_utils import get_h5_path_from_xml, copy_xml_with_abspath, write_simple_xml
from .bdv_server import make_bdv_server_file
import os
from .xml_utils import get_h5_path_from_xml
# TODO enable filtering for files by some patter.
# e.g. if we don't want to expose the fib dataset to the public yet
def make_bdv_server_file(folders, out_path):
""" Make the bigserver config file from
all xmls in folders.
"""
file_list = {}
for folder in folders:
files = os.listdir(folders)
for ff in files:
path = os.path.join(folder, ff)
# only add xmls
ext = os.path.splitext(path)[1]
if ext != '.xml':
continue
# make sure that the h5path linked in the xml exists
h5path = get_h5_path_from_xml(path, return_absolute_path=True)
if not os.path.exists(h5path):
msg = 'Path to h5-file in xml does not exist - %s, %s' % (path,
h5path)
return RuntimeError(msg)
name = os.path.splitext(ff)[0]
file_list[name] = path
with open(out_path, 'w') as f:
for name, path in file_list.items():
line = '%s\t%s\n' % (name, path)
f.write(line)
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