open-discussion > Problem with SPHARM-PDM on new dataset!
Showing 1-21 of 21 posts
Display:
Results per page:
Sep 27, 2016  02:09 PM | Nazanin M
Problem with SPHARM-PDM on new dataset!
Hello SPHARM experts, 

I have successfully completed the tutorial (SPHARM-PDM_Tutorial_July2015.pdf), and obtained the exact same results.

However, doing the same procedure on my own data (.nii format) gives me some errors. (I'm using the latest version of Slicer (4.5.0-1), and I'm on Ubuntu 14.04).

The error says it is unable to open pp_surf.vtk and pp_para.vtk, however, both files exist and can be opened. The data inside looks normal. I really appreciate it if you could tell me what is wrong here. Thanks.

Following is my log:

Shape Analysis Module standard output:

------ Shape Analysis Module start -----
Computing ShapeAnalysisModule...
/home/nm/SPHARM_data/Tutorial_Output1/
/home/nm/SPHARM_data/Tutorial_Output1/ShapeAnalysisModule.bms
Number of Datas: 4
Executing BatchMake...
Case:/home/nm/SPHARM_data/origData/95330358_090112/my_data.nii
Doing Post Processing
Status: Start SegPostProcessCLP /home/nm/SPHARM_data/origData/95330358_090112/my_data.nii /home/nm/SPHARM_data/Tutorial_Output1/Mesh/PostProcess/my_data_pp.gipl.gz --rescale --space 0.5,0.5,0.5
run: 'SegPostProcessCLP' '''/home/nm/SPHARM_data/origData/95330358_090112/my_data.nii' '/home/nm/SPHARM_data/Tutorial_Output1/Mesh/PostProcess/my_data_pp.gipl.gz' --rescale --space '0.5,0.5,0.5'''
Status: Finish: Execution time 3001ms
Doing GenParaMesh
Status: Start GenParaMeshCLP --EulerFile --outEulerName /home/nm/SPHARM_data/Tutorial_Output1/EulerFiles/my_data_euler.txt --iter 126 --label 1 /home/nm/SPHARM_data/Tutorial_Output1/Mesh/PostProcess/my_data_pp.gipl.gz /home/nm/SPHARM_data/Tutorial_Output1/Mesh/SPHARM/my_data_pp_para.vtk /home/nm/SPHARM_data/Tutorial_Output1/Mesh/SPHARM/my_data_pp_surf.vtk
run: 'GenParaMeshCLP' ''--EulerFile --outEulerName '/home/nm/SPHARM_data/Tutorial_Output1/EulerFiles/my_data_euler.txt' --iter '126' --label '1' '/home/nm/SPHARM_data/Tutorial_Output1/Mesh/PostProcess/my_data_pp.gipl.gz' '/home/nm/SPHARM_data/Tutorial_Output1/Mesh/SPHARM/my_data_pp_para.vtk' '/home/nm/SPHARM_data/Tutorial_Output1/Mesh/SPHARM/my_data_pp_surf.vtk'''
Status: Finish: Execution time 301ms
Doing ParaToSPHARMMesh
Creating Template
Status: Start ParaToSPHARMMeshCLP /home/nm/SPHARM_data/Tutorial_Output1/Mesh/SPHARM/my_data_pp_para.vtk /home/nm/SPHARM_data/Tutorial_Output1/Mesh/SPHARM/my_data_pp_surf.vtk /home/nm/SPHARM_data/Tutorial_Output1/Template/my_data_pp_surf --subdivLevel 10 --spharmDegree 15 --FinalFlip 0 --paraOut --phiIteration 100 --thetaIteration 100 --medialMesh
run: 'ParaToSPHARMMeshCLP' '''/home/nm/SPHARM_data/Tutorial_Output1/Mesh/SPHARM/my_data_pp_para.vtk' '/home/nm/SPHARM_data/Tutorial_Output1/Mesh/SPHARM/my_data_pp_surf.vtk' '/home/nm/SPHARM_data/Tutorial_Output1/Template/my_data_pp_surf' --subdivLevel '10' --spharmDegree '15' --FinalFlip '0' --paraOut --phiIteration '100' --thetaIteration '100' --medialMesh''
Status: Finish: Execution time 1500ms
ParaToSPHARMMesh: ERROR: In /home/kitware/Dashboards/Nightly/S-450-E-b/SPHARM-PDM-build/VTK/IO/Legacy/vtkDataReader.cxx, line 466
vtkPolyDataReader (0x1f210f0): Unable to open file: /home/nm/SPHARM_data/Tutorial_Output1/Mesh/SPHARM/my_data_pp_surf.vtk
ERROR: In /home/kitware/Dashboards/Nightly/S-450-E-b/SPHARM-PDM-build/VTK/IO/Legacy/vtkDataReader.cxx, line 466
vtkPolyDataReader (0x1f210f0): Unable to open file: /home/nm/SPHARM_data/Tutorial_Output1/Mesh/SPHARM/my_data_pp_para.vtk
regTemplate: my_data_pp_surfSPHARM.vtk
flipTemplate: my_data_pp_surfSPHARM.coef
Status: Start ParaToSPHARMMeshCLP /home/nm/SPHARM_data/Tutorial_Output1/Mesh/SPHARM/my_data_pp_para.vtk /home/nm/SPHARM_data/Tutorial_Output1/Mesh/SPHARM/my_data_pp_surf.vtk /home/nm/SPHARM_data/Tutorial_Output1/Mesh/SPHARM/my_data_pp_surf --regTemplateFileOn --regTemplate /home/nm/SPHARM_data/Tutorial_Output1/Template/my_data_pp_surfSPHARM.vtk --flipTemplateOn --flipTemplate /home/nm/SPHARM_data/Tutorial_Output1/Template/my_data_pp_surfSPHARM.coef --subdivLevel 10 --spharmDegree 15 --FinalFlip 0 --paraOut --phiIteration 100 --thetaIteration 100 --medialMesh
run: 'ParaToSPHARMMeshCLP' '''/home/nm/SPHARM_data/Tutorial_Output1/Mesh/SPHARM/my_data_pp_para.vtk' '/home/nm/SPHARM_data/Tutorial_Output1/Mesh/SPHARM/my_data_pp_surf.vtk' '/home/nm/SPHARM_data/Tutorial_Output1/Mesh/SPHARM/my_data_pp_surf' --regTemplateFileOn --regTemplate '/home/nm/SPHARM_data/Tutorial_Output1/Template/my_data_pp_surfSPHARM.vtk' --flipTemplateOn --flipTemplate '/home/nm/SPHARM_data/Tutorial_Output1/Template/my_data_pp_surfSPHARM.coef' --subdivLevel '10' --spharmDegree '15' --FinalFlip '0' --paraOut --phiIteration '100' --thetaIteration '100' --medialMesh''
Status: Finish: Execution time 1800ms
ParaToSPHARMMesh: ERROR: In /home/kitware/Dashboards/Nightly/S-450-E-b/SPHARM-PDM-build/VTK/IO/Legacy/vtkDataReader.cxx, line 466
vtkPolyDataReader (0x28a4b60): Unable to open file: /home/nm/SPHARM_data/Tutorial_Output1/Mesh/SPHARM/my_data_pp_surf.vtk
ERROR: In /home/kitware/Dashboards/Nightly/S-450-E-b/SPHARM-PDM-build/VTK/IO/Legacy/vtkDataReader.cxx, line 466
vtkPolyDataReader (0x28a4b60): Unable to open file: /home/nm/SPHARM_data/Tutorial_Output1/Mesh/SPHARM/my_data_pp_para.vtk
Generic Warning: In /home/kitware/Dashboards/Nightly/S-450-E-b/SPHARM-PDM-build/VTK/IO/Legacy/vtkDataReader.cxx, line 1388
Error reading ascii data. Possible mismatch of datasize with declaration.
/home/kitware/Dashboards/Nightly/S-450-E-b/SPHARM-PDM-build/ITKv4/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd.txx: suspicious return value (3) from SVDC
/home/kitware/Dashboards/Nightly/S-450-E-b/SPHARM-PDM-build/ITKv4/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd.txx: M is 3x3
M = [ ...
-nan -nan -nan
-nan -nan -nan
-nan -nan -nan ]
/home/kitware/Dashboards/Nightly/S-450-E-b/SPHARM-PDM-build/ITKv4/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd.txx: suspicious return value (3) from SVDC
/home/kitware/Dashboards/Nightly/S-450-E-b/SPHARM-PDM-build/ITKv4/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd.txx: M is 3x3
M = [ ...
-nan -nan -nan
-nan -nan -nan
-nan -nan -nan ]
/home/nm/SPHARM_data/Tutorial_Output1/Mesh/SPHARM/my_data_pp_surf_paraPhiHalf.txt
Case:/home/nm/SPHARM_data/origData/95453354_091001/my_data.nii
Doing Post Processing
Status: Start SegPostProcessCLP /home/nm/SPHARM_data/origData/95453354_091001/my_data.nii /home/nm/SPHARM_data/Tutorial_Output1/Mesh/PostProcess/my_data_pp.gipl.gz --rescale --space 0.5,0.5,0.5
run: 'SegPostProcessCLP' '''/home/nm/SPHARM_data/origData/95453354_091001/my_data.nii' '/home/nm/SPHARM_data/Tutorial_Output1/Mesh/PostProcess/my_data_pp.gipl.gz' --rescale --space '0.5,0.5,0.5'''
Status: Finish: Execution time 3001ms
Doing GenParaMesh
Status: Start GenParaMeshCLP --EulerFile --outEulerName /home/nm/SPHARM_data/Tutorial_Output1/EulerFiles/my_data_euler.txt --iter 126 --label 1 /home/nm/SPHARM_data/Tutorial_Output1/Mesh/PostProcess/my_data_pp.gipl.gz /home/nm/SPHARM_data/Tutorial_Output1/Mesh/SPHARM/my_data_pp_para.vtk /home/nm/SPHARM_data/Tutorial_Output1/Mesh/SPHARM/my_data_pp_surf.vtk
run: 'GenParaMeshCLP' ''--EulerFile --outEulerName '/home/nm/SPHARM_data/Tutorial_Output1/EulerFiles/my_data_euler.txt' --iter '126' --label '1' '/home/nm/SPHARM_data/Tutorial_Output1/Mesh/PostProcess/my_data_pp.gipl.gz' '/home/nm/SPHARM_data/Tutorial_Output1/Mesh/SPHARM/my_data_pp_para.vtk' '/home/nm/SPHARM_data/Tutorial_Output1/Mesh/SPHARM/my_data_pp_surf.vtk'''
Status: Finish: Execution time 7202ms
Doing ParaToSPHARMMesh
regTemplate: my_data_pp_surfSPHARM.vtk
flipTemplate: my_data_pp_surfSPHARM.coef
Case:/home/nm/SPHARM_data/origData/95491648_081204/my_data.nii
Doing Post Processing
Status: Start SegPostProcessCLP /home/nm/SPHARM_data/origData/95491648_081204/my_data.nii /home/nm/SPHARM_data/Tutorial_Output1/Mesh/PostProcess/my_data_pp.gipl.gz --rescale --space 0.5,0.5,0.5
run: 'SegPostProcessCLP' '''/home/nm/SPHARM_data/origData/95491648_081204/my_data.nii' '/home/nm/SPHARM_data/Tutorial_Output1/Mesh/PostProcess/my_data_pp.gipl.gz' --rescale --space '0.5,0.5,0.5'''
Status: Finish: Execution time 3002ms
Doing GenParaMesh
Doing ParaToSPHARMMesh
regTemplate: my_data_pp_surfSPHARM.vtk
flipTemplate: my_data_pp_surfSPHARM.coef
Case:/home/nm/SPHARM_data/origData/96892753_120209/my_data.nii
Doing Post Processing
Status: Start SegPostProcessCLP /home/nm/SPHARM_data/origData/96892753_120209/my_data.nii /home/nm/SPHARM_data/Tutorial_Output1/Mesh/PostProcess/my_data_pp.gipl.gz --rescale --space 0.5,0.5,0.5
run: 'SegPostProcessCLP' '''/home/nm/SPHARM_data/origData/96892753_120209/my_data.nii' '/home/nm/SPHARM_data/Tutorial_Output1/Mesh/PostProcess/my_data_pp.gipl.gz' --rescale --space '0.5,0.5,0.5'''
Status: Finish: Execution time 2703ms
Doing GenParaMesh
Doing ParaToSPHARMMesh
regTemplate: my_data_pp_surfSPHARM.vtk
flipTemplate: my_data_pp_surfSPHARM.coef
Executing BatchMake: Done!
Execute Meshmath...
Mapping parameters in SPHARM template meshes using MeshMath
Path for MeshMathTemplate: /home/nm/SPHARM_data/Tutorial_Output1/Template/
DONE COMPUTING SPHARM

