Non-square pixel support for GrayscaleImage, ImageSeries, etc.
Re-raising NeurodataWithoutBorders/pynwb#1749 for consistency with the schema.
What would you like to see added to PyNWB?
I have behavioral video and some static images with different estimated length (mm/pixel) than width (mm/pixel). I would like to specify this in the images/ImageSeries' but there is only a scalar
resolutionfield.
What solution would you like?
All image
neurodata_typesshould implement agrid_spacinglikepynwb.ophys.ImagingPlane.
The length of each side of a pixel (or voxel) is a property of the acquisition process. That's why grid_spacing is part of pynwb.ophys.ImagingPlane. The image itself (e.g., GrayscaleImage) is agnostic to real-world dimensions. Similarly, ImageSeries is just a series of images in time. The child types of ImageSeries allow you to add information about the images as presented or recorded. OpticalSeries has a field_of_view dataset that allows you to map from pixel dimensions to real-world dimensions (in meters). OnePhotonSeries and TwoPhotonSeries have links to an ImagingPlane with grid_spacing as you mentioned.
@pauladkisson Could you provide a specific use case of how you would want to specify the length/width of a pixel for a particular type of data? Would it be sufficient to specify a set of scaling factors for the image and image series that is a tuple of (x, y) or (x, y, z), e.g., (1, 2). This is basically an aspect ratio (x_length:y_length).
This was for an old project with rectangular pixels, but I don't remember and can't easily find the exact dimensions. But I think (x_length:y_length) would work perfectly fine.
Thanks. We won't add this in schema 2.8.0 (upcoming this month) but we can target 2.9.0.
As an example of prior art the png standard contains this metadata and handles it as :
pixel_per_unit_x_axis, pixel_per_unit_y_axis using uint32.
https://www.w3.org/TR/png-3/#11pHYs