Skip to content

How to have your own dataset format be processed by nabu

Nabu primarily deals with Nexus/NXTomo files, and with EDF files for legacy reasons.

Given your data in a certain format, you can either:

  1. Convert it to NXTomo, provided that the nxtomomill converter handles your file format
  2. Create a NXTomo file using the NXTomo library
  3. Or, you can make nabu ingest your data directly by creating your own Dataset class that will be used by nabu.

This page focuses on point (3).

Nabu defines a "blueprint" of what is expected in a dataset. You can create your own Dataset by subclassing this the Dataset base class:

from nabu.resources.dataset import Dataset

class MyDatasetFormat(Dataset):
    ...
    @property
    def energy(self):
        # get energy in some way from your file
        return self._my_file_energy

Your Dataset (sub)class must have a minimum set of fields : number of projections, frames shape, how to access flats/darks, ...

Note

You can also use the InMemoryDataset class, and populate the fields one after the other.