Rename Slice5D to Interval5D and disallow undefined (slice(None)) axes#12
Draft
Tomaz-Vieira wants to merge 6 commits intoilastik:mainfrom
Draft
Rename Slice5D to Interval5D and disallow undefined (slice(None)) axes#12Tomaz-Vieira wants to merge 6 commits intoilastik:mainfrom
Tomaz-Vieira wants to merge 6 commits intoilastik:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Slice5Dwas giving the wrong impressions by having all of its axes be nativeslices; Since it interprets negative indices as "out of bounds to the 'left' " instead of "counting backwards from the end" and does not allow for arbitrary step lengths, it has been renamed toInterval5D, with each of its axes beingTuple[int, int]instead ofslice.Not allowing axes to represent "all" means that a lot of the code is simplified and that all methods are always valid (e.g.: before you couldn't call
split()on aSlice5Dthat had some of its axes set toslice(None)).This also removes floats from the code, since
infwas being used for undefined slices, which are no longer permitted.To make up for the loss of flexibility,
Array5D.cut,Array5D.clampand other similar methods now take anInterval5Das well as optional overrides for each axis. These overrides can be aTuple[int, int]or an instance ofAll, meaning that the cut is supposed to override that axis of the provided interval will the full size of theArray5D. The following example cutsmy_arraywith intervalmy_interval, but overridescso that the resultingArray5Dhas all channels ofmy_array:Using the opportunity to rename things associated with slices, the "slice backed by data" class
DataSourceSlicehas been renamed toDataRoi, which is more succinct and probably expresses its concept better.