brainvisa / sulci-nonfree

Morphologist sulci identification subproject
0 stars 0 forks source link

Hip-Hop insular pole projection fails in branch 5.1 #1

Closed ylep closed 1 year ago

ylep commented 1 year ago

During Hip-Hop:

Dilation Erosion Done Topological correction...

in Insular Pole Projection 2

ValueError
Traceback (most recent call last):
  File "/casa/host/build/python/brainvisa/processes.py", line 3399, in _processExecution
    result = process.execution(self)
  File "/casa/host/build/brainvisa/toolboxes/cortical_surface/processes/anatomy/tools/InsularPoleProjection.py", line 137, in execution
    cingular_tex_clean, cing_tex_boundary = textureTls.textureTopologicalCorrection(mesh, tex[0].arraydata(), tmp_tex_value)
ValueError: not enough values to unpack (expected 2, got 0)

Environment:

Additional context I will give it a look to try and fix it today

ylep commented 1 year ago

That bit of code seems to be problematic:

    if self.side == 'right':
        tmp_tex_value = 2
    elif self.side == 'left':
        tmp_tex_value = 1
    else:
        context.write('side must be set to left or right!')

That code hasn’t changed in the last 10 years, but at that stage, the actual texture label is 1 for the right hemisphere (the code seems to only fail for right hemispheres).

@denisri It seems that the behaviour of siMeshSulciProjection has changed: it outputs a texture with 0 and 1 labels even though it is given a right hemisphere with the correct INSULA_right label, and it seems that it should really output a label 2 according to its -t output:

INSULA_left 1
INSULA_right    2
unknown 3

For what it’s worth, here is the complete output of that command:

$ 'siMeshSulciProjection' '-i' '/volatile/bv/db/disco_testdb/demo_data/sujet01/t1mri/default_acquisition/default_analysis/segmentation/mesh/sujet01_Rwhite.gii' '-g' '/volatile/bv/db/disco_testdb/demo_data/sujet01/t1mri/default_acquisition/default_analysis/folds/3.1/deep_cnn_test_auto/Rsujet01_deep_cnn_test_auto.arg' '-l' '/tmp/bv_le7i44sz.txt' '-m' '/casa/host/build/share/brainvisa-share-5.1/models/models_2008/discriminative_models/3.0/gyrus/gyri.gyr' '-s' 'label' '-v' '/volatile/bv/db/disco_testdb/demo_data/sujet01/t1mri/default_acquisition/default_analysis/nobias_sujet01.nii' '-o' '/volatile/bv/db/disco_testdb/demo_data/sujet01/t1mri/default_acquisition/default_analysis/segmentation/mesh/surface_analysis/sujet01_Rwhite_pole_insula.gii' '-V' '1' '-M' '2' '-n' '5' '-a' '0.9' '-e' '10' '-t' '/tmp/bv_opkesyty.txt' '-p' '1'
reading triangulation   : done
reading volume info
Read the graph
4 labels de sillons lus.
Reading FGraph version 4.6
Warning: wrong filename_base in graph, trying to fix it
graph read
CA: (107.812, 114.375, 105.6)
v: ventricle_right
ventricleIn: 1
Write /tmp/bv_opkesyty.txt file
Definition of the volume of labels...
Read gyri model file 
The sulci F.C.M._left does not exist at this level of translation...
The sulci F.Cal.ant.-Sc.Cal._left does not exist at this level of translation...
The sulci F.I.P._left does not exist at this level of translation...
The sulci F.P.O._left does not exist at this level of translation...
The sulci F.C.M._right does not exist at this level of translation...
The sulci F.Cal.ant.-Sc.Cal._right does not exist at this level of translation...
The sulci F.I.P._right does not exist at this level of translation...
The sulci F.P.O._right does not exist at this level of translation...
insert: INSULA_left( Frontal-Inferior_left )
The sulci S.F.inf._left does not exist at this level of translation...
insert: INSULA_right( Frontal-Inferior_right )
The sulci S.F.inf._right does not exist at this level of translation...
The sulci S.F.inf._left does not exist at this level of translation...
The sulci S.F.sup._left does not exist at this level of translation...
The sulci S.F.inf._right does not exist at this level of translation...
The sulci S.F.sup._right does not exist at this level of translation...
The sulci F.C.M._left does not exist at this level of translation...
The sulci S.F.sup._left does not exist at this level of translation...
The sulci F.C.M._right does not exist at this level of translation...
The sulci S.F.sup._right does not exist at this level of translation...
The sulci F.Cal.ant.-Sc.Cal._left does not exist at this level of translation...
The sulci F.Coll._left does not exist at this level of translation...
The sulci F.Cal.ant.-Sc.Cal._right does not exist at this level of translation...
The sulci F.Coll._right does not exist at this level of translation...
The sulci S.F.orbitaire._left does not exist at this level of translation...
The sulci S.R.inf._left does not exist at this level of translation...
The sulci S.F.orbitaire._right does not exist at this level of translation...
The sulci S.R.inf._right does not exist at this level of translation...
The sulci S.C._left does not exist at this level of translation...
The sulci S.Po.C._left does not exist at this level of translation...
The sulci S.C._right does not exist at this level of translation...
The sulci S.Po.C._right does not exist at this level of translation...
The sulci S.C._left does not exist at this level of translation...
The sulci S.Pe.C._left does not exist at this level of translation...
The sulci S.C._right does not exist at this level of translation...
The sulci S.Pe.C._right does not exist at this level of translation...
The sulci S.O.T.lat._left does not exist at this level of translation...
The sulci S.T.i._left does not exist at this level of translation...
The sulci S.O.T.lat._right does not exist at this level of translation...
The sulci S.T.i._right does not exist at this level of translation...
The sulci S.T.i._left does not exist at this level of translation...
The sulci S.T.s._left does not exist at this level of translation...
The sulci S.T.i._right does not exist at this level of translation...
The sulci S.T.s._right does not exist at this level of translation...
insert: INSULA_left( Temporal-Superior_left )
The sulci S.T.s._left does not exist at this level of translation...
insert: INSULA_right( Temporal-Superior_right )
The sulci S.T.s._right does not exist at this level of translation...
The sulci OCCIPITAL_left does not exist at this level of translation...
The sulci S.O.T.lat._left does not exist at this level of translation...
The sulci OCCIPITAL_right does not exist at this level of translation...
The sulci S.O.T.lat._right does not exist at this level of translation...
The sulci F.Coll._left does not exist at this level of translation...
The sulci S.O.T.lat._left does not exist at this level of translation...
The sulci F.Coll._right does not exist at this level of translation...
The sulci S.O.T.lat._right does not exist at this level of translation...
The sulci F.C.M._left does not exist at this level of translation...
The sulci S.Call._left does not exist at this level of translation...
The sulci F.C.M._right does not exist at this level of translation...
The sulci S.Call._right does not exist at this level of translation...
The sulci S.Call._left does not exist at this level of translation...
The sulci ventricle_left does not exist at this level of translation...
The sulci S.Call._right does not exist at this level of translation...
The sulci ventricle_right does not exist at this level of translation...
The sulci ventricle_left does not exist at this level of translation...
The sulci ventricle_right does not exist at this level of translation...
The sulci F.Coll._left does not exist at this level of translation...
The sulci ventricle_left does not exist at this level of translation...
The sulci F.Coll._right does not exist at this level of translation...
The sulci ventricle_right does not exist at this level of translation...
insert: INSULA_left( gyrus20_left )
The sulci ventricle_left does not exist at this level of translation...
insert: INSULA_right( gyrus20_right )
The sulci ventricle_right does not exist at this level of translation...
The sulci F.I.P._left does not exist at this level of translation...
The sulci S.T.s._left does not exist at this level of translation...
The sulci F.I.P._right does not exist at this level of translation...
The sulci S.T.s._right does not exist at this level of translation...
Ordering the triangulation nodes (clockwise)done
mesh vertices : 65413
mesh polygons : 130822
Selecting the sulci to be projected
Closing Sulcal lines  
Label: INSULA_right
Closing Sulcal surface 
Label: INSULA_right
Some points have the label 'INSULA'
Find the neighbourhood of each bottom point in the sulci
Size of the CC : 1660
Neighbouring level: 0 
Extracting connex components (with at least 5 points in each components)
z: 123
2 components
component    1 :     1660 points
filtering...
after filtering: 1 components
First projection...
49 points could not have been projected because the tangent plane could not be estimated 
Estimation of affine transformation...

