Skip to content

Commit

Permalink
#16 fakespm module
Browse files Browse the repository at this point in the history
  • Loading branch information
sapetnioc committed Mar 10, 2022
1 parent fef879a commit c1d4d9c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
8 changes: 5 additions & 3 deletions bv_use_cases/tiny_morphologist/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ def execute(self, context):

class FakeSPMNormalization(Process):
input: field(type_=File, extensions=('.nii',))
template: field(type_=File, extensions=('.nii',))
template: field(type_=File, extensions=('.nii',)) = '!{fakespm.directory}/template'
output: field(type_=File, write=True, extensions=('.nii',))

requirements = {
'fakespm': {
'version': '12'
'version': '8'
}
}

Expand All @@ -45,7 +45,9 @@ def execute(self, context):
real_version = (fakespmdir / 'fakespm').read_text().strip()
with open(self.input) as f:
content = f.read()
content = f'{content}Normalization with fakespm {real_version} installed in {fakespmdir} using template "{self.template}"\n'
with open(self.template) as f:
template = f.read().strip()
content = f'{content}Normalization with fakespm {real_version} installed in {fakespmdir} using template "{template}"\n'
with open(self.output, 'w') as f:
f.write(content)

Expand Down
17 changes: 5 additions & 12 deletions bv_use_cases/tiny_morphologist/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,6 @@
'katrina',
'lyda',
'melite',
'mina',
'odalric',
'rainbow',
'rashn',
'shufen',
'simona',
'svanhildur',
'thilini',
'til',
'vanessza',
'victoria'
Expand Down Expand Up @@ -106,9 +98,6 @@
config = {
'default': {
'label': 'Local computer',
'modules': {}
},
'remote': {
'label': 'triscotte',
'type': 'ssh',
'host': 'triscotte.cea.fr',
Expand All @@ -122,6 +111,8 @@
# Write a file containing only the version string that will be used
# by fakespm module to check installation.
(fakespm / 'fakespm').write_text(version)
# Write a fake template file
(fakespm / 'template').write_text(f'template of fakespm {version}')
fakespm_config = {
'directory': str(fakespm),
'version': version,
Expand Down Expand Up @@ -166,7 +157,7 @@
for t1_mri in input_dataset.find(suffix='T1w'):
# Create a TinyMorphologist pipeline
tiny_morphologist = capsul.executable('bv_use_cases.tiny_morphologist.TinyMorphologist',
normalization='aims')
normalization='fakespm')
# Set the input data
tiny_morphologist.input = t1_mri['path']
# Complete outputs following BraiVISA organization
Expand Down Expand Up @@ -211,6 +202,8 @@
# value = getattr(node, field.name, None)
# print(' ', ('<-' if field.is_output() else '->'), field.name, '=', value)

from pprint import pprint
pprint(processing_pipeline.json())
try:
with capsul.engine() as ce:
# Finally execute all the TinyMorphologist instances
Expand Down

0 comments on commit c1d4d9c

Please sign in to comment.