[pymvpa] NiftiImage from stream or string object
James Kyle
jameskyle at ucla.edu
Fri Mar 20 20:53:42 UTC 2009
I was going to subclass NiftiImage first, that way I could leave the
original untouched. I figured the only thing I'd do is override
__init__(self, *args), do the string magic to create a dict + ndarray,
than call the parent __init__(self, *args).
This let's me easily test my overall program without breaking other
unittests that rely on NiftiImage.
Eventually though, I did plan on integrating it into the main class
and submitting a patch. :)
-james
On Mar 20, 2009, at 1:42 PM, Michael Hanke wrote:
> 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
>
> _______________________________________________
> Pkg-ExpPsy-PyMVPA mailing list
> Pkg-ExpPsy-PyMVPA at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/pkg-exppsy-pymvpa
More information about the Pkg-ExpPsy-PyMVPA
mailing list