[pymvpa] NiftiImage from stream or string object

Michael Hanke michael.hanke at gmail.com
Fri Mar 20 20:42:34 UTC 2009


Hi James,

On Fri, Mar 20, 2009 at 01:32:30PM -0700, James Kyle wrote:
> Greetings,
> 
> I'm writing an application that'll receive a nifti image over a socket  
> connection. Once received, it's going to pass it off to analysis  
> framework.
> I'm using twisted for the networking, which receives data as a Python  
> string object.
> 
> As I understand the API, NiftiImage accepts either an actual file or a  
> numpy array + header dict as valid arguments. I wish to avoid  
> unnecessary disk I/O, so I'm going to subclass NiftiImage to accept  
> raw data as an argument in the form of a string or a stream.
> 
> Before I set out to do so, I wanted to make sure I haven't missed a  
> means of doing this already present in the library.

I don't think that anything that is in there already could do that.
However, maybe we can get away without a subclass. You'd only have to
get a string representation of the header and the image data, turn them
into an array and a dict and feed that to the constructor. So it could
simply be another helper function that could be linked into __init__().

What do you think?

Needless to mention that I'd be happy to accept patches and merge that
feature in pynifti.

Cheers,

Michael

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



More information about the Pkg-ExpPsy-PyMVPA mailing list