And the error log:

Unable to open file: /home/nm/SPHARM_data/Tutorial_Output1/Mesh/SPHARM/my_data_pp_para.vtk
Error: Generic Warning: In /home/kitware/Dashboards/Nightly/S-450-E-b/SPHARM-PDM-build/VTK/IO/Legacy/vtkDataReader.cxx, line 1388
Error: Error reading ascii data. Possible mismatch of datasize with declaration.
Error: /home/kitware/Dashboards/Nightly/S-450-E-b/SPHARM-PDM-build/ITKv4/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd.txx: suspicious return value (3) from SVDC
Error: /home/kitware/Dashboards/Nightly/S-450-E-b/SPHARM-PDM-build/ITKv4/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd.txx: M is 3x3
Error: M = [ ...
Error: -nan -nan -nan
Error: -nan -nan -nan
Error: -nan -nan -nan ]
Error: /home/kitware/Dashboards/Nightly/S-450-E-b/SPHARM-PDM-build/ITKv4/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd.txx: suspicious return value (3) from SVDC
Error: /home/kitware/Dashboards/Nightly/S-450-E-b/SPHARM-PDM-build/ITKv4/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd.txx: M is 3x3
Error: M = [ ...
Error: -nan -nan -nan
Error: -nan -nan -nan
Error: -nan -nan -nan ]
Executing BatchMake: Error!
Oct 29, 2016  11:10 AM | Antoine Bouyeure
RE: Problem with SPHARM-PDM on new dataset!
Hello,

