Deep-MI / hipsta

HIPSTA - a python package for hippocampal shape and thickness analysis
MIT License
3 stars 0 forks source link

Issues with createSurface.py #6

Open uajosh1 opened 6 months ago

uajosh1 commented 6 months ago

The freesurfer files that I'm trying to run Hipsta on are from Freesurfer7.2 labeled: rh.hippoAmygLabels-T1.v21.CA.mgz, lh.hippoAmygLabels-T1.v21.CA.mgz

When looking at results through freeview these files are either unable to open or blank:

This is the error I'm getting: `Smooth surface

--> VTK format ... [file not found or not readable]

[ERROR: hipsta.py] Error Information: [ERROR: hipsta.py] Type: <class 'AttributeError'> [ERROR: hipsta.py] Value: ("'NoneType' object has no attribute 'rm_freevertices'",) Traceback (most recent call last): File "/Users/joshuanguyen/.pyenv/versions/3.10.11/envs/myenv/bin/run_hipsta", line 8, in sys.exit(main()) File "/Users/joshuanguyen/.pyenv/versions/3.10.11/envs/myenv/lib/python3.10/site-packages/hipsta/cli/init.py", line 26, in main _run_hipsta(args) File "/Users/joshuanguyen/.pyenv/versions/3.10.11/envs/myenv/lib/python3.10/site-packages/hipsta/hipsta.py", line 840, in _run_hipsta _run_analysis(params) File "/Users/joshuanguyen/.pyenv/versions/3.10.11/envs/myenv/lib/python3.10/site-packages/hipsta/hipsta.py", line 743, in _run_analysis params = smoothSurface(params) File "/Users/joshuanguyen/.pyenv/versions/3.10.11/envs/myenv/lib/python3.10/site-packages/hipsta/createSurface.py", line 272, in smoothSurface triaMesh.rm_freevertices() AttributeError: 'NoneType' object has no attribute 'rm_freevertices'`

Please advise

kdiers commented 6 months ago

Hello, thanks for your message. I speculate that the issue may be due to using the lh.hippoAmygLabels-T1.v21.CA.mgz and rh.hippoAmygLabels-T1.v21.CA.mgz files, instead oflh.hippoAmygLabels-T1.v21.mgz and rh.hippoAmygLabels-T1.v21.mgz (i.e., no CA suffix). Would using the latter files help?

uajosh1 commented 6 months ago

Thank you! That got me a bit further but now I have a new error - do you know what this might be now?

Computing cube parametrization

--> VTK format ... --> DONE ( V: 20178 , T: 61793 )

--> VTK format ... --> DONE ( V: 20178 , T: 16905 )

TriaMesh with anisotropic Laplace-Beltrami Solver: spsolve (LU decomposition) ... [ERROR: hipsta.py] Error Information: [ERROR: hipsta.py] Type: <class 'ValueError'> [ERROR: hipsta.py] Value: ('all the input arrays must have same number of dimensions, but the array at index 0 has 1 dimension(s) and the array at index 1 has 0 dimension(s)',) Traceback (most recent call last): File "/Users/joshuanguyen/.pyenv/versions/3.12.3/bin/run_hipsta", line 8, in sys.exit(main()) ^^^^^^ File "/Users/joshuanguyen/.pyenv/versions/3.12.3/lib/python3.12/site-packages/hipsta/cli/init.py", line 26, in main _run_hipsta(args) File "/Users/joshuanguyen/.pyenv/versions/3.12.3/lib/python3.12/site-packages/hipsta/hipsta.py", line 840, in _run_hipsta _run_analysis(params) File "/Users/joshuanguyen/.pyenv/versions/3.12.3/lib/python3.12/site-packages/hipsta/hipsta.py", line 783, in _run_analysis params = computeCubeParam(params) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/joshuanguyen/.pyenv/versions/3.12.3/lib/python3.12/site-packages/hipsta/computeCubeParam.py", line 800, in computeCubeParam v4c, t4c, i4c, k4c, newVtcs, newVtcsSgn, newTetra = getSeam( ^^^^^^^^ File "/Users/joshuanguyen/.pyenv/versions/3.12.3/lib/python3.12/site-packages/hipsta/computeCubeParam.py", line 519, in getSeam v4c, t4c, i4c, k4c, e4cBndOpen, newTetra, newVtcs, newVtcsAdj, newVtcsSgn = getSeamCase1( ^^^^^^^^^^^^^ File "/Users/joshuanguyen/.pyenv/versions/3.12.3/lib/python3.12/site-packages/hipsta/computeCubeParam.py", line 88, in getSeamCase1 i4c = np.concatenate((i4c, st.mode(i4c[t4c[i, :]])[0])) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: all the input arrays must have same number of dimensions, but the array at index 0 has 1 dimension(s) and the array at index 1 has 0 dimension(s) (hipsta_env) (base) joshuanguyen@dhcp-v066-140 Hipsta %

kdiers commented 6 months ago

Hm, this may be a bit more tricky. Could you maybe post the command that you used for running the software?

uajosh1 commented 6 months ago

Thank you!

This is the command that I gave:

(hipsta_env) (base) joshuanguyen@dhcp-v066-140 Hipsta % run_hipsta --filename /Users/joshuanguyen/Desktop/ASYM/Data/6049lh.hippoAmygLabels-T1.v21.mgz --hemi lh --lut freesurfer --outputdir /Users/joshuanguyen/Desktop/ASYM/Results

And this was the entire output

`---------------------------------------- Hippocampal shape and thickness analysis

