Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

swh:1:snp:e6d42e6731ce66e3c09de07ac49964c03139e990
  • Code
  • Branches (11)
  • Releases (5)
    • Branches
    • Releases
    • HEAD
    • refs/heads/T2
    • refs/heads/develop
    • refs/heads/developCI
    • refs/heads/developCI2
    • refs/heads/developCI3
    • refs/heads/gh-pages
    • refs/heads/master
    • refs/heads/newBuild
    • refs/tags/v0.1
    • refs/tags/v0.11
    • refs/tags/v0.4
    • v0.4.3
    • v0.4.2
    • v0.4.1
    • v0.3
    • v0.2
  • 748d2e1
  • /
  • scriptsPython
  • /
  • tomatoPython.py
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
  • release
content badge
swh:1:cnt:72a17770f688d031a8dcc2560a2e5d5b22889b1e
directory badge
swh:1:dir:941e3303733609725c19092785f6fedead7c0651
revision badge
swh:1:rev:1f34654a48053d4e8cd7068fa1dda7e529e9ff71
snapshot badge
swh:1:snp:e6d42e6731ce66e3c09de07ac49964c03139e990
release badge
swh:1:rel:5455ba6f2c09cc9a228d5ccca6f6f90d75a461df

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
  • release
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: 1f34654a48053d4e8cd7068fa1dda7e529e9ff71 authored by Konrad Werys on 26 October 2019, 17:46:45 UTC
ci: cleanup
Tip revision: 1f34654
tomatoPython.py
"""
    To use tomato you need two things:
    1. tomato executable
    2. configuration file in yaml.
      a. import yaml
      b. the best way to start with the config files is to read a template yaml file
      c. define/modify parameters in the structure
      d. save structure to a yaml file
    Then, using python 'os.system' command you can run tomato from python. Voila!

    Hint: look at the output of the tomato executable to see what options are available in the yaml config file

    Konrad Werys 2018
    konrad.werys@cardiov.ox.ac.uk
"""

import os
from ruamel.yaml import YAML # 2.a.

if __name__ == '__main__':

    # ### 1 what is the path to the tomato exacutable?
    # exepath = 'TomatoExe_v0.1_Windows_x64.exe'  # downloaded from github on windows
    exepath = '../cmake-build-release/TomatoExe'  # build from clion on macos

    # ### 2.b. the best way to start with the config files is to read a template yaml file and modify it (2.c.)
    template_yaml_file = '../tests/testData/Hcmr_Phantom_1916_Shmolli_192i_e11_inputDirs.yaml'
    # template_yaml_file = '../tests/testData/Hcmr_Phantom_1916_Shmolli_192i_e11_fileList.yaml'

    with open(template_yaml_file, 'r') as myfile:
        yaml_data = myfile.read()
    yaml = YAML()
    yaml_dict = yaml.load(yaml_data)

    # ### 2.c. define/modify params in the structure. Input params are obligatory for calculation, the rest are optional
    
    # ## input params ##
    yaml_dict['files_magnitude'] = ''
    yaml_dict['files_phase'] = ''
    yaml_dict['dir_magnitude'] = '../tests/testData/dicom/Hcmr_Phantom_1916_260C/Konrad_Shmolli/ShMOLLI_192i_e11_12'
    yaml_dict['dir_phase'] = '../tests/testData/dicom/Hcmr_Phantom_1916_260C/Konrad_Shmolli/ShMOLLI_192i_e11_13'

    # ## output params ##
    # yaml_dict['dir_output_map'] = 'map'
    # yaml_dict['dir_output_fitparams'] = 'fitparams'
    # yaml_dict['output_map_series_number'] = 9998
    # yaml_dict['output_fitparams_series_number'] = 9999

    # ## calculation params ##
    # yaml_dict['parameter_to_map'] = 'T1_MOLLI'
    # yaml_dict['fitting_method'] = 'LevMarVnl'
    # yaml_dict['functions_type'] = 'FunctionsBasic'
    # yaml_dict['sign_calc_method'] = 'NoSign'
    # yaml_dict['start_point_calc_method'] = 'Default'
    # yaml_dict['fTolerance'] = 1.0E-12
    # yaml_dict['max_function_evals'] = 4000
    # yaml_dict['use_gradient'] = 0
    # yaml_dict['mean_cut_off'] = 10
    # yaml_dict['number_of_threads'] = 0

    # $$$ 2.d. save structure to a yaml file
    my_yaml_file = './my_yaml_file.yaml'
    with open(my_yaml_file, 'w') as myfile:
        yaml.dump(yaml_dict, myfile)

    os.system(exepath + ' ' + my_yaml_file)

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API