Same here. I successfully completed the SPHARM tutorial but the processing of my own data does not work quite as well. SPHARM-PDM runs until the end of the process but with the same errors as the ones described above, and I am unable to visualize the obtained outputs.
Since my files are in NIFT format, I figured it might be a format compatibility problem, and converted my files to .gipl using c3D converter. However, I still got the same problem : SPHARM runs apparently okay and generates output files, but the inspection fo the error log indicates that the software is unable to open these files, and when trying to open them with 3D slicer (or with ITK snap), it doesn't work and i am not able to visualize the output files.


Any clue ?


Thanks for your help,
Antoine
Oct 30, 2016  09:10 AM | Nazanin M
RE: Problem with SPHARM-PDM on new dataset!
Hi Antonie,

I could successfully solve my issue. First of all, SPHARM works with NIFTI format so you don't need to convert them to .gipl. Secondly, look at the euler files in euler folder, and see what the numbers are written for each file. A euler number of 2 means it has a spherical topology and basically you are good to go, otherwise, look at your segmentation files and you may find holes or C-shape areas which you have to avoid.
(Another thing that happened in my case was that the segmentation had a good spherical topology, but it still produced euler number of 0. I ran the PosrProcessSeg command in terminal with different arguments, and played around with it to match my files, and finally were able to produce the _pp_para.vtk and _pp_surf.vtk)

