diff --git a/fileformats/medimage/__init__.py b/fileformats/medimage/__init__.py index 0dace6b..ca8becb 100644 --- a/fileformats/medimage/__init__.py +++ b/fileformats/medimage/__init__.py @@ -46,3 +46,53 @@ from .surface import ( Gifti # noqa: F401 ) +from .contents.imaging.modality import ( # noqa: F401 + ImagingModality, + CombinedModalities, + DualEnergyXrayAbsorptiometry, + Fluoroscopy, + MrFluoroscopy, + RadioFluoroscopy, + MagneticResonanceImaging, + DiffusionTensorImaging, + DynamicContrast, + EnhancedMagneticResonanceImaging, + FunctionalMagneticResonanceImaging, + MagneticResonanceAngiography, + MagneticResonanceSpectroscopy, + NuclearMedicineImaging, + PositronEmissionTomography, + PanographicRadiograph, + ProjectionRadiography, + ComputedRadiography, + DigitalRadiography, + DualEnergySubtractionRadiograpgy, + Mammography, + ScreenFilmRadiography, + Stereoscopy, + StereotacticRadiography, + Spectroscopy, + Tomography, + ComputedTomography, + Ultrasound, + MRI, + PET, + CR, + CT, + DX, + MG, + MR, + NM, + PT, + PX, + RF, + RG, + US, +) +from .contents.imaging.derivatives import ( + Derivative, + Mask +) +from .contents.anatomical_entity.material_anatomical_entity.anatomical_structure import ( + Brain, SpinalCord +) \ No newline at end of file diff --git a/fileformats/medimage/base.py b/fileformats/medimage/base.py index 5526058..93910ad 100644 --- a/fileformats/medimage/base.py +++ b/fileformats/medimage/base.py @@ -2,6 +2,11 @@ import logging from fileformats.generic import FileSet from fileformats.core import hook +from fileformats.core.mixin import WithClassifiers +from .contents import ContentsClassifier +from .contents.imaging.modality import ImagingModality +from .contents.imaging.derivatives import Derivative +from .contents.anatomical_entity.material_anatomical_entity import AnatomicalEntity logger = logging.getLogger("fileformats") @@ -11,12 +16,14 @@ # ===================================================================== -class MedicalImage(FileSet): +class MedicalImage(WithClassifiers, FileSet): iana_mime: ty.Optional[str] = None INCLUDE_HDR_KEYS = None IGNORE_HDR_KEYS = None binary = True + allowed_classifiers = (ContentsClassifier,) + exclusive_classifiers = (ImagingModality, AnatomicalEntity, Derivative) @hook.extra def read_array(self) -> "numpy.ndarray": # noqa diff --git a/fileformats/medimage/contents/__init__.py b/fileformats/medimage/contents/__init__.py new file mode 100644 index 0000000..080a6df --- /dev/null +++ b/fileformats/medimage/contents/__init__.py @@ -0,0 +1,5 @@ +from fileformats.core import Classifier + + +class ContentsClassifier(Classifier): + pass diff --git a/fileformats/medimage/contents/anatomical_entity/__init__.py b/fileformats/medimage/contents/anatomical_entity/__init__.py new file mode 100644 index 0000000..d71c82c --- /dev/null +++ b/fileformats/medimage/contents/anatomical_entity/__init__.py @@ -0,0 +1,5 @@ +from .. import ContentsClassifier + + +class AnatomicalEntity(ContentsClassifier): + pass diff --git a/fileformats/medimage/contents/anatomical_entity/anatomical_set.py b/fileformats/medimage/contents/anatomical_entity/anatomical_set.py new file mode 100644 index 0000000..e69de29 diff --git a/fileformats/medimage/contents/anatomical_entity/immaterial_anatomical_entity.py b/fileformats/medimage/contents/anatomical_entity/immaterial_anatomical_entity.py new file mode 100644 index 0000000..e69de29 diff --git a/fileformats/medimage/contents/anatomical_entity/material_anatomical_entity/__init__.py b/fileformats/medimage/contents/anatomical_entity/material_anatomical_entity/__init__.py new file mode 100644 index 0000000..33a255c --- /dev/null +++ b/fileformats/medimage/contents/anatomical_entity/material_anatomical_entity/__init__.py @@ -0,0 +1,5 @@ +from .. import AnatomicalEntity + + +class MaterialAnatomicalEntity(AnatomicalEntity): + pass diff --git a/fileformats/medimage/contents/anatomical_entity/material_anatomical_entity/anatomical_structure.py b/fileformats/medimage/contents/anatomical_entity/material_anatomical_entity/anatomical_structure.py new file mode 100644 index 0000000..f1068b5 --- /dev/null +++ b/fileformats/medimage/contents/anatomical_entity/material_anatomical_entity/anatomical_structure.py @@ -0,0 +1,29 @@ +from . import MaterialAnatomicalEntity + + +class AnatomicalStructure(MaterialAnatomicalEntity): + pass + + +class CardinalOrganPart(AnatomicalStructure): + pass + + +class OrganRegion(CardinalOrganPart): + pass + + +class OrganSegment(OrganRegion): + pass + + +class SegmentOfNeuraxis(OrganRegion): + pass + + +class Brain(SegmentOfNeuraxis): + pass + + +class SpinalCord(SegmentOfNeuraxis): + pass diff --git a/fileformats/medimage/contents/imaging/__init__.py b/fileformats/medimage/contents/imaging/__init__.py new file mode 100644 index 0000000..7bebc51 --- /dev/null +++ b/fileformats/medimage/contents/imaging/__init__.py @@ -0,0 +1,5 @@ +from .. import ContentsClassifier + + +class ImagingSpecialty(ContentsClassifier): + pass diff --git a/fileformats/medimage/contents/imaging/derivatives.py b/fileformats/medimage/contents/imaging/derivatives.py new file mode 100644 index 0000000..f3480d5 --- /dev/null +++ b/fileformats/medimage/contents/imaging/derivatives.py @@ -0,0 +1,17 @@ +from .. import ContentsClassifier + + +class Derivative(ContentsClassifier): + """An image type that is derived from other images""" + + +class Mask(Derivative): + """A binary image that is multiplied with a real-valued image to select sections + of the image for analysis""" + + +class FibreOrientationDistribution(Derivative): + pass + + +FOD = FibreOrientationDistribution diff --git a/fileformats/medimage/radlex/imaging/modality.py b/fileformats/medimage/contents/imaging/modality.py similarity index 98% rename from fileformats/medimage/radlex/imaging/modality.py rename to fileformats/medimage/contents/imaging/modality.py index 604aea9..a563abf 100644 --- a/fileformats/medimage/radlex/imaging/modality.py +++ b/fileformats/medimage/contents/imaging/modality.py @@ -1,7 +1,7 @@ -from fileformats.core import ClassifierCategory +from .. import ContentsClassifier -class ImagingModality(ClassifierCategory): +class ImagingModality(ContentsClassifier): ontology_link = 'http://www.radlex.org/RID/RID10311' description = 'Form of imaging that depends on the way the image is produced' dicom_modality = None @@ -144,6 +144,7 @@ class ScreenFilmRadiography(ProjectionRadiography): description = 'Conventional radiography' dicom_modality = 'RG' + class Stereoscopy(ProjectionRadiography): ontology_link = 'http://www.radlex.org/RID/RID50131' description = None diff --git a/fileformats/medimage/radlex/__init__.py b/fileformats/medimage/radlex/__init__.py deleted file mode 100644 index 3d628c0..0000000 --- a/fileformats/medimage/radlex/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -from fileformats.core import ClassifierCategory - - -class AnatomicalEntity(ClassifierCategory): - pass - diff --git a/fileformats/medimage/radlex/anatomical/__init__.py b/fileformats/medimage/radlex/anatomical/__init__.py deleted file mode 100644 index 99c9ad9..0000000 --- a/fileformats/medimage/radlex/anatomical/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -from fileformats.core import ClassifierCategory - - -class AnatomicalEntity(ClassifierCategory): - pass diff --git a/fileformats/medimage/radlex/imaging/__init__.py b/fileformats/medimage/radlex/imaging/__init__.py deleted file mode 100644 index 507402c..0000000 --- a/fileformats/medimage/radlex/imaging/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -from fileformats.core import ClassifierCategory - - -class ImagingSpecialty(ClassifierCategory): - pass