imglib / imglib2-algorithm

Image processing algorithms for ImgLib2
http://imglib2.net/
Other
22 stars 20 forks source link

NonCubic RectangleShape Neighborhood #80

Closed tischi closed 5 years ago

tischi commented 5 years ago

@stelfrich @tinevez I was wondering why there only is a constructor with one single integer for the span: https://github.com/imglib/imglib2-algorithm/blob/master/src/main/java/net/imglib2/algorithm/neighborhood/RectangleShape.java#L67 To me, that would indicate that it is a cube rather than a rectangle. Could one add a constructor where one can specify different lengths of the span in all dimensions?

tischi commented 5 years ago

I just saw that this was raised already here: https://github.com/imglib/imglib2-algorithm/issues/10

tinevez commented 5 years ago

Hi @tischi Yes you are right, but this is how we started at the beginning. If you look around for other implementations of Shape you will see that there are various classes that vary with their capabilities. The decision to rename this belong to its author, @tpietzsch

tischi commented 5 years ago

Hi @tinevez I don't think we'd need to change the name in this case. I feel adding more constructors would do the job. Just specifying one integer would be just one very specific rectangle, namely a cube. In this way one would be backwards compatible and still have the chance to specify an actual rectangle. What do you think?

tinevez commented 5 years ago

I don't completely agree. Name -> function. So I would make a class for a Cube with skipCenter flag. And another class for general Rectangle.

tischi commented 5 years ago

Yes, that would be nicer! In that case one could maybe add a HyperCube neighborhood and add more constructors to the RectangleNeighborhood. This looks to me like it would be backwards compatible.