SlicerDMRI / whitematteranalysis

White matter tractography clustering and more...
https://dmri.slicer.org/whitematteranalysis/
Other
70 stars 34 forks source link

wm_quality_control_tractography #93

Open eknyazhe opened 4 years ago

eknyazhe commented 4 years ago

Hi @zhangfanmark I am getting the following error when running wm_quality_control_tractography. It goes through a few subjects in a loop and then gives the Segmentation fault (core dumped) error

`Subject 2 / 180 ID: TRT_0017_CC1

Saving rendered views to disk: /data/pnl/clk7/TRACTS/QC/CC1/qc_output_CC1/tract_QC_TRT_0017_CC1 Multiple views for individual subject /data/pnl/clk7/TRACTS/QC/CC1/qc_output_CC1/tract_QC_TRT_0017_CC1 tract_QC_TRT_0017_CC1/view_left_TRT_0017_CC1.jpg /data/pnl/clk7/TRACTS/QC/CC1/qc_output_CC1/tract_QC_TRT_0017_CC1/view_multiple_TRT_0017_CC1.html /data/pnl/clk7/TRACTS/QC/CC1/qc_output_CC1/tract_QC_TRT_0017_CC1 tract_QC_TRT_0017_CC1/view_right_TRT_0017_CC1.jpg /data/pnl/clk7/TRACTS/QC/CC1/qc_output_CC1/tract_QC_TRT_0017_CC1/view_multiple_TRT_0017_CC1.html /data/pnl/clk7/TRACTS/QC/CC1/qc_output_CC1/tract_QC_TRT_0017_CC1 tract_QC_TRT_0017_CC1/view_inf_TRT_0017_CC1.jpg /data/pnl/clk7/TRACTS/QC/CC1/qc_output_CC1/tract_QC_TRT_0017_CC1/view_multiple_TRT_0017_CC1.html /data/pnl/clk7/TRACTS/QC/CC1/qc_output_CC1/tract_QC_TRT_0017_CC1 tract_QC_TRT_0017_CC1/view_sup_TRT_0017_CC1.jpg /data/pnl/clk7/TRACTS/QC/CC1/qc_output_CC1/tract_QC_TRT_0017_CC1/view_multiple_TRT_0017_CC1.html /data/pnl/clk7/TRACTS/QC/CC1/qc_output_CC1/tract_QC_TRT_0017_CC1 tract_QC_TRT_0017_CC1/view_ant_TRT_0017_CC1.jpg /data/pnl/clk7/TRACTS/QC/CC1/qc_output_CC1/tract_QC_TRT_0017_CC1/view_multiple_TRT_0017_CC1.html /data/pnl/clk7/TRACTS/QC/CC1/qc_output_CC1/tract_QC_TRT_0017_CC1 tract_QC_TRT_0017_CC1/view_post_TRT_0017_CC1.jpg /data/pnl/clk7/TRACTS/QC/CC1/qc_output_CC1/tract_QC_TRT_0017_CC1/view_multiple_TRT_0017_CC1.html Subject 3 / 180 ID: TRT_0022_CC1 wm_quality_control_Clustering_Comissurals.sh: line 1: 57509 Segmentation fault (core dumped) wm_quality_control_tractography /data/pnl/clk7/TRACTS/QC/${i}/ /data/pnl/clk7/TRACTS/QC/${i}/qc_output_${i}/ Importing whitematteranalysis package. Starting... Output directory /data/pnl/clk7/TRACTS/QC/CC2/qc_output_CC2/ does not exist, creating it. Found 180 subjects in input directory: /data/pnl/clk7/TRACTS/QC/CC2/ Testing all files for quality control (computing fiber length measurements and rendering to make sure header and gradient orientations are ok). See the README.txt file in the output directory for more overview information. Subject 1 / 180 ID: TRT_0015_CC2` Here's the contents of the output directory at `/data/pnl/clk7/TRACTS/QC/CC2/qc_output_CC2` (pnlpipe3) [tb571@grx04 qc_output_CC2]$ tree . ├── quality_control_data.txt ├── quality_control_fibers.txt ├── quality_control_spatial_locations.txt ├── README.txt ├── tract_QC_TRT_0015_CC2 │ ├── fiber_length_histogram.pdf │ ├── view_ant_TRT_0015_CC2.jpg │ ├── view_inf_TRT_0015_CC2.jpg │ ├── view_left_TRT_0015_CC2.jpg │ ├── view_multiple_TRT_0015_CC2.html │ ├── view_post_TRT_0015_CC2.jpg │ ├── view_right_TRT_0015_CC2.jpg │ └── view_sup_TRT_0015_CC2.jpg ├── tract_QC_TRT_0017_CC2 │ ├── fiber_length_histogram.pdf │ ├── view_ant_TRT_0017_CC2.jpg │ ├── view_inf_TRT_0017_CC2.jpg │ ├── view_left_TRT_0017_CC2.jpg │ ├── view_multiple_TRT_0017_CC2.html │ ├── view_post_TRT_0017_CC2.jpg │ ├── view_right_TRT_0017_CC2.jpg │ └── view_sup_TRT_0017_CC2.jpg ├── tract_QC_TRT_0022_CC2 │ ├── fiber_length_histogram.pdf │ ├── view_ant_TRT_0022_CC2.jpg │ ├── view_inf_TRT_0022_CC2.jpg │ ├── view_left_TRT_0022_CC2.jpg │ ├── view_multiple_TRT_0022_CC2.html │ ├── view_post_TRT_0022_CC2.jpg │ ├── view_right_TRT_0022_CC2.jpg │ └── view_sup_TRT_0022_CC2.jpg ├── view_ant.html ├── view_inf.html ├── view_left.html ├── view_post.html ├── view_right.html └── view_sup.html 3 directories, 34 files
zhangfanmark commented 4 years ago

