[Pkg-exppsy-pynifti] Image, design, usecases

Michael Hanke michael.hanke at gmail.com
Mon May 11 06:39:20 UTC 2009


Hi,

I will split my take on it over a couple of messages. Here is this
first set, addressing the main questions:

> Can we set the filename from the class __init__()? For example:
> img = nifti.Nifti1Image(data, np.eye(4), filename='my_image.nii')
> 
> If so, does it just use set_filename - i.e. is this confusing?:
> img = nifti.Nifti1Image(data, np.eye(4), filename='my_image')
> assert img.get_filename() == 'my_image.nii'

I wouldn't mind having a 'filename' arg to the constructor, but I'd
prefer having no extra magic, or alternate behavior there. It should
simply use set_filename() and therefore behave exactly like it.

> Can we also set what I have called _files from the init?:
> files = {'image':'dicom_file', 'header':'dicom_file.hdr'}
> img = nifti.Nifti1Image(data, np.eye(4), files=files)
> 
> Probably not, the Nifti1Image.from_files constructor seems to cover that one.

The question to me is really whether we want to handle cases like
'somefile.hdr + crazyblob.exe', although that would technically be
possible. Consider your realignment example. FSL loads the images via
fslio. It would have to be as flexible to not cause trouble at some
point. NIfTI was made as a 'you-really-have-to-do-only-few-pieces-but-
the-rest-is-rather-optional-standard'. How much benefit would there be
if pynifti could read anything, but NiPy would have to report 'oh sorry,
but this crazy stuff does not work with the FSL-backend that you
requested'.

One option would be that NiPy would internally convert files/data into
the required format -- which is directly related to the question of
whether an image should track its mirror on a disk.

Scenario: You feed an analyze image into FLIRT. What you'll get back is
a NIfTI image (i.e. change in filename(s)!), since FSL refuses to write
ANALYZE since FSL 4 -- which is a good thing, IMHO.

Maybe we should limit ourselves to the standard combinations (hdr+img,
nii, mnc, ...) and provide 'extension-guessing' just like libniftiio.
Hence we reference image via their basename (only).

Michael


-- 
GPG key:  1024D/3144BE0F Michael Hanke
http://apsy.gse.uni-magdeburg.de/hanke
ICQ: 48230050



More information about the Pkg-exppsy-pynifti mailing list