ndarray subclasses
Kevin Keraudren
kevin.keraudren at googlemail.com
Thu Sep 19 11:46:34 EDT 2013
Le 19/09/2013 10:36, Almar Klein a �crit :
>
> 1) Allowing extra attributes for the Image class, like "sampling" that
> specifies the distance between the pixels. This attribute can then be
> used by algorithms to take anisotropy into account, and visualization
> toolkits could use it to scale the image in the correct way
> automatically. This may not seem a very common use case for 2D images,
> but 3D data is usually not isotropic.
>
> Other attributes that I think may be of use for the Image class are
> "origin" that specifies the location of the topleft pixel relative to
> an arbitrary coordinate frame, and "meta" for the meta data (e.g. EXIF
> tags).
Hi,
I am not related to the development of scikit-image but I guess its goal
is to work on images in general and not get too specialised, for
instance in Medical images.
I am working on a Python interface for a C++ medical imaging library,
and I chose to subclass np.ndarray, images keeping a header information
( 'dim', 'orientation', 'origin' and 'pixelSize'), the main feature is
to keep track of those spatial coordinate when we slice or resample the
array.
As St�fan pointed out " when you slice out a scalar, or sum, you get an
Image object out!", but this has not been an issue so far, I just hide
it by overriding:
def __str__(self):
if len(self.shape) == 0:
return str(self.view(np.ndarray))
else:
return self.__repr__()
The documentation I placed online might give you more ideas on what
could be done with a subclass of np.ndarray dedicated to images:
http://www.doc.ic.ac.uk/~kpk09/irtk/#irtk.imread
May I ask: if you were to add sampling information and spatial
coordinates, such as an origin for the top-left pixel, how would you
input that information into scikit-image, could you read it directly
from the input files or would you need some user input?
Kind regards,
Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20130919/7ac8e90c/attachment.html>
More information about the scikit-image
mailing list