Hi @eknyazhe I am not sure why this happened... I am running the QC code in the folder you have. Everything seems working well.

Here is what I used, and I am running this in Nomachine.

source /data/pnl/soft/bashrc cd /data/pnl/clk7/TRACTS/QC/CC2 wm_quality_control_tractography.py . qc

Can you try this and see if it works for you?

Fan

eknyazhe commented 4 years ago

Hi @zhangfanmark , your set up worked for me! Looks like the issue is that I was sourced to /data/pnl/soft/pnlpipe3/bashrc3 and running wm_quality_control_tractography in that environment. From now on, should we only run WMA scripts when sourced to /data/pnl/soft/bashrc?

zhangfanmark commented 4 years ago

Hi @eknyazhe Please use this only of the QC code. I assume other scripts works properly? I had issues with using this code in the new environment also. I think somehow related to the QT, which exists on the cluster for quite a while and we could not fix. But not sure if it is the same issue you have. I will take a look later. For now, you can use bashrc for qc.

tashrifbillah commented 4 years ago

@zhangfanmark , more debug info: this is the line where the above fails with just one message Segmentation fault (core dumped).

I believe the problem traces its root in self.renderer = vtk.vtkRenderer(): https://github.com/SlicerDMRI/whitematteranalysis/blob/master/whitematteranalysis/render.py#L127

It just doesn't make sense that for some tract your program succeeds and for some it fails.

Anyways, is it safe to migrate to python3 now?

zhangfanmark commented 4 years ago

@tashrifbillah That's strange. Segmentation fault usually is related memory. This need to be debugged. Does his happen always or just for this dataset?

We have performed a bunch of test for the python3 version. It is ready to be used now. But for the existing projects with python2, please keep using that, in case of any inconsistency.

tashrifbillah commented 4 years ago

Does [t]his happen always or just for this dataset?

I can't say but we observed it for this one.

tashrifbillah commented 4 years ago

By the way, whoever wrote the bashrc you are rooting for, has the following line in it:

41 export LIBGL_ALWAYS_INDIRECT=1 # so vtk rendering does not crash

I tried but to no avail.

tashrifbillah commented 4 years ago

The old bashrc is running vtk=7.0 while the new one is vtk=8.1. I can think of this as the only difference between the two environments. I tried pip install vtk==7.0 but it looks like they deleted that old version from pypi server so didn't succeed downgrading.