sergivalverde / nicMSlesions

Easy multiple sclerosis white matter lesion segmentation using convolutional deep neural networks.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get "ERROR: preprocess_01 registering masks on FLAIR quiting program"

mbrown0294 opened this issue · comments

Why am I getting this error? Can't quite figure it out from source code. (preprocess_01 is one subject in my training folder)

Can you give more context please?

Yes, I am running without a GPU and my data folder, called preprocess contains this:

├── preprocess_01
│   ├── flair.nii
│   ├── mask1.nii
│   ├── mprage.nii
│   ├── pd.nii
│   ├── t2.nii
│   └── tmp
│       ├── FLAIR.nii.gz
│       ├── MOD3.nii.gz
│       ├── MOD4.nii.gz
│       ├── T1.nii.gz
│       └── lesion.nii.gz
├── preprocess_02
│   ├── flair.nii
│   ├── mask1.nii
│   ├── mprage.nii
│   ├── pd.nii
│   └── t2.nii
├── preprocess_03
│   ├── flair.nii
│   ├── mask1.nii
│   ├── mprage.nii
│   ├── pd.nii
│   └── t2.nii
├── preprocess_04
│   ├── flair.nii
│   ├── mask1.nii
│   ├── mprage.nii
│   ├── pd.nii
│   └── t2.nii
└── preprocess_05
    ├── flair.nii
    ├── mask1.nii
    ├── mprage.nii
    ├── pd.nii
    └── t2.nii

(tmp was not there before running the segmentation)

I tried to run with sh nicMSlesion_linux and successfully got a GUI, but after inputting the data folder (preprocess), setting tags,

FLAIR>>flair
T1>>mprage
MOD3>>pd
MOD4>>t2
MASK>>mask1

I run, I get this error, and the GUI quits.

Hi.
With this information, it's difficult to me to see what's going on. Are you using the latest version of the code? If so, I can try to reproduce your environment.

Yes, I am using the latest version, I just pulled to make sure. I have a virtualenv with python 2.7, and have installed the requirements. Something in the register_masks() function in preprocess.py gets upset at my input; it hasn't gone past the first modality without throwing the exception.

I am using Darwin OS and have added an "elif" statement using the same commands used for Linux where needed.

And this is the command line error I receive:

DEBUG: number of input sequences to find: 5
PRE: preprocess_01 identifying input modalities
--> flair.nii as FLAIR image
--> mprage.nii as T1 image
--> t2.nii as MOD3 image
--> pd.nii as MOD4 image
--> mask1.nii as lesion image
INFO: preprocess_01 elapsed time: 1.0 sec
PRE: preprocess_01 registering FLAIR --> T1 space
ERROR: preprocess_01 registering masks on FLAIR quiting program.

(I also uncheck "Register modalities" and "Skull-strip modalities", as my images are skull-stripped and registered accurately)

I am using a CPU, not a GPU, so I believe the issue came from the fact that I had not changed the "Model" option to "cpu", and the algorithm was attempting to use "pygpu". However, after having changed "Model" to "cpu", I now get this error:

Please select options for training or inference in the menu...
objc[9423]: Class FIFinderSyncExtensionHost is implemented in both /System/Library/PrivateFrameworks/FinderKit.framework/Versions/A/FinderKit (0x7fff92738c90) and /System/Library/PrivateFrameworks/FileProvider.framework/OverrideBundles/FinderSyncCollaborationFileProviderOverride.bundle/Contents/MacOS/FinderSyncCollaborationFileProviderOverride (0x1817dd4cd8). One of the two will be used. Which one is undefined.
Exception in Tkinter callback
Traceback (most recent call last):
  File "/anaconda3/envs/.mslesions/lib/python2.7/lib-tk/Tkinter.py", line 1541, in __call__
    return self.func(*args)
  File "app.py", line 667, in train_net
    self.write_user_configuration()
  File "app.py", line 548, in write_user_configuration
    user_config.set('model', 'gpu', self.param_mode.get())
  File "/anaconda3/envs/.mslesions/lib/python2.7/lib-tk/Tkinter.py", line 373, in get
    return getint(self._tk.globalgetvar(self._name))
ValueError: invalid literal for int() with base 10: 'cpu'

Since my computer is running Darwin OS, I have run the algorithm from a Docker anaconda3 container, by opening an XQuartz terminal and running

docker --rm -it \
    -e DISPLAY=docker.for.mac.localhost:0 \
    -v /path/with/nicMSlesions/:/app \
    continuumio/anaconda3 \
    /bin/bash

Then, when a (Linux) terminal opens, I conda install and pip install all requirements and run sh nicMSlesion_linux, which results in the above error, which seems to have something to do with my "cpu" input.

Hi,

The problem was on some internal configuration where I select CPU or GPU. This is quite tedious because I was trying to support CPU and GPU training and Tensorflow or Theano from the same pip package installation. This is doable with Theano but not with Tensorflow, where a different package has to be installed in each case.

So, I have fixed the backend to only Tensorflow now and I have specified the way to install the libraries in each of the cases. Please, can you install it again with tensorflow and try it again? In my machines, the code is working in both GPU and CPU modes.

I re-cloned the repository, but it seems I still get the error below:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1536, in __call__
    return self.func(*args)
  File "app.py", line 673, in train_net
    self.write_user_configuration()
  File "app.py", line 554, in write_user_configuration
    user_config.set('model', 'gpu_number', self.param_gpu_number.get())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 368, in get
    return getint(self._tk.globalgetvar(self._name))
ValueError: invalid literal for int() with base 10: 'cpu'

Yes, here are my files, options, and inputs for training. The images shown below were run on MacOS for the sake of convenience, but when I do run, I run in a Docker Linux image, so that Linux is the OS.


capture d ecran 2018-07-17 a 13 37 09


capture d ecran 2018-07-17 a 13 37 45



capture d ecran 2018-07-17 a 13 38 19

Ok put an integer on GPU number.

Even if I'm running with cpu?

Yes. Now GPU number is a GPU only option.

Anyway, I will fix this in the code to prevent this exception.

I see. Then, I cannot run the code on a CPU?