Hope this helps.
Oct 30, 2016  11:10 AM | Antoine Bouyeure
RE: Problem with SPHARM-PDM on new dataset!
Hello Nazanin,

Thank you for your help. I ran SPHARM-PDM on several datasets and it worked for some of them.  I guess the data of my first shot had segmentation issues.
However, I now experience trouble with shapeAnalasysisMANCOVA - did the statisitical analyses worked for you ?
I got the following error :

./shapeAnalysisMANCOVA chemin.csv --columnGroupTypes 0 --infileColumn 1
input file specified: chemin.csv
filename: chemin.csv numIndependent: 0
Num Subjects: 2

data in group_type 0 has been relabeled: 0 --> group A = -1 ; 1 --> group B = 1
#(A)= 1; #(B)= 1
/home/antoine/Downloads/lalala/Mesh/SPHARM/perirhinal1_pp_surfSPHARM_procalign.vtk -1 6.9485e-310
/home/antoine/Downloads/lalala/Mesh/SPHARM/perirhinal2_pp_surfSPHARM_procalign.vtk 1 6.9485e-310
reading Mesh /home/antoine/Downloads/lalala/Mesh/SPHARM/perirhinal1_pp_surfSPHARM_procalign.vtk - .vtk
ERROR: In /NIRAL/work/mjacquem/spharm_build/VTK/IO/vtkDataReader.cxx, line 500
vtkPolyDataReader (0xe90860): Unrecognized file type: ObjectType = Mesh for file: /home/antoine/Downloads/lalala/Mesh/SPHARM/perirhinal1_pp_surfSPHARM_procalign.vtk
CellType required and not defined.
MetaObject: Read: MET_Read Failed
reading Mesh /home/antoine/Downloads/lalala/Mesh/SPHARM/perirhinal2_pp_surfSPHARM_procalign.vtk - .vtk
Aborting: No Points in GRID
No statistic type selected, defaulting to Hotelling.
Now running nonparametric tests:
Performing MANCOVA permutation testing.
Using 10000 permutations.
Completed MANCOVA permutation testing.
fdr thresh (MANCOVA) is = 0
Runtime was 0 minute(s) and 0 second(s).
CellType required and not defined.
MetaObject: Read: MET_Read Failed
Aborting: No Points in GRID
Error: Could not run MeshMath:
No such file or directory
Error: Could not run MeshMath:
No such file or directory
Error: Could not run MeshMath:
No such file or directory
Error: Could not run MeshMath:
No such file or directory
Error: Could not run MeshMath:
No such file or directory
Error: Could not run MeshMath:
No such file or directory
terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::erase
Aborted (core dumped)


Is it failing because the .vtk files I got from ShapeAnalysisModule are kind of corrupted ? Does it still have to do with a segmentation problem or did the prior SPHARM-PDM analyses went wrong at some point ?


Thanks,
Antoine
Oct 31, 2016  07:10 AM | Martin Styner
RE: Problem with SPHARM-PDM on new dataset!
Hi Nazine and Antoine
Nazine is fully correct, you need to check the spherical topology files. Not perfectly intuitive. Also, loading the postprocessed segmentation in ITK-Snap and looking at the 3D reconstruction (you need to turn off the Gaussian smoothing that ITK-Snap uses for the reconstruction in order to get your raw surface) for holes or single edge connections.

The good news is that NIH just funded a R01 (Beatriz Paniagua is the PI) to take our shape toolbox to the next level (it will be called SALT for Shape AnaLysis Toolbox) and we will ensure that the user interface will be significantly improved to let users know whether there is an issue with the spherical topology as well as provide feedback about the locations on the surface that create the issues.

Best 
Martin
Originally posted by Nazanin M:
Hi Antonie,

I could successfully solve my issue. First of all, SPHARM works with NIFTI format so you don't need to convert them to .gipl. Secondly, look at the euler files in euler folder, and see what the numbers are written for each file. A euler number of 2 means it has a spherical topology and basically you are good to go, otherwise, look at your segmentation files and you may find holes or C-shape areas which you have to avoid.
(Another thing that happened in my case was that the segmentation had a good spherical topology, but it still produced euler number of 0. I ran the PosrProcessSeg command in terminal with different arguments, and played around with it to match my files, and finally were able to produce the _pp_para.vtk and _pp_surf.vtk)

Hope this helps.
Oct 31, 2016  08:10 AM | Martin Styner
RE: Problem with SPHARM-PDM on new dataset!
Hi Antoint and Nazine
The issue with shapeAnalysisMANCOVA is that it's old and needs significant re-development. It uses the old style ITK meshes (also called Meta meshes) and not the current VTK meshes. Thus, if you want to use shapeAnalysisMANCOVA you need to convert the VTK meshes first (there are mesh converter tools in the SPHARM-PDM distribution for this purpose) and adapt your csv file (to point to the converted meta meshes).

As mentioned in my other posts, we are working on the next level shape toolkit called SALT. This issue should be resolved with that new SALT toolkit, as it will have a novel statistical tool with significant improvement both in statistical methodology as well as user-interface.

Best
Martin
Originally posted by Antoine Bouyeure:
Hello Nazanin,

Thank you for your help. I ran SPHARM-PDM on several datasets and it worked for some of them.  I guess the data of my first shot had segmentation issues.
However, I now experience trouble with shapeAnalasysisMANCOVA - did the statisitical analyses worked for you ?
I got the following error :

./shapeAnalysisMANCOVA chemin.csv --columnGroupTypes 0 --infileColumn 1
input file specified: chemin.csv
filename: chemin.csv numIndependent: 0
Num Subjects: 2

data in group_type 0 has been relabeled: 0 --> group A = -1 ; 1 --> group B = 1
#(A)= 1; #(B)= 1
/home/antoine/Downloads/lalala/Mesh/SPHARM/perirhinal1_pp_surfSPHARM_procalign.vtk -1 6.9485e-310
/home/antoine/Downloads/lalala/Mesh/SPHARM/perirhinal2_pp_surfSPHARM_procalign.vtk 1 6.9485e-310
reading Mesh /home/antoine/Downloads/lalala/Mesh/SPHARM/perirhinal1_pp_surfSPHARM_procalign.vtk - .vtk
ERROR: In /NIRAL/work/mjacquem/spharm_build/VTK/IO/vtkDataReader.cxx, line 500
vtkPolyDataReader (0xe90860): Unrecognized file type: ObjectType = Mesh for file: /home/antoine/Downloads/lalala/Mesh/SPHARM/perirhinal1_pp_surfSPHARM_procalign.vtk
CellType required and not defined.
MetaObject: Read: MET_Read Failed
reading Mesh /home/antoine/Downloads/lalala/Mesh/SPHARM/perirhinal2_pp_surfSPHARM_procalign.vtk - .vtk
Aborting: No Points in GRID
No statistic type selected, defaulting to Hotelling.
Now running nonparametric tests:
Performing MANCOVA permutation testing.
Using 10000 permutations.
Completed MANCOVA permutation testing.
fdr thresh (MANCOVA) is = 0
Runtime was 0 minute(s) and 0 second(s).
CellType required and not defined.
MetaObject: Read: MET_Read Failed
Aborting: No Points in GRID
Error: Could not run MeshMath:
No such file or directory
Error: Could not run MeshMath:
No such file or directory
Error: Could not run MeshMath:
No such file or directory
Error: Could not run MeshMath:
No such file or directory
Error: Could not run MeshMath:
No such file or directory
Error: Could not run MeshMath:
No such file or directory
terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::erase
Aborted (core dumped)


Is it failing because the .vtk files I got from ShapeAnalysisModule are kind of corrupted ? Does it still have to do with a segmentation problem or did the prior SPHARM-PDM analyses went wrong at some point ?


Thanks,
Antoine
Nov 1, 2016  01:11 PM | Antoine Bouyeure
RE: Problem with SPHARM-PDM on new dataset!
Hello Martin,
Thank you for your answer. Congratulations for the new toolkit, this is great news :) Has an approximative date of release been scheduled yet ?
Best
Antoine
Nov 1, 2016  01:11 PM | Martin Styner
RE: Problem with SPHARM-PDM on new dataset!
It may take a while as we just got the grant. I assume that we will have a clear target date for the first release soon.

Martin
Nov 1, 2016  01:11 PM | D J
RE: Problem with SPHARM-PDM on new dataset!
Hi all,

Exciting to hear about SALT Martin, I look forward to it.

For what it's worth, one of the later versions of shapeanalysisMANCOVA I use with VTK meshes - I believe it does the META conversion internally. My version details says "version: 0.0.1.$Revision: 1.8 $(alpha)" (running on Linux)

Antoine,
I can't recall that error, but it looks like a problem with the procalign VTK file. Do your procalign VTK files open in 3D Slicer correctly? Sometimes you may have files but with empty data. Check that they open first, and if not, you have a problem with the SPHARM pipeline somewhere.

If they work, I've encountered some anecodtal odd behaviour which you can try troubleshooting:
- I've had trouble if Inputfilecolumn is not column zero (i.e. the first column)
- Use CSV files either created in Linux or adapted from Linux (Windows-made ones use different line breaks and cause problems)
- Use at least 4 subjects, 2 in each group

Not sure if these were actual bugs, or just coincidences. At any rate, it does work, but may take some troubleshooting.

Good luck,
David
Nov 2, 2016  03:11 PM | Nazanin M
RE: Problem with SPHARM-PDM on new dataset!
Dear Martin,

Thanks for your response. That's a great news! Hope it gets released soon.

I just have one quick question regarding -magNormDir function in MeshMath. From what I understood, it calculates the signed magnitude of projection of difference vector to another vector. So for example if we have:

MeshMath a.meta -magNormDir difference.txt

then the mathematics behind it would be :

dot_product(difference, a)/norm(a)

Is this correct? I have compared the results of MeshMath, and my own calculations using the above formula but they are not the same.. Would you please let me know where I'm making a mistake?

I really appreciate it.

