Commit 74af7239 authored by Martin Schorb's avatar Martin Schorb
Browse files

style cleanup

parent fb16b732
Pipeline #32609 passed with stage
in 31 seconds
......@@ -73,11 +73,11 @@ def update_path_dd(filesel, intrig, trig2, inpath, path, show_files, filetypes,
if thispage == '' or thispage not in hf.trigger(key='module') or inpath is None:
raise PreventUpdate
path = inpath
if 'dummy' in trigger:
path = dummydata
path = inpath
if os.path.isdir(str(inpath)):
inpath = inpath
elif os.path.exists(str(inpath)):
......
......@@ -12,7 +12,6 @@ from dash.dependencies import Input, Output, State, MATCH, ALL
from dash.exceptions import PreventUpdate
import requests
import json
from app import app
......@@ -76,6 +75,8 @@ def update_mc_owner_dd(init_in, new_owner, thispage, dd_own_in):
new_owner = checks.clean_render_name(new_owner)
dd_options.append({'label': new_owner, 'value': new_owner})
mc_owner = new_owner
else:
raise PreventUpdate
return dd_options, mc_owner
......@@ -152,6 +153,8 @@ def pointmatch_mcown_dd_sel(mc_own_sel, new_mc, mc_dd_opt, init_match, thispage,
mc_dd_opt.append({'label': new_mc, 'value': new_mc})
mc_dd_val = new_mc
mc_style = {'display': 'flex'}
else:
raise PreventUpdate
return div1style, mc_dd_opt, mc_dd_val, mc_style, all_mcs
......
......@@ -247,7 +247,8 @@ def update_stack_dd(init_store, own_sel, proj_sel, newstack_in, store_stack, dd_
else:
href_out = params.render_base_url + 'view/stacks.html?renderStackOwner=' + own_sel + '&renderStackProject=' + proj_sel
href_out = params.render_base_url + 'view/stacks.html?renderStackOwner=' + own_sel \
+ '&renderStackProject=' + proj_sel
# get list of projects on render server
url = params.render_base_url + params.render_version + 'owner/' + own_sel + '/project/' + proj_sel + '/stacks'
......
......@@ -12,8 +12,7 @@ from dash.dependencies import Input, Output, State, MATCH, ALL
from dash.exceptions import PreventUpdate
import requests
import os
import json
import plotly.express as px
from skimage import io
import re
......@@ -118,7 +117,8 @@ for idx in range(params.max_tileviews):
if o_min == o_max:
slicestyle = {'display': 'none'}
url = params.render_base_url + params.render_version + 'owner/' + owner + '/project/' + project + '/stack/' + stack_sel
url = params.render_base_url + params.render_version + 'owner/' + owner + '/project/' + project \
+ '/stack/' + stack_sel
url1 = url + '/tileIds'
tile = requests.get(url1).json()[0]
......@@ -135,7 +135,6 @@ for idx in range(params.max_tileviews):
else:
raise PreventUpdate
# init tile selector
@app.callback([Output({'component': 'tile_dd' + idx_str, 'module': MATCH}, 'options'),
Output({'component': 'tile_dd' + idx_str, 'module': MATCH}, 'value')],
......@@ -165,7 +164,8 @@ for idx in range(params.max_tileviews):
trigger = hf.trigger()
tileim_index = trigger.split('_')[-1]
url = params.render_base_url + params.render_version + 'owner/' + owner + '/project/' + project + '/stack/' + stack
url = params.render_base_url + params.render_version + 'owner/' + owner + '/project/' + project \
+ '/stack/' + stack
url += '/tileIds?matchPattern='
if owner in params.slicenumformat.keys():
......@@ -261,7 +261,8 @@ for idx in range(params.max_tileviews):
if 'None' in (owner, project, stack):
raise PreventUpdate
url = params.render_base_url + params.render_version + 'owner/' + owner + '/project/' + project + '/stack/' + stack
url = params.render_base_url + params.render_version + 'owner/' + owner + '/project/' + project \
+ '/stack/' + stack
url += '/tile/' + tile
url1 = url + '/render-parameters'
......@@ -354,7 +355,8 @@ for idx in range(params.max_tileviews):
scale = imparams['scale']
url = params.render_base_url + params.render_version + 'owner/' + owner + '/project/' + project + '/stack/' + stack
url = params.render_base_url + params.render_version + 'owner/' + owner + '/project/' + project \
+ '/stack/' + stack
url += '/z/' + str(section)
......
......@@ -13,14 +13,14 @@ from dash.exceptions import PreventUpdate
import importlib
import params
# import params
from app import app
from utils import pages
# from utils import pages
from utils import helper_functions as hf
from callbacks import runstate, render_selector
from inputtypes import sbem_conv, serialem_conv
# from inputtypes import sbem_conv, serialem_conv
module = 'convert'
......
......@@ -134,10 +134,10 @@ def export_stacktodir(dir_trigger, trig2, stack_sel, owner, project, allstacks,
if 'None' in (stackparams['stackId']['owner'], stackparams['stackId']['project']):
return dash.no_update
url = params.render_base_url + params.render_version + 'owner/' + owner + '/project/' + project + '/stack/' + stack + '/z/' + str(
int(
(stacklist[0]['stats']['stackBounds']['maxZ'] - stacklist[0]['stats']['stackBounds'][
'minZ']) / 2)) + '/render-parameters'
url = params.render_base_url + params.render_version + 'owner/' + owner + '/project/' + project \
+ '/stack/' + stack + '/z/' + str(int(
(stacklist[0]['stats']['stackBounds']['maxZ'] - stacklist[0]['stats']['stackBounds']['minZ']) / 2))\
+ '/render-parameters'
tiles0 = requests.get(url).json()
......
......@@ -18,7 +18,6 @@ import numpy as np
import os
import json
import requests
import importlib
from app import app
import params
......
......@@ -186,12 +186,12 @@ def n5export_stacktoparams( # stack_sel,
out['zmax'] = zmax
out['numsections'] = zmax - zmin + 1
url = params.render_base_url + params.render_version + 'owner/' + owner + '/project/' + project + '/stack/' + stack + '/z/' + str(
out['zmin']) + '/render-parameters'
url = params.render_base_url + params.render_version + 'owner/' + owner + '/project/' + project \
+ '/stack/' + stack + '/z/' + str(out['zmin']) + '/render-parameters'
tiles0 = requests.get(url).json()
tilefile0 = os.path.abspath(tiles0['tileSpecs'][0]['mipmapLevels']['0']['imageUrl'].strip('file:'))
# tiles0 = requests.get(url).json()
#
# tilefile0 = os.path.abspath(tiles0['tileSpecs'][0]['mipmapLevels']['0']['imageUrl'].strip('file:'))
#
# basedirsep = params.datasubdirs[owner]
# dir_out = tilefile0[:tilefile0.find(basedirsep)]
......@@ -340,7 +340,8 @@ def n5export_execute_gobutton(click, outdir, stack, n_cpu, timelim, comp_sel, ow
# get tile size from single tile
url = params.render_base_url + params.render_version + 'owner/' + owner + '/project/' + project + '/stack/' + stack
url = params.render_base_url + params.render_version + 'owner/' + owner + '/project/' + project \
+ '/stack/' + stack
url += '/z/' + str(slice_in) + '/tile-specs'
tilespecs = requests.get(url).json()
......
......@@ -17,7 +17,6 @@ import numpy as np
import os
import json
import requests
import importlib
from app import app
import params
......@@ -229,11 +228,11 @@ def slice_export_stacktoparams( # stack_sel,
out['zmax'] = zmax
out['numsections'] = zmax - zmin + 1
url = params.render_base_url + params.render_version + 'owner/' + owner + '/project/' + project + '/stack/' + stack + '/z/' + str(
out['zmin']) + '/render-parameters'
tiles0 = requests.get(url).json()
url = params.render_base_url + params.render_version + 'owner/' + owner + '/project/' + project \
+ '/stack/' + stack + '/z/' + str(out['zmin']) + '/render-parameters'
# tiles0 = requests.get(url).json()
#
# tilefile0 = os.path.abspath(tiles0['tileSpecs'][0]['mipmapLevels']['0']['imageUrl'].strip('file:'))
#
# basedirsep = params.datasubdirs[owner]
......@@ -246,7 +245,7 @@ def slice_export_stacktoparams( # stack_sel,
t_fields = [stack,
str(out['numsections']),
'%0.2f' % int(out['Gigapixels']),
' x '.join(map(str,out['output dimensions'])) + ' px']
' x '.join(map(str, out['output dimensions'])) + ' px']
timelim = np.ceil(
out['Gigapixels'] * float(scale) * params.export['min/GPix/CPU_slice'] / params.n_cpu_script * (
......
......@@ -20,7 +20,7 @@ from utils import helper_functions as hf
from callbacks import runstate, render_selector
from filetypes import BDV_finalize, MoBIE_finalize
# from filetypes import BDV_finalize, MoBIE_finalize
module = 'finalize'
previous = 'export'
......
......@@ -200,7 +200,8 @@ def sbem_conv_gobutton(stack_sel, in_dir, click, proj_dd_sel, compute_sel, run_s
# -----------------------
sbem_conv_p = launch_jobs.run(target=compute_sel,
pyscript=params.rendermodules_dir + '/dataimport/generate_EM_tilespecs_from_SBEMImage.py',
pyscript=params.rendermodules_dir +
'/dataimport/generate_EM_tilespecs_from_SBEMImage.py',
jsonfile=param_file, run_args=None, logfile=log_file, errfile=err_file)
run_state['status'] = 'running'
......
......@@ -196,7 +196,8 @@ def serialem_conv_gobutton(stack_sel, in_dir, click, proj_dd_sel, compute_sel, r
# -----------------------
sbem_conv_p = launch_jobs.run(target=compute_sel,
pyscript=params.rendermodules_dir + '/dataimport/generate_EM_tilespecs_from_SerialEMmontage.py',
pyscript=params.rendermodules_dir +
'/dataimport/generate_EM_tilespecs_from_SerialEMmontage.py',
jsonfile=param_file, run_args=None, logfile=log_file, errfile=err_file)
run_state['status'] = 'running'
......
......@@ -98,10 +98,11 @@ compute_settings = html.Details(children=[html.Summary('Compute settings:'),
], className='table'),
html.Br(),
html.Table([html.Tr([html.Th(col) for col in compute_table_cols]),
html.Tr([html.Td(
dcc.Input(id={'component': 'input_' + col, 'module': module},
type='number', min=1)) for col in
compute_table_cols])
html.Tr([
html.Td(
dcc.Input(id={'component': 'input_' + col, 'module': module},
type='number', min=1))
for col in compute_table_cols])
], className='table'),
dcc.Store(id={'component': 'store_compset', 'module': module})
])
......@@ -180,8 +181,8 @@ def mipmaps_stacktodir(stack_sel, owner, project, stack, allstacks, thispage):
num_blocks = int(np.max((np.floor(out['numsections'] / params.section_split), 1)))
url = params.render_base_url + params.render_version + 'owner/' + owner + '/project/' + project + '/stack/' + stack + '/z/' + str(
out['zmin']) + '/render-parameters'
url = params.render_base_url + params.render_version + 'owner/' + owner + '/project/' + project \
+ '/stack/' + stack + '/z/' + str(out['zmin']) + '/render-parameters'
tiles0 = requests.get(url).json()
tilefile0 = os.path.abspath(tiles0['tileSpecs'][0]['mipmapLevels']['0']['imageUrl'].strip('file:'))
......@@ -326,6 +327,7 @@ def mipmaps_gobutton(mipmapdir, click, click2, run_state, comp_sel, runstep_in,
sec_start = stackparams['zmin']
sliceblock_idx = 0
sec_end = sec_start
run_prefix = launch_jobs.run_prefix()
while sec_end <= stackparams['zmax']:
sec_end = int(np.min([sec_start + comp_set['input_section_split'], stackparams['zmax']]))
......@@ -333,16 +335,16 @@ def mipmaps_gobutton(mipmapdir, click, click2, run_state, comp_sel, runstep_in,
run_params_generate['zend'] = sec_end
run_params_generate['output_json'] = os.path.join(params.json_run_dir,
'output_' + module + '_' + params.run_prefix + '_' + str(
'output_' + module + '_' + run_prefix + '_' + str(
sliceblock_idx) + '.json')
param_file = params.json_run_dir + '/' + runstep + '_' + module + params.run_prefix + '_' + str(
param_file = params.json_run_dir + '/' + runstep + '_' + module + run_prefix + '_' + str(
sliceblock_idx) + '.json'
with open(param_file, 'w') as f:
json.dump(run_params_generate, f, indent=4)
log_file = params.render_log_dir + '/' + runstep + '_' + module + '_' + params.run_prefix + '_' + str(
log_file = params.render_log_dir + '/' + runstep + '_' + module + '_' + run_prefix + '_' + str(
sliceblock_idx)
err_file = log_file + '.err'
log_file += '.log'
......@@ -368,7 +370,7 @@ def mipmaps_gobutton(mipmapdir, click, click2, run_state, comp_sel, runstep_in,
mipmap_generate_p = launch_jobs.run(target=comp_sel,
pyscript=params.asap_dir + '/dataimport/generate_mipmaps.py',
json=param_file, run_args=None, target_args=target_args,
jsonfile=param_file, run_args=[], target_args=target_args,
logfile=log_file, errfile=err_file)
launch_store = dict()
......@@ -403,12 +405,13 @@ def mipmaps_gobutton(mipmapdir, click, click2, run_state, comp_sel, runstep_in,
with open(os.path.join(params.json_template_dir, 'apply_mipmaps.json'), 'r') as f:
run_params_generate.update(json.load(f))
# run_params_generate['output_json'] = os.path.join(params.json_run_dir,'output_' + module + params.run_prefix + '.json' )
# run_params_generate['output_json'] = os.path.join(params.json_run_dir, 'output_' + module
# + params.run_prefix + '.json')
run_params_generate["input_stack"] = stack
run_params_generate["output_stack"] = stack + "_mipmaps"
run_params_generate["mipmap_prefix"] = "file://" + mipmapdir
param_file = params.json_run_dir + '/' + runstep + '_' + module + '_' + params.run_prefix + '.json'
param_file = params.json_run_dir + '/' + runstep + '_' + module + '_' + run_prefix + '.json'
run_params_generate["zstart"] = stackparams['zmin']
run_params_generate["zend"] = stackparams['zmax']
run_params_generate["pool_size"] = params.n_cpu_script
......@@ -416,13 +419,13 @@ def mipmaps_gobutton(mipmapdir, click, click2, run_state, comp_sel, runstep_in,
with open(param_file, 'w') as f:
json.dump(run_params_generate, f, indent=4)
log_file = params.render_log_dir + '/' + runstep + '_' + module + '_' + params.run_prefix
log_file = params.render_log_dir + '/' + runstep + '_' + module + '_' + run_prefix
err_file = log_file + '.err'
log_file += '.log'
mipmap_apply_p = launch_jobs.run(target=comp_sel,
pyscript=params.asap_dir + '/dataimport/apply_mipmaps_to_render.py',
jsonfile=param_file, run_args=None, logfile=log_file, errfile=err_file)
jsonfile=param_file, run_args=[], logfile=log_file, errfile=err_file)
launch_store = dict()
launch_store['logfile'] = log_file
......
......@@ -15,7 +15,6 @@ from dash.dependencies import Input, Output, State
import os
import glob
import json
import importlib
from app import app
import params
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment