Skip to content

CILDataReader and CILDataWriter Parent Classes demo #21

@RasmiaKulan

Description

@RasmiaKulan

Current Behaviour

  • Several readers/writers with similar interfaces:​
    • TIFFStackReader, NEXUSDataReader, ZEISSDataReader, …​

Proposed Behaviour

  • A parent class to guarantee a uniform interface​
  • Factory method to select correct reader/writer from a filename​

Potential Benefit

  • More consistent interface for users (unification of common reader methods such as read() and get_geometry()​)
  • Can add a universal reader in Mantid Imaging​
  • File types could drive which reader to use automatically.​

Extras

Type annotations​

Challenges

How similar are the current interfaces?

Example

# imports
from cil.io import NEXUSDataWriter, NEXUSDataReader

# initialise NEXUS Writer
writer = NEXUSDataWriter()
writer.set_up(data=my_data,
            file_name='tmp_nexus.nxs')
# write data
writer.write()

# read data
# initialize NEXUS reader
reader = NEXUSDataReader()
reader.set_up(file_name='tmp_nexus.nxs')
# load data
ad1 = reader.read()
# get AcquisitionGeometry
ag1 = reader.get_geometry()

The above could also be done through:

reader = CILDataReader.get_reader("tmp_nexus.nxs")
ad1 = reader.read()

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

Status

Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions