brainlife / app-life

LiFE (Linear Fasicle Evaluation) predicts the measured diffusion signal using the orientation of the fascicles present in a connectome. LiFE uses the difference between the measured and predicted diffusion signals to measure prediction error. The connectome model prediction error is used to compute two metrics to evaluate the evidence supporting properties of the connectome.
1 stars 5 forks source link

LiFE failing to output tracts json #4

Closed soichih closed 6 years ago

soichih commented 7 years ago

I started seeing this error recently.

{Undefined function 'round' for input arguments of type 'cell'.

Error in main (line 47)
fg_sub.fibers = round(fg.fibers(1:10:end,:), 4);
} 
soichih commented 7 years ago

@kitchell Can you take a look?

ccaiafa commented 7 years ago

Please, note that if you need to obtain voxel spatial indices the proper computation is: [ix,iy,iz] = round(fiber_node_coordinate) + 1 fg.fibers is a cell array, if you need to apply the round you may consider to convert it to a matrix array first by doing cell2mat(fg.fibers'). We use this in the Encoding step.

kitchell commented 7 years ago

yes, I expected this and then promptly forgot about it. Thank you cesar! We are trying to round the coordinates for displaying, so converting to a matrix is probably the correct step.

kitchell commented 7 years ago

ok this is fixed. I ended up using cellfun() instead.

soichih commented 7 years ago

Confirmed it's fixed.

    "coords": [
        [
            [
                [54.7546,54.359,54.1398,53.8987,53.8059,53.8185,53.5491,52.8782,52.1366,51.4071,50.7941,50.2157,49.5811],
                [7.1719,6.5543,5.9854,5.4921,5.1832,4.9217,4.7911,4.5864,4.3281,4.1478,4.292,4.4104,4.5201],
                [-9.4633,-10.1346,-10.9146,-11.7442,-12.6791,-13.6318,-14.5623,-15.2671,-15.8769,-16.5237,-17.2859,-18.0843,-18.8454]
            ]
        ],

Although.. it would be nice if the middle [ can be eliminated. It's unnecessary.

On the stdout log, I am seeing the dump of all tracts json content.

  Columns 134247 through 134253

   39.5260   39.4846   39.3176   39.1135   39.0502   38.8090   38.8036
  -32.1953  -31.2086  -30.2394  -29.2685  -28.2792  -27.3175  -26.3238
   -7.9625   -7.9882   -7.8721   -7.9322   -7.9890   -8.0778   -8.1420

  Columns 134254 through 134260

   38.7572   38.8392   38.8062   38.7895   38.6056   38.3126   37.9672
  -25.3281  -24.3701  -23.4138  -22.4411  -21.4635  -20.5212  -19.6007
   -8.1604   -8.4166   -8.6817   -8.8450   -8.9062   -8.9714   -9.1243

I am not sure where it's coming from, but it should be suppressed to keep stdout log clean.

Finally, I now see weights listed in the JSON, Great! However, the weights are generated in following format.

        [0.001473579292],
        [0.003098705637],
        [0.004365821434],
        [0],
        [0],
        [0.002825236992]

Is there anyway you can output this in following format?

        [0.001473579292, 0.003098705637, 0.004365821434, 0, 0, 0.002825236992]
kitchell commented 7 years ago

I forgot a semicolon, it is there now so it will not print the coordinates. I will look into reformatting the weights when I have time. feel free to look into it as well in the meantime.

kitchell commented 7 years ago

The double [[ ]] is exactly how the afq tract jsons look as well. it seems to work fine for that app. I believe that is how savejson writes it out.