Found output directory /Users/joshuanguyen/Desktop/ASYM/Results [INFO: logging.py] Starting logging ... [INFO: logging.py] Logfile: /Users/joshuanguyen/Desktop/ASYM/Results/logfile.txt [INFO: logging.py] Version: 0.9.1 [INFO: logging.py] Date: 03/06/2024 12:47:07 [INFO: logging.py] Command: /Users/joshuanguyen/.pyenv/versions/3.12.3/bin/run_hipsta --filename /Users/joshuanguyen/Desktop/ASYM/Data/6049lh.hippoAmygLabels-T1.v21.mgz --hemi lh --lut freesurfer --outputdir /Users/joshuanguyen/Desktop/ASYM/Results [INFO: hipsta.py] Evaluating arguments ... [INFO: atlases.py] Found internal, modified look-up table for FreeSurfer. [INFO: hipsta.py] Using /Users/joshuanguyen/Desktop/ASYM/Data/6049lh.hippoAmygLabels-T1.v21.mgz as input file [INFO: hipsta.py] Using /Users/joshuanguyen/Desktop/ASYM/Results as output directory [INFO: hipsta.py] Found /Users/joshuanguyen/Desktop/ASYM/Data/6049lh.hippoAmygLabels-T1.v21.mgz [INFO: hipsta.py] Starting convertFormat() ...


Convert to mgz and copy to output directory

[INFO: hipsta.py] Starting cropImage() ...


Cropping

/Applications/freesurfer/7.2.0/bin/mri_mask -bb 5 /Users/joshuanguyen/Desktop/ASYM/Results/image/lh.orig.mgz /Users/joshuanguyen/Desktop/ASYM/Results/image/lh.orig.mgz /Users/joshuanguyen/Desktop/ASYM/Results/image/lh.cropped.mgz [INFO: hipsta.py] Starting upsampleImage() ... [INFO: hipsta.py] Starting copy_image_to_main() ... [INFO: hipsta.py] Starting autoMask() ... [INFO: hipsta.py] Starting createLabels() ...


Create labels

/Applications/freesurfer/7.2.0/bin/mri_binarize --i /Users/joshuanguyen/Desktop/ASYM/Results/lh.image.mgz --match 234 236 238 240 246 --o /Users/joshuanguyen/Desktop/ASYM/Results/labels/lh.initial_labels.mgz /Applications/freesurfer/7.2.0/bin/fscalc /Users/joshuanguyen/Desktop/ASYM/Results/lh.image.mgz mul /Users/joshuanguyen/Desktop/ASYM/Results/labels/lh.initial_labels.mgz --o /Users/joshuanguyen/Desktop/ASYM/Results/labels/lh.initial_labels.mgz [INFO: hipsta.py] Starting mergeMolecularLayer() ...


