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

https://github.com/ElsevierSoftwareX/SOFTX_2019_219
07 July 2024, 10:26:45 UTC
  • Code
  • Branches (11)
  • Releases (5)
  • Visits
    • 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
  • 1c75839
  • /
  • scriptsPython
  • /
  • tomatoPython.py
Raw File Download
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

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
origin badgecontent badge Iframe embedding
swh:1:cnt:48c717468747e27a98d51a71e2782f8512531453
origin badgedirectory badge Iframe embedding
swh:1:dir:2558fb93c1d7a67134309812afe28223e0467c51
origin badgerevision badge
swh:1:rev:99932db9e71d31a76425d68eef7d5859523ca0e4
origin badgesnapshot badge
swh:1:snp:e6d42e6731ce66e3c09de07ac49964c03139e990

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
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: 99932db9e71d31a76425d68eef7d5859523ca0e4 authored by Konrad Werys on 04 November 2019, 09:33:32 UTC
doc: changes in the documentation
Tip revision: 99932db
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–2025, 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