devel > Dimensionality and scalar data
Showing 1-5 of 5 posts
Display:
Results per page:
Apr 4, 2008  08:04 AM | Olivier Coulon
Dimensionality and scalar data
Hello everybody,
trying to read the gii files uploaded by Ziad, the following question arised : when storing a data array of, say, 20000 triangles, one has to write this :
Dimensionality="2"
Dim0="20000"
Dim1="3"
i.e. 20000 elements of dimension 3. When it comes to scalar data, this transposes to :
Dimensionality="2"
Dim0="20000"
Dim1="1"
i.e. 20000 elements of dimension 1, as given in John's example files.
In Ziad's files it is declared as :
Dimensionality="1"
Dim0="20000"
which is one element of dimension 20000.
Are both ways OK ? Or did I misunderstand something ?
Thanks,

Olivier
Apr 4, 2008  03:04 PM | John Harwell - Washington University School of Medicine
Dimensionality and scalar data
Olivier,

Defining the dimensionality of each data intent is a good topic for
our next phone conference.

I propose the following:

NIFTI_INTENT_POINTSET, NIFTI_INTENT_VECTOR
Dimensionality=2
Dim0=#nodes
Dim1=3 (x, y, z components)

NIFTI_INTENT_TRIANGLE
Dimensionality=2
Dim0=#triangles
Dim1=3 (node numbers that form a triangle)

NIFTI_INTENT_RGB_VECTOR
Dimensionality=2
Dim0=#nodes
Dim1=3 (red, green, blue components)
Should the range of data values be (0, 255) or (0.0, 1.0)?

NIFTI_INTENT_RGBA_VECTOR
Dimensionality=2
Dim0=#nodes
Dim1=4 (red, green, blue, alpha components)
Should the range of data values be (0, 255) or (0.0, 1.0)?


NIFTI_INTENT_* (statistic)
NIFTI_INTENT_LABEL
NIFTI_INTENT_NODE_INDEX
NIFTI_INTENT_SHAPE
NIFTI_INTENT_TIME_SERIES

These intents can be either (I have no preference but we should pick
one):

Dimensionality=2
Dim0=#nodes
Dim1=1

or

Dimensionality=1
Dim0=#nodes


John

>
>>
>> By: Olivier Coulon
>>
>> Hello everybody,
>> trying to read the gii files uploaded by Ziad, the following
>> question arised
>> : when storing a data array of, say, 20000 triangles, one has to
>> write this :
>> Dimensionality="2"
>> Dim0="20000"
>> Dim1="3"
>> i.e. 20000 elements of dimension 3. When it comes to scalar data,
>> this transposes
>> to :
>> Dimensionality="2"
>> Dim0="20000"
>> Dim1="1"
>> i.e. 20000 elements of dimension 1, as given in John's example files.
>> In Ziad's files it is declared as :
>> Dimensionality="1"
>> Dim0="20000"
>> which is one element of dimension 20000.
>> Are both ways OK ? Or did I misunderstand something ?
>> Thanks,
>>
> Olivier
Apr 4, 2008  03:04 PM | Olivier Coulon
RE: Dimensionality and scalar data
I agree with everything you propose. For the stats, labels, etc.... I prefer the first solution :
Dimensionality=2
Dim0=#nodes
Dim1=1
because it is more consistent with the others (and because that's the way I already programmed it), but I won't argue much if somebody prefers the other one.

Olivier
Apr 4, 2008  05:04 PM | Richard Reynolds
RE: Dimensionality and scalar data
It doesn't really matter to our software. We will read it
either way, and know that they mean the same thing.

---

As far as preference goes, it makes more sense to us to call
it a 1-dimensional array, rather than a 2-dimensional array
where the second dimension is of length 1. A node index list
is just a list of integers (node indices).

To be explicit, a list of triangles is a list of T tuples
(each of length 3), and so it makes sense to store them as a
2-dimensional matrix of T x 3 node indices (integers).
Similarly, nodes (coordinates) can be stored as N x 3 real
numbers.

But a list of node indices is just N integers. One doesn't
usually talk about having N x 1 numbers in a simple list.

---

What might the advantage be in considering a node list to be
2-dimensional, assuming we decide to choose between the two
styles?

---

Again, it doesn't matter to our software. Any extra 1's are
simply ignored.

- rick
Apr 4, 2008  07:04 PM | Erik Anderson
RE: Dimensionality and scalar data
I agree with what Rick said, although there are some fundamental differences in terms of what Python will give you when it sees something like this. In terms of being able to read and process the data, nothing will change. The Python side of things will generate this as a [n x 1] numpy array. However, this will rather substantially impact the way in which data access has to happen. For example:

In the [n x 1] (2-dimensional) case:
>>> a = input[0]
>>> a.shape
(100,)

a will be a 1-dimensional array of all elements. To get the first element:
>>> a = input[0,0]
>>> print a
'5'

However, in the 1-dimensional case:
>>> a = input[0]
>>> print a
'5'

>>> input.shape
(100,)

This (I hope) illustrates the real difference in terms of what will happen on the Python side of things. I don't think that there's a clear advantage to either one, but there are some more subtle issues that might come up.

Erik