Attaching the molecular layer

[INFO: hipsta.py] Starting copy_labels_to_main() ... [INFO: hipsta.py] Starting binarizeMask() ... [INFO: hipsta.py] Starting gaussFilter() ...


Gaussian filtering

[INFO: hipsta.py] Starting longFilter() ... [INFO: hipsta.py] Starting closeMask() ...


Applying closing operation to mask

[INFO: hipsta.py] Starting copy_mask_to_main() ... [INFO: hipsta.py] Starting extractSurface() ...


Creating surface via marching cube algorithm

/Applications/freesurfer/7.2.0/bin/mri_mc /Users/joshuanguyen/Desktop/ASYM/Results/lh.mask.mgz 1 /Users/joshuanguyen/Desktop/ASYM/Results/surface/lh.initial_surf.vtk 1 [INFO: hipsta.py] Starting remeshSurface() ... [INFO: hipsta.py] Starting smoothSurface() ...


Smooth surface

--> VTK format ... --> DONE ( V: 10970 , T: 21936 )

[INFO: hipsta.py] Starting qcPlots() ... --> VTK format ... --> DONE ( V: 10970 , T: 21936 )

[INFO: hipsta.py] Starting checkSurface() ...


Check surfaces

--> VTK format ... --> DONE ( V: 10970 , T: 21936 )

[INFO: check_surface.py] Euler number for /Users/joshuanguyen/Desktop/ASYM/Results/lh.surf.vtk is 2 [INFO: hipsta.py] Starting createTetraMesh() ...


Create tetrahedral mesh

--> VTK format ... --> DONE ( V: 10970 , T: 21936 )

/Applications/Gmsh.app/Contents/MacOS/gmsh -3 -o /Users/joshuanguyen/Desktop/ASYM/Results/tetra-mesh/lh.tetra-gmsh.vtk /Users/joshuanguyen/Desktop/ASYM/Results/tetra-mesh/lh.tetra.geo --> VTK format ... --> DONE ( V: 17313 , T: 67910 )

[INFO: hipsta.py] Starting createTetraLabels() ...


Creating label files for tetrahedral meshes

/Applications/freesurfer/7.2.0/bin/mris_calc --output /Users/joshuanguyen/Desktop/ASYM/Results/tetra-labels/lh.labels-bnd.mgz /Users/joshuanguyen/Desktop/ASYM/Results/tetra-labels/lh.labels-bnd.mgz lowerlimit /Users/joshuanguyen/Desktop/ASYM/Results/tetra-labels/lh.labels-ca4.mgz --> VTK format ... --> DONE ( V: 17313 , T: 67910 )

Found 21936 triangles on boundary. [INFO: hipsta.py] Starting removeBoundaryMask() ...


Removing boundary tetras from mesh

--> VTK format ... --> DONE ( V: 17313 , T: 67910 )

Found 21936 triangles on boundary. [INFO: hipsta.py] Starting cutTetra() ...


Cutting tetrahedral mesh

--> VTK format ... --> DONE ( V: 17313 , T: 67910 )

TetMesh with regular Laplace Matrix Format now: csc Solver: spsolve (LU decomposition) ... /Users/joshuanguyen/.pyenv/versions/3.12.3/lib/python3.12/site-packages/scipy/sparse/_index.py:108: SparseEfficiencyWarning:

Changing the sparsity structure of a csr_matrix is expensive. lil_matrix is more efficient.

Found 21696 triangles on boundary. Searched mesh after 177 flooding iterations (0.05073904991149902 sec). [INFO: hipsta.py] Starting checkSurface() ...


Check surfaces

--> VTK format ... --> DONE ( V: 8787 , T: 16905 )

[INFO: check_surface.py] There are 2 boundary loops for /Users/joshuanguyen/Desktop/ASYM/Results/tetra-cut/lh.rm.open.bnd.cut.vtk [INFO: hipsta.py] Starting computeCubeParam() ...


