-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mark's and Mark's developers thoughts: 0-1 indexing #11
Comments
I normally have strong feelings regarding 0 and 1 indexing, but in the end its arbitrary and largely a measure of who still codes in C. I recall we voted on this and 0 won however if this slows adoption I'm not against 1 based indexing but we do need to choose either 0 or 1 and not support both or make it dependent upon the underlying format! JSON doesn't define any standard on this that I know of. An array is just an ordered list of things, so it's going to be up to the language reading it to index into the array (if Python it will be 0 based). If Perl, use $[ and confuse everyone. |
I did not want to bring up the first point in JB's post at all, so please forget that. I did want to suggest indexing from 1. I think we will reduce confusion if we can at least have our format use the same numbers for datakeys and frame numbers in the cases where there is sequential label numbers and corresponding 4D (e.g. probabilistic) atlas files. This is true for a lot of the atlases currently shipped with FSL, and I'm sure this won't make the SPM folks unhappy! ;) P.S. As for "a measure of who still codes in C" - isn't it now largely a measure of who codes in python? |
Many anatomical labelling schemes do use a zero label (if that is what is meant by "datakey") for background ("unlabelled") voxels or vertices. See also: https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html |
Indexing conventions of the underlying data file are what they are. We are describing how to get data from the underlying format. This metadata format shouldn't constraint anything unless we are discussing indexing of items completely within our own file. I'm not aware we are indexing anything (structures, etc) in the JSON format itself. We've discussed that some formats may use strings as datakeys. That example in itself means that the details of the indexing have to be flexible, even more flexible than 0- or 1-based. That has the advantage of sidestepping a religious war that has already been fought by other format writers who doubtless have their own logic. That doesn't mean you can't have a "best practices" guide that suggests one or the other. Practically, at the SPL we use 0 for background in our atlases, and we don't use nifti, and we have funded efforts to support DICOM segmentation objects. |
Q: change convention to 1 indexing to get the datakeys right (most of the time ...) ?
The text was updated successfully, but these errors were encountered: