mediml 0.9.9__py3-none-any.whl → 0.9.10__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
MEDiml/__init__.py CHANGED
@@ -14,7 +14,7 @@ stream_handler.setLevel(logging.WARNING)
14
14
  logging.getLogger(__name__).addHandler(stream_handler)
15
15
 
16
16
  __author__ = "MEDomicsLab consortium"
17
- __version__ = "0.9.9"
17
+ __version__ = "0.9.10"
18
18
  __copyright__ = "Copyright (C) MEDomicsLab consortium"
19
19
  __license__ = "GNU General Public License 3.0"
20
20
  __maintainer__ = "MAHDI AIT LHAJ LOUTFI"
@@ -432,17 +432,7 @@ class DataManager(object):
432
432
  Returns:
433
433
  MEDscan: Returns a MEDscan instance with updated roi attributes.
434
434
  """
435
- image_file = Path(image_file)
436
- roi_index = 0
437
-
438
- if not path_roi_data:
439
- if not self.paths._path_to_niftis:
440
- raise ValueError("The path to the niftis is not defined")
441
- else:
442
- path_roi_data = self.paths._path_to_niftis
443
-
444
- for file in path_roi_data.glob('*.nii.gz'):
445
- _id = image_file.name.split("(")[0] # id is PatientID__ImagingScanName
435
+ def load_mask(_id, file, medscan):
446
436
  # Load the patient's ROI nifti files:
447
437
  if file.name.startswith(_id) and 'ROI' in file.name.split("."):
448
438
  roi = nib.load(file)
@@ -452,8 +442,27 @@ class DataManager(object):
452
442
  name_set = file.name[file.name.find("_") + 2 : file.name.find("(")]
453
443
  medscan.data.ROI.update_indexes(key=roi_index, indexes=np.nonzero(roi_data.flatten()))
454
444
  medscan.data.ROI.update_name_set(key=roi_index, name_set=name_set)
455
- medscan.data.ROI.update_roi_name(key=roi_index, roi_name=roi_name)
445
+ medscan.data.ROI.update_roi_name(key=roi_index, roi_name=roi_name)
446
+ else:
447
+ raise ValueError(f"The ROI file for patient ID: {_id} "
448
+ f"was not found in the given path: {file} or was not correctly named.")
449
+
450
+ image_file = Path(image_file)
451
+ roi_index = 0
452
+ if not path_roi_data:
453
+ if not self.paths._path_to_niftis:
454
+ raise ValueError("The path to the niftis is not defined")
455
+ else:
456
+ path_roi_data = self.paths._path_to_niftis
457
+
458
+ for file in self.__nifti.stack_path_roi:
459
+ _id = image_file.name.split("(")[0] if ("(") in image_file.name else image_file.name # id is PatientID__ImagingScanName
460
+ load_mask(_id, file, medscan)
456
461
  roi_index += 1
462
+ else:
463
+ _id = image_file.name.split("(")[0] if ("(") in image_file.name else image_file.name # id is PatientID__ImagingScanName
464
+ load_mask(_id, path_roi_data, medscan)
465
+
457
466
  return medscan
458
467
 
459
468
  def __associate_spatialRef(self, nifti_file: Union[Path, str], medscan: MEDscan) -> MEDscan:
@@ -567,7 +576,7 @@ class DataManager(object):
567
576
  medscan = MEDscan()
568
577
  medscan.patientID = os.path.basename(file).split("_")[0]
569
578
  medscan.type = os.path.basename(file).split(".")[-3]
570
- medscan.series_description = file.name[file.name.find('__') + 2: file.name.find('(')]
579
+ medscan.series_description = file.name[file.name.find('__') + 2: file.name.find('(')] if '__' in file.name else ""
571
580
  medscan.format = "nifti"
572
581
  medscan.data.set_orientation(orientation="Axial")
573
582
  medscan.data.set_patient_position(patient_position="HFS")
@@ -625,6 +634,24 @@ class DataManager(object):
625
634
  if list_instances:
626
635
  return list_instances
627
636
 
637
+ def process_one_nifti(self, path_image: Union[Path, str], path_mask: Union[Path, str]) -> MEDscan:
638
+ """Processes one NIfTI file to create a MEDscan class instance.
639
+
640
+ Args:
641
+ nifti_file (Union[Path, str]): Path to the NIfTI file.
642
+ path_data (Union[Path, str]): Path to the data.
643
+
644
+ Returns:
645
+ MEDscan: MEDscan class instance.
646
+ """
647
+ medscan = self.__process_one_nifti(path_image, path_mask)
648
+
649
+ # SAVE MEDscan INSTANCE
650
+ if self.save and self.paths._path_save:
651
+ save_MEDscan(medscan, self.paths._path_save)
652
+
653
+ return medscan
654
+
628
655
  def update_from_csv(self, path_csv: Union[str, Path] = None) -> None:
629
656
  """Updates the class from a given CSV and summarizes the processed scans again according to it.
