Passed
Pull Request — master (#3)
by Yang
04:58
created

Python.Integration.DICOM_universal   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 50
dl 0
loc 68
rs 10
c 0
b 0
f 0
wmc 6

5 Methods

Rating   Name   Duplication   Size   Complexity  
A DICOM_converter.raw_sorted() 0 8 1
A DICOM_converter.raw() 0 7 1
A DICOM_converter.nii() 0 7 1
A DICOM_converter.raw_sorted_decompressed() 0 8 1
A DICOM_converter.DICOM_universal_convert() 0 18 2
1
from DICOM.sort import DICOM_sort
0 ignored issues
show
Coding Style Naming introduced by
The name DICOM_universal does not conform to the module naming conventions ((([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This module should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
introduced by
Unable to import 'DICOM.sort'
Loading history...
2
from DICOM.decompress import DICOM_decompress
0 ignored issues
show
introduced by
Unable to import 'DICOM.decompress'
Loading history...
3
import os
0 ignored issues
show
introduced by
standard import "import os" should be placed before "from DICOM.sort import DICOM_sort"
Loading history...
4
from PythonUtils.folder import create, recursive_list
0 ignored issues
show
introduced by
Unable to import 'PythonUtils.folder'
Loading history...
5
from PythonUtils.file import flatcopy
0 ignored issues
show
introduced by
Unable to import 'PythonUtils.file'
Loading history...
6
from DICOM.convert import DICOM_convert
0 ignored issues
show
introduced by
Unable to import 'DICOM.convert'
Loading history...
introduced by
Imports from package DICOM are not grouped
Loading history...
7
from DICOM.validate import DICOM_validate
0 ignored issues
show
introduced by
Unable to import 'DICOM.validate'
Loading history...
8
9
class DICOM_converter:
0 ignored issues
show
Coding Style Naming introduced by
The name DICOM_converter does not conform to the class naming conventions ([A-Z_][a-zA-Z0-9]+$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This class should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
Unused Code introduced by
The variable __class__ seems to be unused.
Loading history...
10
11
    @staticmethod
12
    def DICOM_universal_convert(input_folder, output_folder):
0 ignored issues
show
Coding Style Naming introduced by
The name DICOM_universal_convert does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
13
        """
14
15
        :param input_folder:
16
        :param output_folder:
17
        :return:
18
        """
19
20
        if not os.path.exists(output_folder):
21
            return False
22
        else:
23
            os.chdir(output_folder)
24
25
        DICOM_converter.raw(input_folder, output_folder)
26
        DICOM_converter.raw_sorted(input_folder, output_folder)
27
        DICOM_converter.raw_sorted_decompressed(input_folder, output_folder)
28
        DICOM_converter.nii(input_folder, output_folder)
29
30
    @staticmethod
31
    def raw(input_folder, output_folder):
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
32
        os.chdir(output_folder)
33
        os.mkdir("raw")
34
        path_raw = os.path.join(output_folder, "raw")
35
        file_list = recursive_list(input_folder)
36
        flatcopy(file_list, path_raw, DICOM_validate.file)
37
        # Raw_BIDS
38
39
    @staticmethod
40
    def raw_sorted(input_folder, output_folder):
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
41
        os.chdir(output_folder)
42
        os.chdir(output_folder)
43
        create("raw_sorted")
44
        path_raw_sorted = os.path.join(output_folder, "raw_sorted")
45
        DICOM_sort.into_folder(input_folder, path_raw_sorted)
46
        DICOM_convert.fix_series(path_raw_sorted)
47
48
    @staticmethod
49
    def raw_sorted_decompressed(input_folder, output_folder):
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
50
        os.chdir(output_folder)
51
        create("raw_sorted_decompressed")
52
        path_raw_sorted_decompressed = os.path.join(output_folder, "raw_sorted_decompressed")
53
        DICOM_sort.into_folder(input_folder, path_raw_sorted_decompressed)
54
        DICOM_decompress.filelist(path_raw_sorted_decompressed)
55
        DICOM_convert.fix_series(path_raw_sorted_decompressed)
56
57
    @staticmethod
58
    def nii(input_folder, output_folder):
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
59
        os.chdir(output_folder)
60
        create("nii")
61
        path_nii = os.path.join(output_folder, "nii")
62
        DICOM_convert.to_nii(input_folder, path_nii)
63
        DICOM_convert.fix_series(path_nii)
64
65
66
if __name__ == "__main__":
67
    DICOM_converter.DICOM_universal_convert(r'C:\FullyAnonymizedSubjects\2018-08-22_TestSubject3', r'C:\FullyAnonymizedSubjects\Wed3ConvertResult')
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (147/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
68