INCF / HAWG-examples

HAWG example JSON files
6 stars 9 forks source link

Mark's and Mark's developers thoughts: 0-1 indexing #11

Open jbpoline opened 8 years ago

jbpoline commented 8 years ago

Q: change convention to 1 indexing to get the datakeys right (most of the time ...) ?

andrewjanke commented 8 years ago

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.

markj789 commented 8 years ago

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?

rdvincent commented 8 years ago

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

mhalle commented 8 years ago

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.