Enet4 / nifti-rs

Rust implementation of the NIfTI-1 format
Apache License 2.0
42 stars 12 forks source link

RGB images writer #26

Closed nilgoyette closed 5 years ago

nilgoyette commented 6 years ago

There's some code copy, but I don't know how to avoid it. Most types can have a slope so the standard functions respect:

 where
    ...
    A: Div<Output = A>,
    A: FromPrimitive,
    A: ScalarOperand,
    A: Sub<Output = A>
    ...

Of course, [u8; 3] can't respect those traits, so I added write_rgb_nifti, which is almost identical to write_nifti, and I try to re-use utility functions as much as possible.

Moreover, I added 2 tests where I write RGB images, but I can't read them... So, those tests only check that the code compiles I guess. We will need a RGB reader someday to fix this!

nilgoyette commented 5 years ago

TODO, in another PR, if you agree