630
657
 
@@ -1,18 +1,18 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: mediml
3
- Version: 0.9.9
3
+ Version: 0.9.10
4
4
  Summary: MEDiml is a Python package for processing and extracting features from medical images
5
- Home-page: https://mediml.app/
6
5
  License: GPL-3.0
6
+ License-File: LICENSE.md
7
7
  Keywords: python,ibsi,medical-imaging,cancer-imaging-research,radiomics,medical-image-analysis,features-extraction,radiomics-extraction,radiomics-features,radiomics-analysis
8
8
  Author: MEDomics Consortium
9
9
  Author-email: medomics.info@gmail.com
10
10
  Requires-Python: >=3.8.0,<=3.10
11
11
  Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
12
12
  Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.10
14
13
  Classifier: Programming Language :: Python :: 3.8
15
14
  Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
16
  Requires-Dist: Pillow
17
17
  Requires-Dist: PyWavelets
18
18
  Requires-Dist: SimpleITK
@@ -47,6 +47,7 @@ Requires-Dist: wget
47
47
  Requires-Dist: xgboost
48
48
  Project-URL: Bug Tracker, https://github.com/MEDomicsLab/MEDiml/issues
49
49
  Project-URL: Documentation, https://mediml.readthedocs.io/
50
+ Project-URL: Homepage, https://mediml.app/
50
51
  Project-URL: Repository, https://github.com/MEDomicsLab/MEDiml/
51
52
  Description-Content-Type: text/markdown
52
53
 