Computing cube parametrization

--> VTK format ... --> DONE ( V: 20178 , T: 61793 )

--> VTK format ... --> DONE ( V: 20178 , T: 16905 )

TriaMesh with anisotropic Laplace-Beltrami Solver: spsolve (LU decomposition) ... [ERROR: hipsta.py] Error Information: [ERROR: hipsta.py] Type: <class 'ValueError'> [ERROR: hipsta.py] Value: ('all the input arrays must have same number of dimensions, but the array at index 0 has 1 dimension(s) and the array at index 1 has 0 dimension(s)',) Traceback (most recent call last): File "/Users/joshuanguyen/.pyenv/versions/3.12.3/bin/run_hipsta", line 8, in sys.exit(main()) ^^^^^^ File "/Users/joshuanguyen/.pyenv/versions/3.12.3/lib/python3.12/site-packages/hipsta/cli/init.py", line 26, in main _run_hipsta(args) File "/Users/joshuanguyen/.pyenv/versions/3.12.3/lib/python3.12/site-packages/hipsta/hipsta.py", line 840, in _run_hipsta _run_analysis(params) File "/Users/joshuanguyen/.pyenv/versions/3.12.3/lib/python3.12/site-packages/hipsta/hipsta.py", line 783, in _run_analysis params = computeCubeParam(params) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/joshuanguyen/.pyenv/versions/3.12.3/lib/python3.12/site-packages/hipsta/computeCubeParam.py", line 800, in computeCubeParam v4c, t4c, i4c, k4c, newVtcs, newVtcsSgn, newTetra = getSeam( ^^^^^^^^ File "/Users/joshuanguyen/.pyenv/versions/3.12.3/lib/python3.12/site-packages/hipsta/computeCubeParam.py", line 519, in getSeam v4c, t4c, i4c, k4c, e4cBndOpen, newTetra, newVtcs, newVtcsAdj, newVtcsSgn = getSeamCase1( ^^^^^^^^^^^^^ File "/Users/joshuanguyen/.pyenv/versions/3.12.3/lib/python3.12/site-packages/hipsta/computeCubeParam.py", line 88, in getSeamCase1 i4c = np.concatenate((i4c, st.mode(i4c[t4c[i, :]])[0])) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: all the input arrays must have same number of dimensions, but the array at index 0 has 1 dimension(s) and the array at index 1 has 0 dimension(s) `

kdiers commented 5 months ago

Thank you very much. I have to admit that I am a bit at a loss at the moment, and see no obvious reason for the processing failure. If you can share the particular segmentation file that produces the error I am happy to take a closer look while trying to replicate the issue.

uajosh1 commented 5 months ago

Thank you so much! Could I get your email to share it with you please?

On Thu, Jun 6, 2024 at 9:55 AM Kersten Diers @.***> wrote:

Thank you very much. I have to admit that I am a bit at a loss at the moment, and see no obvious reason for the processing failure. If you can share the particular segmentation file that produces the error I am happy to take a closer look while trying to replicate the issue.

— Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/Deep-MI/hipsta/issues/6*issuecomment-2152987427__;Iw!!CzAuKJ42GuquVTTmVmPViYEvSg!PQcYO416EVSzULrTvKV9ZZmRq6bFNRcFW42QD-SVhahO0i0mmzY0WQHr418FTb4Tr7USmeZCgsux4uAtAcv9UqzK$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/BI2324N4MEQDIJ3WQ7ZIEZLZGCH7TAVCNFSM6AAAAABIRWYWQOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJSHE4DONBSG4__;!!CzAuKJ42GuquVTTmVmPViYEvSg!PQcYO416EVSzULrTvKV9ZZmRq6bFNRcFW42QD-SVhahO0i0mmzY0WQHr418FTb4Tr7USmeZCgsux4uAtARCHHiBt$ . You are receiving this because you authored the thread.Message ID: @.***>

kdiers commented 5 months ago

Please find my email on our lab's webpage (trying to post it not on too many different places).