Skip to content

Commit

Permalink
touching up classifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
tclose committed Jan 15, 2024
1 parent 3c418f9 commit 8877595
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 10 deletions.
9 changes: 5 additions & 4 deletions fileformats/medimage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@
from .surface import (
Gifti # noqa: F401
)
from .contents.anatomical import (
AnatomicalEntity # noqa: F401
)
from .contents.imaging.modality import ( # noqa: F401
ImagingModality,
CombinedModalities,
Expand Down Expand Up @@ -92,6 +89,10 @@
RG,
US,
)
from .contents.derivatives import (
from .contents.imaging.derivatives import (
Derivative,
Mask
)
from .contents.anatomical_entity.material_anatomical_entity.anatomical_structure import (
Brain, SpinalCord
)
4 changes: 4 additions & 0 deletions fileformats/medimage/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
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")

Expand All @@ -20,6 +23,7 @@ class MedicalImage(WithClassifiers, FileSet):
IGNORE_HDR_KEYS = None
binary = True
allowed_classifiers = (ContentsClassifier,)
exclusive_classifiers = (ImagingModality, AnatomicalEntity, Derivative)

@hook.extra
def read_array(self) -> "numpy.ndarray": # noqa
Expand Down
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from .. import AnatomicalEntity


class MaterialAnatomicalEntity(AnatomicalEntity):
pass
Original file line number Diff line number Diff line change
@@ -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
6 changes: 0 additions & 6 deletions fileformats/medimage/contents/derivatives.py

This file was deleted.

17 changes: 17 additions & 0 deletions fileformats/medimage/contents/imaging/derivatives.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8877595

Please sign in to comment.