You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Assess feasibility of Ops with all ImgLib2 image types #122
When reviewing scijava/incubator#76 I was curious about its specializations for ArrayImg. I noticed we only have a copy Op for ArrayImgs and when I tried making a version of CopyArrayImgTest for PlanarImg it failed.
It seems like we want to ensure all Img types are supported, at least with a slow fallback.
@hinerm they are supported, just not using the Op name copy.img, because I removed the copy.img Ops in scijava/incubator#76, and now the only Op with that name is the one that works on ArrayImgs 😅
The solution is probably to alias copy.rai, and also copy.iterableInterval to copy.img, or just to always use copy. I created a test clone on PlanarImg, and changed the name to copy and things worked just fine.
Without thinking deeply about it, I like the idea of all copy ops just being copy. If you want to copy to a particular destination type, and it supports the computer paradigm, you can just pass the empty container of desired type. Is there ever a case where you might want to clone an object to a new type of your choosing, but can't create a new object of that type for use as a container? E.g. "copy" a FloatType to a Double? (Double is immutable so can't support the computer paradigm.)
All copy Ops are usually named copy for adaptation purposes. I personally can't think of an adaptation situation like you're describing, but I'd say we shouldn't think about it until we need it
Activity
hinerm commentedon Jun 14, 2023
@gselzer am I off-base here? Is there a reason these operations just shouldn't be supported for other
Imgtypes?gselzer commentedon Jun 14, 2023
@hinerm they are supported, just not using the
Opnamecopy.img, because I removed thecopy.imgOps in scijava/incubator#76, and now the onlyOpwith that name is the one that works onArrayImgs 😅The solution is probably to alias
copy.rai, and alsocopy.iterableIntervaltocopy.img, or just to always usecopy. I created a test clone onPlanarImg, and changed the name tocopyand things worked just fine.I'll file a PR to fix the copy namespace!
ctrueden commentedon Jun 14, 2023
Without thinking deeply about it, I like the idea of all copy ops just being
copy. If you want to copy to a particular destination type, and it supports the computer paradigm, you can just pass the empty container of desired type. Is there ever a case where you might want to clone an object to a new type of your choosing, but can't create a new object of that type for use as a container? E.g. "copy" aFloatTypeto aDouble? (Doubleis immutable so can't support the computer paradigm.)gselzer commentedon Jun 14, 2023
All
copyOps are usually namedcopyfor adaptation purposes. I personally can't think of an adaptation situation like you're describing, but I'd say we shouldn't think about it until we need ithinerm commentedon Jun 16, 2023
Closed in scijava/incubator#77
Merge pull request #122 from scijava/scijava-function/extra-computers