Dear Faruk,
I have a proposed improvement over general API calls.
I implemented a higher abstraction layer that allows bvbabel to read typed objects rather than named dictionaries and numpy arrays, which also does not break the original dependency since it relies only on Python built-in features.
This way it lets users take advantage of IDE syntax suggesting for easy access to fields.
Example change like this:
https://github.com/ChengranAA/bvbabel/blob/main/bvbabel/vmr.py
And code for reading a VMR file will be like this:
from bvbabel.vmr import VMR
vmr = VMR.read("example.vmr")
print(vmr.dim_x, vmr.data.shape)
vmr.write("output.vmr")
# header-only (skip voxel data)
header = VMR.read("example.vmr", load_data=False)
print(header.data) # None
And this does not break the original APIs:
header, data = bvbabel.vmr.read_vmr("subject.vmr")
bvbabel.vmr.write_vmr("output.vmr", header, data)
Regarding issue #21, the data attribute can be skipped by providing the read method with load_data=False.
Currently it's only proof of concept. Let me know your thoughts!
Dear Faruk,
I have a proposed improvement over general API calls.
I implemented a higher abstraction layer that allows bvbabel to read typed objects rather than named dictionaries and numpy arrays, which also does not break the original dependency since it relies only on Python built-in features.
This way it lets users take advantage of IDE syntax suggesting for easy access to fields.
Example change like this:
https://github.com/ChengranAA/bvbabel/blob/main/bvbabel/vmr.py
And code for reading a VMR file will be like this:
And this does not break the original APIs:
Regarding issue #21, the data attribute can be skipped by providing the read method with
load_data=False.Currently it's only proof of concept. Let me know your thoughts!