Thanks,
Nov 4, 2016  08:11 AM | Martin Styner
RE: Problem with SPHARM-PDM on new dataset!
magNormDir computes the dot product between the provided vector field and the local normal vectors, i.e:
MeshMath a.meta -magNormDir difference.txt
=>
1. proj_i = dot(difference_i, norm(a_i)) 
2. output_i = abs(proj_i) * sign(proj_i)  
at the i-th vertex (the normal is of unit length)

The code for this is here:
https://github.com/NIRALUser/SPHARM-PDM/...
look at lines 3668-3683 (warning, this is not nicely designed code, but rather quiet ugly, historically accumulated code)


Martin

Originally posted by Nazanin M:
Dear Martin,

Thanks for your response. That's a great news! Hope it gets released soon.

I just have one quick question regarding -magNormDir function in MeshMath. From what I understood, it calculates the signed magnitude of projection of difference vector to another vector. So for example if we have:

MeshMath a.meta -magNormDir difference.txt

then the mathematics behind it would be :

dot_product(difference, a)/norm(a)

Is this correct? I have compared the results of MeshMath, and my own calculations using the above formula but they are not the same.. Would you please let me know where I'm making a mistake?

I really appreciate it.

Thanks,
Nov 4, 2016  01:11 PM | Nazanin M
RE: Problem with SPHARM-PDM on new dataset!
This completely makes sense. 

Now may I ask why you chose the projection of the difference vector on the mean surface normal? I know that we can get the signed value, but doing the projection aren't we losing some distance? Does it make sense if I get the difference vector's magnitude multiplied by the sign of the result of projection on mean vector? Again, what does projection give us aside from the sign?

The other thing that I am confused about so much is that why doesn't the properties of point 1 in sample1 correspond to point 1 in sample2? They have different theta, phi, and R. I was expecting to get similar theta, and phi for point x across all subjects, where only the R changes... 

Again, thank you so much for the effort and time you put for answering questions on the forum.

Nazanin
Nov 10, 2016  10:11 AM | Martin Styner
RE: Problem with SPHARM-PDM on new dataset!
Hi Nazanin
The idea behind normal projection is that the established correspondence is imperfect and one wants to neglect the part of the difference between surfaces that is along the surface itself. One may not want to include measure shape differences that are due to a surface location 'sliding' along the surface but the surface itself is not different. Rather, one may only be interested in that shape change part that goes purely inwards or outwards. That's what the normal projection does, i.e. computing that pure inwards/outwards shape difference.

Not sure I fully understand your second question. The phi and theta at the same point index should indeed be the same across subjects. Though that is only true after the SPHARM fit (i.e. not the original para surfaces, which are the spherical parametrization of the original surfaces, which do not have correspondence nor even the same number of points.

Martin
 
Originally posted by Nazanin M:
This completely makes sense. 

Now may I ask why you chose the projection of the difference vector on the mean surface normal? I know that we can get the signed value, but doing the projection aren't we losing some distance? Does it make sense if I get the difference vector's magnitude multiplied by the sign of the result of projection on mean vector? Again, what does projection give us aside from the sign?

The other thing that I am confused about so much is that why doesn't the properties of point 1 in sample1 correspond to point 1 in sample2? They have different theta, phi, and R. I was expecting to get similar theta, and phi for point x across all subjects, where only the R changes... 

Again, thank you so much for the effort and time you put for answering questions on the forum.

Nazanin
Dec 26, 2016  01:12 PM | Nazanin M
RE: Problem with SPHARM-PDM on new dataset!
Dear Martin,

Thanks again for your detailed and helpful explanation.

Since this correspondence is based on the alignment of first order ellipsoids, what if the shapes are not long in one axis (for example hippocampus is elongated along one axis), then how should we get the correspondence? When our shapes is spherical, the first order ellipsoid could be rotated along any direction, which does not give the correct object-inherent alignment for getting correspondent points!

What should we do in this case? Does spharm work only with elongated shapes?

I would really appreciate with your help as I'm stuck with this issue for a while.

Thanks,
Nazanin
Jan 2, 2017  09:01 AM | Martin Styner
RE: Problem with SPHARM-PDM on new dataset!
Dear Nazanin
You nailed one of the major issues with SPHARM correspondence, i.e. it has big problems with objects that show a high degree of symmetry (it does not need to be spherical, ellipsoidal would be enough).

Thus, the object does not necessarily need to be elongated, but it needs to be shaped such that there is little symmetry along any of the axes.

If you have an object that has such symmetry, e.g. the amygdala is a brain structure that is almond shaped and thus SPHARM often has issues when doing amygdala shape analysis, then the best would be to use additional landmarks (at least 3) that are incorporated into the correspondence. Thus rather than using the first order ellipsoid for the parameter (correspondence) space rotation, those landmarks would be used. The current distribution does not really support that, but we are incorporating exactly that into the next release (called SALT).

Btw, if you just need to flip the parametrization to account for symmetry issues, then you can do that in the current distribution with the ParaToSPHARMPDM tool.

Martin

Best regards
Martin

Originally posted by Nazanin M:
Dear Martin,

Thanks again for your detailed and helpful explanation.

Since this correspondence is based on the alignment of first order ellipsoids, what if the shapes are not long in one axis (for example hippocampus is elongated along one axis), then how should we get the correspondence? When our shapes is spherical, the first order ellipsoid could be rotated along any direction, which does not give the correct object-inherent alignment for getting correspondent points!

What should we do in this case? Does spharm work only with elongated shapes?

I would really appreciate with your help as I'm stuck with this issue for a while.

Thanks,
Nazanin
Jan 2, 2017  10:01 AM | Nazanin M
RE: Problem with SPHARM-PDM on new dataset!
Dear Martin,

Thank you!

In fact my objects are Amygdala, and even the flipping won't work (it gets rotated off of its correct orientation in the parameter (correspondence) space rotation step, and flipping wouldn't help).

