3MFConsortium / spec_volumetric

The 3MF volumetric extension specification
BSD 2-Clause "Simplified" License
10 stars 1 forks source link

In channelfromimage3d, the effect of filter = "nearest" may be ambiguous #34

Closed chiatchechang closed 2 years ago

chiatchechang commented 2 years ago

In channelfromimage3d, when filter is set to "nearest", sampling at an arbitrary (u,v,w) returns the floating point value defined by the closest point (u',v',w') to (u,v,w) which transforms back to a voxel center in the 3D image resource.

Isn't it possible to have several points at the same minimum distance? It is not specified which value should be used in this case.

(If filter is set to "linear", I guess the the eight closest points coordinates could be technically ambiguous but in that case, the interpolated value should be the same whatever closest points we choose so it's a non-issue.)

martinweismann commented 2 years ago

good point about nearest neighbor.

We should use an explicit formula similar to how opengl specifies it: https://stackoverflow.com/questions/38030310/what-happens-in-the-case-of-nearest-neighbour-interpolation-opengl-centre-of-pix

martinweismann commented 2 years ago

Addressed in https://github.com/3MFConsortium/spec_volumetric/pull/39/files#diff-59caa499e51ab8cb5ca5334dc51bad4c27758474e490781f76b0e85639642ee6R270

martinweismann commented 2 years ago

An image might help, but it should be unambiguous as-is now.

martinweismann commented 2 years ago

Done in https://github.com/3MFConsortium/spec_volumetric/pull/52