3d-pli / SLIX

Scattered Light Imaging ToolboX (SLIX) – an open-source Python package that allows a fully automated evaluation of SLI measurements and the generation of different parameter maps
MIT License
6 stars 3 forks source link

[BUG, DOC] Running an example end of file error #1

Closed alexrockhill closed 3 years ago

alexrockhill commented 3 years ago

I downloaded Vervet1818_s0512_60um_SLI_090_Stack_1day.nii from the link in the README example and tried to run it directly as input. In the example gif, I saw that the input took at stack.tif. Does SLIXParameterGenerator take a nii file as input, and where is it documented what input types are accepted? Also, it would be helpful to have clear instructions on how to run an example with this or another file.

If SLIXParameterGenerator does take an nii file as input (it did look like the command made it some ways), it hung up after completing the ROI command so I stopped execution. Any idea what may be going wrong?

(venv) Alexs-MacBook-Pro:bin alexrockhill$ ./SLIXParameterGenerator -i ../Vervet1818_s0512_60um_SLI_090_Stack_1day.nii -o ../output/
SLI Feature Generator:
Number of threads: 4

Chosen feature maps:
Direction maps: True
Peak maps: True
Peak prominence map: True
Peak width map: True
Peak distance map: True
Optional maps: False

../Vervet1818_s0512_60um_SLI_090_Stack_1day.nii
Roi finished

^CTraceback (most recent call last):
  File "./SLIXParameterGenerator", line 233, in generate_feature_maps
    resulting_parameter_maps[i, current_index] = toolbox.prominence(peak_positions_high_non_centroid, roi)
  File "/Users/alexrockhill/software/SLIX/venv/lib/python3.7/site-packages/SLIX-1.1-py3.7.egg/SLIX/toolbox.py", line 187, in prominence
  File "/Users/alexrockhill/software/SLIX/venv/lib/python3.7/site-packages/SLIX-1.1-py3.7.egg/SLIX/toolbox.py", line 657, in normalize
  File "<__array_function__ internals>", line 6, in mean
  File "/Users/alexrockhill/software/SLIX/venv/lib/python3.7/site-packages/numpy/core/fromnumeric.py", line 3372, in mean
    return _methods._mean(a, axis=axis, dtype=dtype,
KeyboardInterrupt

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./SLIXParameterGenerator", line 366, in <module>
    args['with_smoothing'], args['mask_threshold'])
  File "./SLIXParameterGenerator", line 69, in full_pipeline
    parameter_maps = generate_feature_maps(roiset, selected_methods)
  File "./SLIXParameterGenerator", line 249, in generate_feature_maps
    current_index += 3
  File "/Users/alexrockhill/software/SLIX/venv/lib/python3.7/site-packages/pymp/__init__.py", line 122, in __exit__
    self._exception_queue.put((exc_t, exc_val, self._thread_num))
  File "<string>", line 2, in put
  File "/Users/alexrockhill/software/anaconda3/envs/swannlab/lib/python3.7/multiprocessing/managers.py", line 819, in _callmethod
    kind, result = conn.recv()
  File "/Users/alexrockhill/software/anaconda3/envs/swannlab/lib/python3.7/multiprocessing/connection.py", line 250, in recv
    buf = self._recv_bytes()
  File "/Users/alexrockhill/software/anaconda3/envs/swannlab/lib/python3.7/multiprocessing/connection.py", line 407, in _recv_bytes
    buf = self._recv(4)
  File "/Users/alexrockhill/software/anaconda3/envs/swannlab/lib/python3.7/multiprocessing/connection.py", line 383, in _recv
    raise EOFError
EOFError

https://github.com/openjournals/joss-reviews/issues/2675

alexrockhill commented 3 years ago

I waited for an hour before interrupting execution so it's possible that the command may not have finished, if that is the case, it would be helpful to print to the console the progress of the function.

Thyre commented 3 years ago

Hi and thanks for your issue,

the toolbox does indeed accept NIfTI images. The .gif in the README does not represent this but it is noted under the 'Required parameters' section of 'SLIXParameterGenerator'. However, I can change the .gif to also include an example with a .nii file. In it's current implementation, SLIX will take some time when calculating the parameter maps for full scale images. I can see that your MacBook has four cores and four threads. On my machine the program took around 10-15 minutes to generate all parameter maps. However, my desktop PC has 16 threads. Therefore I can imagine that the execution on your machine will take around 1 hour to 1.5 hours. I'm currently working on improving the performance by using CuPy and Numba (or solely Numba if an NVIDIA GPU isn't available), but can't guarantee a date for a new version yet.

In the meantime, I would recommended to run the evaluation on downsampled images, e.g. with --roisize 10, as suggested in the 'Resulting parameter maps' section. This means in your case: ./SLIXParameterGenerator -i ../Vervet1818_s0512_60um_SLI_090_Stack_1day.nii -o ../output/ --roisize 10 On my PC, this took only a few seconds.

In any case, it is a good idea to print to the console the progress of the function. I will look into that.

alexrockhill commented 3 years ago

Where is the Required parameters section of SLIXParameterGenerator?

miriammenzel commented 3 years ago

Screenshot

alexrockhill commented 3 years ago

Re speeding up the process, that would be excellent, but just from a user standpoint, I think there is an issue when the process takes a long time on a single core with a standard processor and there is no terminal output. It could also help with planning to describe how long the it might take on one or two example setups such as how freesurfer does https://surfer.nmr.mgh.harvard.edu/fswiki/recon-all.

Thyre commented 3 years ago

I have added a progress bar to SLIX. It should give you an indication of how long the program takes to complete the input file. The README.md also has a new section with performance metrics of my PC. I might also add some runtimes of other computers, but I don't have access to another computer at the moment.

alexrockhill commented 3 years ago

Great, that would be very helpful to a first-time user running the example.

I think also what got lost in this being multiple issues in one is that, although I like the example gif, the user doesn't have that file and then when they grab the 100 MB nii that seems most obvious, it's not immediately apparent to downsample so I would suggest changing the example to a file the user has access to and giving the suggested command explicitly.

Thyre commented 3 years ago

I've changed the GIF to show examples of two measurements available in the EBRAINS data repository and added the roisize option to make sure that the examples have a low execution time on most machines (max. one minute). In addition to the GIF I added the needed commands to download both measurements and to generate the parameter maps as shown in the GIF.

I hope that this will make it clearer how to use the program and that downsampling is used for these examples.

alexrockhill commented 3 years ago

Nice, looks good.