1th connected component(1: INSULA_left)
Estimation of the affine transformation A 
Affine transformation : 
0.9594 0.06653 -0.1195
-0.00153 0.97 -0.02149
-0.03185 0.03282 0.9354
Translation : 
8.534
-4.099
17.43
Remove outlier for robust estimation of the affine transformation 
1434 points from 1594  are used to estime the regularized transformation
Affine regularized transformation : 
0.9339 0.07198 -0.1108    
0.000152 0.9632 -0.02594    
-0.02555 0.04217 0.9059    
Regularized Translation : 
9.851
-4.376
19.46

Closing the sulci
1 
Nb of labels: 1
1/1
Nb initial of cc: 21
After Dilation (1) : cc: 4
After Dilation (2) : cc: 1
With hole(s) 
Skeletonization
No thinning for the INSULA
writing texture : done
ylep commented 1 year ago

Could this be linked to the fact that I have an automatically-labelled graph without name attributes, but there seems to be hard-coded references to "name" in multiple places, e.g.:

https://github.com/brainvisa/sulci-nonfree/blob/694c21103339443c674f9bac20008758df689e25/sigraph/src/siMeshSulciProjection/main.cc#L275

ylep commented 1 year ago

Blindly replacing "name" with sname does not work (the ASSERT() fails) so there is obviously some subtleties that I am not aware of. @denisri I will leave that one to you, I think you will be much faster than me to understand what is going wrong here.

denisri commented 1 year ago

OK I'm looking at it.

denisri commented 1 year ago

Could this be linked to the fact that I have an automatically-labelled graph without name attributes, but there seems to be hard-coded references to "name" in multiple places, e.g.:

Not there. Labels have been translated and stored in name at l. 267:

    levelTrans.translate( fg, sname, "name" );