nwb-schema icon indicating copy to clipboard operation
nwb-schema copied to clipboard

Non-square pixel support for GrayscaleImage, ImageSeries, etc.

Open pauladkisson opened this issue 2 years ago • 4 comments

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 resolution field.

What solution would you like?

All image neurodata_types should implement a grid_spacing like pynwb.ophys.ImagingPlane.

pauladkisson avatar Aug 01 '23 17:08 pauladkisson

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).

rly avatar Nov 07 '24 23:11 rly

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.

pauladkisson avatar Nov 11 '24 16:11 pauladkisson

Thanks. We won't add this in schema 2.8.0 (upcoming this month) but we can target 2.9.0.

rly avatar Nov 12 '24 00:11 rly

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

h-mayorquin avatar Jan 27 '25 14:01 h-mayorquin