pnlbwh / CNN-Diffusion-MRIBrain-Segmentation

CNN based brain masking
Other
14 stars 10 forks source link

maskfilter not found #11

Closed tashrifbillah closed 4 years ago

tashrifbillah commented 4 years ago

python pipeline/dwi_masking.py -i /tmp/cnn_dwi_list.txt -f model_folder/ -nproc 16 -ref model_folder/IITmean_b0_256.nii.gz

Using TensorFlow backend.
File exist
Extracting b0 volume...
Performing ants rigid body transformation...
Normalizing input data
Case completed =  0
Merging npy files...
Saving data to disk...
Pre-Processing Time Taken :  0.68  min
Loading sagittal model from disk...
WARNING:tensorflow:From /tmp/miniconda3/envs/tf/lib/python3.6/site-packages/tensorflow/python/ops/resource_variable_ops.py:435: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
256/256 [==============================] - 87s 340ms/step
Loading coronal model from disk...
256/256 [==============================] - 88s 342ms/step
Loading axial model from disk...
256/256 [==============================] - 88s 342ms/step
Masking Time Taken :  4.87  min
Splitting files....
Performing Muti View Aggregation...
Converting file format...
Performing ants inverse transform...
Traceback (most recent call last):
  File "pipeline/dwi_masking.py", line 717, in <module>
    omat=list(omat_list[i].split()))
  File "pipeline/dwi_masking.py", line 303, in npy_to_nhdr
    process = subprocess.Popen(mask_filter.split(), stdout=subprocess.PIPE)
  File "/tmp/miniconda3/envs/tf/lib/python3.6/subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "/tmp/miniconda3/envs/tf/lib/python3.6/subprocess.py", line 1344, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'maskfilter': 'maskfilter'
senthilcaesar commented 4 years ago

Could you run the following command in your terminal and try again export PATH="/rfanfs/pnl-zorro/software/mrtrix3/release/bin:/rfanfs/pnl-zorro/software/mrtrix3/scripts:$PATH"

tashrifbillah commented 4 years ago

Okay that worked.

  1. What's the function of this maskfilter? Since this is coming from mrtrix3, we need to find something similar in Python or FSL in order to replace that.

  2. We need to document somewhere that the mask is saved in the same directory with name dwib0_{PREFIX}-multi_BrainMask.nii.gz.

  3. I see an HTML file pulling up on my browser. Who is triggering that? This may not be an option when we are generating masks on a remote terminal without GUI support.

senthilcaesar commented 4 years ago

1) maskfilter does filtering operations ( https://mrtrix.readthedocs.io/en/latest/reference/commands/maskfilter.html ) 2) Yeah, I guess we have to write to a log file 3) FSL slicesdir takes snapshots and creates the HTML file , and opens the file "index.html" in browser

tashrifbillah commented 4 years ago

FSL slicesdir takes snapshots and creates the HTML file , and opens the file "index.html" in browser

Can you refer to the code?

tashrifbillah commented 4 years ago

maskfilter does filtering operations

I know, what filter do you apply there? @SenthilCaesar

senthilcaesar commented 4 years ago

FSL slicesdir takes snapshots and creates the HTML file , and opens the file "index.html" in browser

Can you refer to the code?

def quality_control(mask_list, shuffled_list, tmp_path, view='default'):

    '''The slicesdir command takes the list of images and creates a simple web-page containing snapshots for each of the images. 
    Once it has finished running it tells you the name of the web page to open in your web browser, to view the snapshots'''
    slices = " "
    for i in range(0, len(mask_list)):
        str1 = shuffled_list[i]
        str2 = mask_list[i]
        slices += str1 + " " + str2 + " "

    final = "slicesdir -o" + slices
    os.chdir(tmp_path)
    subprocess.check_output(final, shell=True)
    mask_folder = os.path.join(tmp_path, 'slicesdir')
    mask_newfolder = os.path.join(tmp_path, 'slicesdir_' + view)
    bashCommand = 'mv --force ' + mask_folder + " " + mask_newfolder
    process = subprocess.Popen(bashCommand.split(), stdout=subprocess.PIPE)
    output, error = process.communicate()
webbrowser.open(os.path.join(tmp_path, 'slicesdir_multi/index.html'))
tashrifbillah commented 4 years ago

quality_control() is called from here: https://github.com/pnlbwh/CNN-Diffusion-MRIBrain-Segmentation/blob/70a4832a2ebc6e34d341703819016f362bde7659/pipeline/postprocessing.py#L432

We need a -qc flag to suppress it.

senthilcaesar commented 4 years ago

quality_control() is called from here: https://github.com/pnlbwh/CNN-Diffusion-MRIBrain-Segmentation/blob/70a4832a2ebc6e34d341703819016f362bde7659/pipeline/postprocessing.py#L432

We need a -qc flag to suppress it.

Sure, I will add the -qc flag in the code.

tashrifbillah commented 4 years ago

Yeah, I guess we have to write to a log file

No you don't. You have to put it in the README or in the help message. We can do it together.

tashrifbillah commented 4 years ago

@tashrifbillah added maskfilter: https://github.com/pnlbwh/CNN-Diffusion-MRIBrain-Segmentation/commit/b3deb00c27cb55727394e69e9e53b6cdfdd0a292