I know this has been asked several times, but I wonder when SALT will be released? Because I have to decide whether to wait for SALT, or try to find a way to solve this issue. 

Thanks again,
Nazanin
Jan 5, 2017  11:01 AM | Martin Styner
RE: Problem with SPHARM-PDM on new dataset!
Hi Nazanin
Not sure about the release date, better for Beatriz to answer that question, but I expect at least another 6month before there is a tool that you can use.
And once it would be available, you would need to manually determine those landmarks in all amygdala datasets (at least 3 LMs)
Best regards
Martin
Jan 11, 2017  08:01 AM | Nazanin M
RE: Problem with SPHARM-PDM on new dataset!
Dear Martin,

Thanks for you response. I have two questions:

1) In order to solve this correspondence issue, is it valid if I pre-align all the amygdalas perfectly with whole brain registration, and after meshing and parameterizatoin, and then do ParaToSPHARMMeshCLP  with the --NoParaAlign argument (Do not do any aligment/correspondence of the parametrization using the first order ellipsoid)? I have looked at the sampling points between my amygdala shapes, and it looks like that they match now. (and if I'm correct, no Procrustes alignment is needed after correspondence establishment, and point sampling?)

2) Since you have also been using Amygdala in this paper: "Morey, R., Petty, C., Xu, Y., Pannu Hayes, J., Wagner, H., Lewis, D., LaBar, K., Styner, M., McCarthy, G., 2009. A comparison of automated segmentation and manual tracing for quantifying hippocampal and amygdala volumes. Neuroimage 45, 855–866", May I ask whether you also used landmarking for finding correspondence, or used any other method for finding correspondence?

I really appreciate your kind help.
Nazanin
Jan 17, 2017  07:01 AM | Nazanin M
RE: Problem with SPHARM-PDM on new dataset!
Hello and Good morning,

Just checking to see if I could get feedback regarding my post above. 

That would be very much appreciated!

Thanks,
Nazanin
Jan 17, 2017  07:01 AM | Martin Styner
RE: Problem with SPHARM-PDM on new dataset!
Hi Nazanin
Re 1) Yes, you can do that, though you need to double check for bad flips and very likely need to flip a few cases manually via ParaToSPHARMMeshCLP. Use ShapePopulationViewer with the phi and theta coloring to check for flips. Use it also to check for appropriate correspondence without the additional parameter space alignment). 

You though still need the procrustes alignment, as the pre-alignment is usually not good enough and you don't want any translational and rotational effects in your shape analysis.

Re 2) No, we did not use landmarking, but rather the approach that you are suggesting in (1). If I remember correctly, we added that option specifically for that paper. It's less optional compared to the landmark solution, but appropriate.

Martin
Jan 17, 2017  08:01 AM | Nazanin M
RE: Problem with SPHARM-PDM on new dataset!
Thank you so much for taking the time to answer to these questions. This is really valuable. 

Thanks and have a great rest of the day!
Nazanin