diff --git a/bin/annotation b/bin/annotation deleted file mode 100755 index b2bf778161e66bd718a48b63caefc6a98a2e62b3..0000000000000000000000000000000000000000 --- a/bin/annotation +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env python - -import os -import sys -from os.path import dirname, abspath, join, basename -import argparse - -parser = argparse.ArgumentParser(description='Annotate a tomogram.') -parser.add_argument('-t', action='store', dest='path_tomo', help = 'path to tomogram') -parser.add_argument('-o', action='store', dest='path_objl', help = 'output path for object list') -args = parser.parse_args() - -# Set deepfindHome to the location of this file -deepfindHome = dirname(abspath(__file__)) -deepfindHome = os.path.split(deepfindHome)[0]+'/' - -gui_folder = 'pyqt/annotation/' -gui_script = 'gui_annotation.py' - -gui_options = '' -if args.path_tomo != None: - gui_options += ' -t ' + args.path_tomo -if args.path_objl != None: - gui_options += ' -o ' + args.path_objl - -cmd = 'cd ' + deepfindHome + gui_folder + ' ; python ' + gui_script + gui_options - -os.system(cmd) \ No newline at end of file diff --git a/deepfinder/utils/common.py b/deepfinder/utils/common.py index 8f947fcdeb07ac9146e8b63fe4ea64baa14aa355..a0f359a3e5aef96db0c9eda477e7ddfc14fcaf8d 100644 --- a/deepfinder/utils/common.py +++ b/deepfinder/utils/common.py @@ -132,7 +132,7 @@ def read_array(filename, dset_name='dataset'): data_format = os.path.splitext(filename) if data_format[1] == '.h5': array = read_h5array(filename, dset_name) - elif data_format[1] == '.mrc' or data_format[1] == '.map': + elif data_format[1] == '.mrc' or data_format[1] == '.map' or data_format[1] == '.rec': array = read_mrc(filename) else: print('/!\ DeepFinder can only read datasets in .h5 and .mrc formats') diff --git a/docs/source/cmd_line_tools.rst b/docs/source/cmd_line_tools.rst new file mode 100644 index 0000000000000000000000000000000000000000..37052b25bff298c0cd71ab3772dd4b9c3ee5a7ed --- /dev/null +++ b/docs/source/cmd_line_tools.rst @@ -0,0 +1,112 @@ +.. _cmd_line_tools: + +Command line tools +================== + +This page gives instructions on how to launch DeepFinder steps from the terminal. + +Set up +------ +First, add DeepFinder to your path with following command: :code:`export PATH="/path/to/deep-finder/bin:$PATH"` + +You can add this command to your :code:`~/.bash_profile` + +.. note:: + Running these commands without any argument will launch the graphical user interface. + +Annotation +---------- + +Usage:: + + annotate -t /path/to/tomogram.mrc + -o /path/to/output/object_list.xml + +Target generation +----------------- +For :code:`generate_target` and :code:`train`, it is not possible to pass all necessary parameters as terminal arguments. Therefore, they have to be passed as an xml file. + +Usage:: + + generate_target -p /path/to/parameters.xml + +Parameter file:: + + <paramsGenerateTarget> + <path_objl path="/path/to/objl.xml"/> + <path_initial_vol path=""/> + <tomo_size> + <X size="400"/> + <Y size="400"/> + <Z size="200"/> + </tomo_size> + <strategy strategy="spheres"/> + <radius_list> + <class1 radius="1"/> + <class2 radius="2"/> + <class3 radius="3"/> + </radius_list> + <path_mask_list> + <class1 path=""/> + </path_mask_list> + <path_target path="/path/to/target.mrc"/> + </paramsGenerateTarget> + +.. note:: + You can find classes with methods for automatically reading and writing these parameter files in utils/params.py + + + +Training +-------- +Usage:: + + train -p /path/to/parameters.xml + +Parameter file:: + + <paramsTrain> + <path_out path="./"/> + <path_tomo> + <tomo0 path="/path/to/tomo0.mrc"/> + <tomo1 path="/path/to/tomo1.mrc"/> + <tomo2 path="/path/to/tomo2.mrc"/> + </path_tomo> + <path_target> + <target0 path="/path/to/target0.mrc"/> + <target1 path="/path/to/target1.mrc"/> + <target2 path="/path/to/target2.mrc"/> + </path_target> + <path_objl_train path="/path/to/objl_train.xml"/> + <path_objl_valid path="/path/to/objl_valid.xml"/> + <number_of_classes n="3"/> + <patch_size n="48"/> + <batch_size n="20"/> + <number_of_epochs n="100"/> + <steps_per_epoch n="100"/> + <steps_per_validation n="10"/> + <flag_direct_read flag="False"/> + <flag_bootstrap flag="True"/> + <random_shift shift="13"/> + </paramsTrain> + + +Segmentation +------------ +Usage:: + + segment -t /path/tomogram.mrc + -w /path/net_weights.h5 + -c NCLASS + -p PSIZE + -o /path/output/segmentation.mrc + +With NCLASS and PSIZE integer values. See :ref:`guide` for parameter description. + +Clustering +---------- +Usage:: + + cluster -l /path/to/segmentation.mrc + -r clusterRadius + -o /path/to/output/object_list.xml