Skip to content

Align attributes and return types #6

@Illviljan

Description

@Illviljan

I'm attempting to move the data in DcmReader to a xarray dataset but it is a annoying having to deal with the different return types and missing attributes.

  • DcmDistribution.values return list instead of dict.
  • DcmFunction.values does not exist. Could have been an empty list instead.

My suggestion is to try to add a base class that DcmDistribution etc is inheriting from where self.values only contain the WERT values, axis values (or coordinates) are moved to a self.coords.

I made an example PR here, #7.
High level ideas:

  • Inherit/use only a single dcm class, reduces typo risks etc, Risk of getting too much clutter.
  • Follow typical conventions popular in data analysis tools like numpy /xarray
    • Use self.shape instead of x_dimension y_dimension. -> Following numpy.array.shape standard.
    • Use list of list for WERT values. -> Easy to initialize numpy.array then.
    • Use tuple of lists for axis values. -> Matching order of numpy.array.shape-tuples
    • Move remaining metadata to a self.attrs dict. -> In similar fashion as xarray/pandas
  • A lot of type hints to clarify intention of methods and attributes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions