Skip to content

Commit b0fab33

Browse files
committed
adding simple app to set stack resolution
1 parent 0f29e11 commit b0fab33

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import renderapi
2+
from ..module.render_module import RenderModule, RenderParameters
3+
from argschema.fields import Str, Int, List
4+
5+
example_json = {
6+
"render": {
7+
"host": "ibs-forrestc-ux1",
8+
"port": 8080,
9+
"owner": "Forrest",
10+
"project": "M247514_Rorb_1",
11+
"client_scripts" : "/pipeline/render/render-ws-java-client/src/main/scripts"
12+
},
13+
"stacks": ["BIGALIGN_LENS_DAPI_1_deconvnew"],
14+
"stackResolutionX": 3,
15+
"stackResolutionY": 3,
16+
"stackResolutionZ": 50
17+
}
18+
19+
class SetStackResolutionParameters(RenderParameters):
20+
stacks = List(Str,required=True,
21+
description= 'stack to change resolution of')
22+
stackResolutionX = Int(required=False,
23+
description= 'X stack resolution (nm)')
24+
stackResolutionY = Int(required=False,
25+
description= 'Y stack resolution (nm)')
26+
stackResolutionZ = Int(required=False,
27+
description= 'Z stack resolution (nm)')
28+
29+
class SetStackResolution(RenderModule):
30+
def __init__(self, schema_type=None, *args, **kwargs):
31+
if schema_type is None:
32+
schema_type = SetStackResolutionParameters
33+
super(SetStackResolution, self).__init__(
34+
schema_type=schema_type, *args, **kwargs)
35+
36+
def run(self):
37+
for stack in self.args['stacks']:
38+
39+
stackMetadata = renderapi.stack.get_stack_metadata(
40+
stack, render=self.render)
41+
42+
stackMetadata.stackResolutionX = self.args.get(
43+
'stackResolutionX', stackMetadata.stackResolutionX)
44+
stackMetadata.stackResolutionY = self.args.get(
45+
'stackResolutionY', stackMetadata.stackResolutionY)
46+
stackMetadata.stackResolutionZ = self.args.get(
47+
'stackResolutionZ', stackMetadata.stackResolutionZ)
48+
49+
stackMetadata = renderapi.stack.set_stack_metadata(
50+
stack, stackMetadata, render=self.render)
51+
52+
renderapi.stack.set_stack_state(stack, 'COMPLETE',
53+
render=self.render)
54+
55+
if __name__ == "__main__":
56+
mod = SetStackResolution(input_data=example_json)
57+
mod.run()

0 commit comments

Comments
 (0)