@@ -59,7 +60,7 @@ Description-Content-Type: text/markdown
59
60
  [![Continuous Integration](https://github.com/MEDomicsLab/MEDiml/actions/workflows/python-app.yml/badge.svg)](https://github.com/MEDomicsLab/MEDiml/actions/workflows/python-app.yml)
60
61
  [![Documentation Status](https://readthedocs.org/projects/mediml/badge/?version=latest)](https://mediml.readthedocs.io/en/latest/?badge=latest)
61
62
  [![License: GPL-3](https://img.shields.io/badge/license-GPLv3-blue)](LICENSE)
62
- [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/MahdiAll99/MEDimage/blob/main/notebooks/tutorial/DataManager-Tutorial.ipynb)
63
+ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/MEDomicsLab/MEDiml/blob/main/notebooks/tutorial/DataManager-Tutorial.ipynb)
63
64
 
64
65
  </div>
65
66
 
@@ -79,7 +80,7 @@ Description-Content-Type: text/markdown
79
80
  ## 1. Introduction
80
81
  MEDiml is an open-source Python package that can be used for processing multi-modal medical images (MRI, CT or PET) and for extracting their radiomic features. This package is meant to facilitate the processing of medical images and the subsequent computation of all types of radiomic features while maintaining the reproducibility of analyses. This package has been standardized with the [IBSI](https://theibsi.github.io/) norms.
81
82
 
82
- ![MEDiml overview](https://raw.githubusercontent.com/MahdiAll99/MEDimage/main/docs/figures/pakcage-overview.png)
83
+ ![MEDiml overview](https://raw.githubusercontent.com/MEDomicsLab/MEDiml/main/docs/figures/pakcage-overview.png)
83
84
 
84
85
 
85
86
  ## 2. Installation
@@ -159,14 +160,14 @@ The image biomarker standardization initiative ([IBSI](https://theibsi.github.io
159
160
  - ### IBSI Chapter 1
160
161
  [The IBSI chapter 1](https://theibsi.github.io/ibsi1/) is dedicated to the standardization of commonly used radiomic features. It was initiated in September 2016 and reached completion in March 2020. We have created two [jupyter notebooks](https://github.com/MEDomicsLab/MEDiml/tree/main/notebooks/ibsi) for each phase of the chapter and made them available for the users to run the IBSI tests for themselves. The tests can also be explored in interactive Colab notebooks that are directly accessible here:
161
162
 
162
- - **Phase 1**: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/MahdiAll99/MEDimage/blob/main/notebooks/ibsi/ibsi1p1.ipynb)
163
- - **Phase 2**: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/MahdiAll99/MEDimage/blob/main/notebooks/ibsi/ibsi1p2.ipynb)
163
+ - **Phase 1**: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/MEDomicsLab/MEDiml/blob/main/notebooks/ibsi/ibsi1p1.ipynb)
164
+ - **Phase 2**: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/MEDomicsLab/MEDiml/blob/main/notebooks/ibsi/ibsi1p2.ipynb)
164
165
 
165
166
  - ### IBSI Chapter 2
166
167
  [The IBSI chapter 2](https://theibsi.github.io/ibsi2/) was launched in June 2020 and reached completion in February 2024. It is dedicated to the standardization of commonly used imaging filters in radiomic studies. We have created two [jupyter notebooks](https://github.com/MEDomicsLab/MEDiml/tree/main/notebooks/ibsi) for each phase of the chapter and made them available for the users to run the IBSI tests for themselves and validate image filtering and image biomarker calculations from filter response maps. The tests can also be explored in interactive Colab notebooks that are directly accessible here:
167
168
 
168
- - **Phase 1**: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/MahdiAll99/MEDimage/blob/main/notebooks/ibsi/ibsi2p1.ipynb)
169
- - **Phase 2**: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/MahdiAll99/MEDimage/blob/main/notebooks/ibsi/ibsi2p2.ipynb)
169
+ - **Phase 1**: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/MEDomicsLab/MEDiml/blob/main/notebooks/ibsi/ibsi2p1.ipynb)
170
+ - **Phase 2**: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/MEDomicsLab/MEDiml/blob/main/notebooks/ibsi/ibsi2p2.ipynb)
170
171
 
171
172
  Our team at *UdeS* (a.k.a. Université de Sherbrooke) has already submitted the benchmarked values to the [IBSI uploading website](https://ibsi.radiomics.hevs.ch/).
172
173
 
@@ -1,4 +1,4 @@
1
- MEDiml/__init__.py,sha256=KbXEX6rWtKcIrxtujycKfIwuTiL_38qKcoC8_tdyAAY,586
1
+ MEDiml/__init__.py,sha256=B6a6MWZVcIrTLiZbHz_DccG1uwWXsyCZIYKGB9W7UZ4,587
2
2
  MEDiml/biomarkers/__init__.py,sha256=cNKDEauniVRnwFPG9muapTA_zCZEm6aCzrRi1eekE9A,433
3
3
  MEDiml/biomarkers/BatchExtractor.py,sha256=84TQk_A9yCMDN9oVU32KdvHYpr1xar027VPhFnGuw34,33922
4
4
  MEDiml/biomarkers/BatchExtractorTexturalFilters.py,sha256=ClunDOCxBwIHHQwGG38kWvH7iiZcCe9-Pe5ifGyPbG4,34040
@@ -70,9 +70,9 @@ MEDiml/utils/texture_features_names.py,sha256=XS9xWO_Et1AiPQnV7UiDgyusbpy4TMCmKG
70
70
  MEDiml/utils/textureTools.py,sha256=m-vv9NCJqgHECsNaTAF4XpDL9rsDt9tRnm3aG9_g21Y,6350
71
71
  MEDiml/utils/write_radiomics_csv.py,sha256=Vohm2TgnI6S6pKh9lLqO4JRmS4H5nKj-_ky0CkAZLCQ,1584
72
72
  MEDiml/wrangling/__init__.py,sha256=oA_HQAA9nxokOsqSitE0DA8EFY3wMYIRUfCf4ULqDpA,74
73
- MEDiml/wrangling/DataManager.py,sha256=-YmpfKPUF4yv7wEo4ObN23L_l7Mmo5M6X8NPozXKxdM,87253
73
+ MEDiml/wrangling/DataManager.py,sha256=pRVklNKeHVO6vDiLaqsEGjUrar6T8_CpYYNWTxxcdrs,88478
74
74
  MEDiml/wrangling/ProcessDICOM.py,sha256=ZJ3mkc8_ZYnfnzmIlpp6cS6RTlFm6aotgJxKPlSqTMY,25023
75
- mediml-0.9.9.dist-info/LICENSE.md,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
76
- mediml-0.9.9.dist-info/WHEEL,sha256=DA86_h4QwwzGeRoz62o1svYt5kGEXpoUTuTtwzoTb30,83
77
- mediml-0.9.9.dist-info/METADATA,sha256=XQM-EGNRlVmzTshjpTwPtIt_W822lTPBREsdCQmkOAM,11328
78
- mediml-0.9.9.dist-info/RECORD,,
75
+ mediml-0.9.10.dist-info/licenses/LICENSE.md,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
76
+ mediml-0.9.10.dist-info/METADATA,sha256=AwS8hYQNoc8dZ2qG1o3Fq-wPAfvVUWOTchRxEyM42uA,11360
77
+ mediml-0.9.10.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
78
+ mediml-0.9.10.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry 1.0.8
2
+ Generator: poetry-core 2.2.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any