Giter Site home page Giter Site logo

hd-bet's People

Contributors

blakedewey avatar fabianisensee avatar patricio-astudillo avatar plu-project avatar reubendo avatar tashrifbillah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hd-bet's Issues

'sform' info stripped from output skull-stripped images

Hi Fabian,
Great program! Thank you for sharing!

I have been using HD-BET for past few months to skull-strip T1 images, but am now coming up against an "Inconsistent orientation" error using FSL's make_bianca_mask. I linked this to the sform information being stripped from the nifti header in the HD-BET created skull-stripped image (using skull-stripped image from FSL bet which does not remove sform info works perfectly with make_bianca_mask without issue).

I am wondering why HD-BET strips this info and whether there may be plans to prevent this from happening or adding the info back into the output images.

Thanks.

Andrew

GPU not recognized?

I use a Dell XPS 13 9300 with the GPU: "Intel Corporation Iris Plus Graphics G7 (rev 07)" -- on Ubuntu 20.04. When I try to run HD-BET it gives an error "RuntimeError: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx".

Is there a way to get it to recognize and use my GPU? Or does it have to be NVIDIA based?

I understand I can use my CPU, and plan on using that if the GPU cannot work, but I wanted to check!

Thanks!

Difference between -o and -s ?

Folks, can you remind us the difference between -o as a file and -s? I used:

hd-bet -i T1w.nii.gz -o mask.nii.gz

but got two files:

mask.nii.gz and mask_mask.nii.gz

Do I need:

hd-bet -i T1w.nii.gz -o mask.nii.gz -s 0

Your documentation is unclear on this.

Where (if at all) does intensity non-uniformity (INU) correction occur?

Hi experts.

Admittedly just found out about this tool, but as I was reading both the code and the OHBM paper about it, and I can't seem to locate in the description where this is occuring.

Does this approach require INU corrections or is there a place in the code where I'm just not seeing it?

Thank you in advance.

unable to download 2.model.

Running hd-bet -i INPUT_FILENAME the execution freezes when trying to download "2.model".
I tried to download it by following the link but the download stops at 26mb.

more graceful installation without development mode and separate download of model weights?

hd-bet seems to require an installation in development mode (-e flag)

This installation creates a folder on the users system.

What changes would be needed to no longer require dev mode? Did you consider directly downloading the model weights with the installation of HD-BET?

Context: Currently, we are trying to work on an update for https://github.com/neuronflow/BraTS-Toolkit

I again would like to incorporate HD-BET and have everything pip installable.

problem with hd-bet_params

Hello,
Thank you for this nice repository.
I have tried several time to clone this repository and then use pip install -e .
But there is not any folder named : hd-bet_params.
and when I run hd-bet I receive this error: RuntimeError: Unable to find a valid cuDNN algorithm to run convolution
how can I fix this problem?

Bests

Can I get a pretrained weight?

Hi
I am impressed with your work.
Thank you very much.

As you know, training code is not available.
so, Can I get a pretrained weight?

I look forward to your reply.
Regards.

Error on Model download


########################

Downloading https://zenodo.org/record/2540695/files/0.model?download=1 ...
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1318, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1239, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1285, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1234, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 964, in send
    self.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1400, in connect
    server_hostname=server_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 407, in wrap_socket
    _context=self, _session=session)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 814, in __init__
    self.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1068, in do_handshake
    self._sslobj.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 689, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:841)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/bin/hd-bet", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/Users/work/HD-BET/HD_BET/hd-bet", line 119, in <module>
    run_hd_bet(input_files, output_files, mode, config_file, device, pp, tta, save_mask, overwrite_existing)
  File "/Users/work/HD-BET/HD_BET/run.py", line 42, in run_hd_bet
    maybe_download_parameters(0)
  File "/Users/work/HD-BET/HD_BET/utils.py", line 35, in maybe_download_parameters
    data = urlopen(url).read()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 526, in open
    response = self._open(req, data)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 544, in _open
    '_open', req)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1361, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1320, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:841)>

I downloaded the 5 models manually now, where do I put those files and skip the error message?
Where do you put the model

hd-bet not working on HPC cluster

Hi All!

I was trying to run hd-bet on an HPC cluster from within a python script.

The steps I followed were:

  1. activate conda environment on the cluster
  2. git clone https://github.com/MIC-DKFZ/HD-BET
  3. cd HD-BET
  4. pip install -e .
  5. Packages are installed correctly (e.g. torch, ..) and in the end I get Successfully installed HD-BET

However, when I invoke it from the python script with, for instance,

# run brain extraction on CPU
hd_bet_cpu = ["hd-bet", "-i", angio_path, "-device", "cpu", "-mode", "fast", "-tta", "0"]
process = subprocess.Popen(hd_bet_cpu, stdout=subprocess.PIPE)  # pass the list as input to Popen
out = process.communicate()[0]

the script finishes, but the command is not executed. Also, if I check the error logs, I get:

/var/spool/slurm/job381401/slurm_script: line 14: activate: No such file or directory
Traceback (most recent call last):
File "/home/to5743/miniconda3/envs/aneurysms/bin/hd-bet", line 6, in
exec(compile(open(file).read(), file, 'exec'))
File "/home/to5743/miniconda3/envs/aneurysms/bin/HD-BET/HD_BET/hd-bet", line 119, in
run_hd_bet(input_files, output_files, mode, config_file, device, pp, tta, save_mask, overwrite_existing)
File "/home/to5743/miniconda3/envs/aneurysms/bin/HD-BET/HD_BET/run.py", line 83, in run_hd_bet
data, data_dict = load_and_preprocess(in_fname)
File "/home/to5743/miniconda3/envs/aneurysms/bin/HD-BET/HD_BET/data_loading.py", line 46, in load_and_preprocess
images[k] = preprocess_image(images[k], is_seg=False, spacing_target=(1.5, 1.5, 1.5))
File "/home/to5743/miniconda3/envs/aneurysms/bin/HD-BET/HD_BET/data_loading.py", line 21, in preprocess_image
image = resize_image(image, spacing, spacing_target).astype(np.float32)
File "/home/to5743/miniconda3/envs/aneurysms/bin/HD-BET/HD_BET/data_loading.py", line 10, in resize_image
return resize(image, new_shape, order=order, mode='edge', cval=0, anti_aliasing=False)
TypeError: resize() got an unexpected keyword argument 'anti_aliasing'

Any idea on how to get around this? By the way, the exact same scrpit runs correctly when I run it locally (i.e. the brain mask is created)

Thanks a lot in advance :)

'HD-bet' is not an internal or external command, nor a runnable program or batch file.

Hello, I want to know if HD-BET supports Win10 system,,I have run the following command
cd HD-BET pip install -e . ,However, there is a problem in executing the following code hd-bet --help
HD-bet' is not an internal or external command, nor a runnable program or batch file.

I don't know what went wrong,
Any help would be greatly appreciated。

Use for MRA data

Hi

very nice work and so helpful but can this tool been used for magnetic resonance angiography brain extraction?

I look forward to your reply.
Regards.

SimpleITK>=2.0.2 fails to open nii files

When installing hd-bet from github, the requirement file states SimpleITK>=2.0.2 and this (currently) installs SimpleITK 2.1.1.2.

This version of SimpleITK fails to open *.nii.gz files. I already mentioned this in a previous issue but this was overwritten.

Fix: SimpleITK==2.0.2 works fine.

SimpleITK>=2.0.2

calling hd-bet from r-studio

Hi,
hd-bet is working from mac terminal. When I run hd-bet command from r-studio,I am always getting following error:

Screen Shot 2023-05-18 at 1 01 22 PM

Could you please help me on this issue?
Arzu

incompatible with numpy>=1.25

Hello,

HD-BET does not work if it is installed alongside numpy >= 1.25

File "/home/mambaforge/envs/img/lib/site-packages/HD_BET/data_loading.py", line 87, in save_segmentation_nifti
    if np.any(np.array(seg_old_size) != np.array(dct['size'])[[2, 1, 0]]):
ValueError: operands could not be broadcast together with shapes (117,171,171) (3,)

Issue with mkl-service

When I try to run the hd-bet command, the following issue is showed, I tried to fix with setting MKL_THREADING parameter but did not help much. Any suggestions?

Error: mkl-service + Intel(R) MKL: MKL_THREADING_LAYER=INTEL is incompatible with libgomp-7c85b1e2.so.1 library.
Try to import numpy first or set the threading layer accordingly. Set MKL_SERVICE_FORCE_INTEL to force it.

MacOS error

Hello
What operating systems does this support. I tried to run this on my MacOS computer with a simple 1mm isotropic T1-image and get the following errors (running as sudo did not help):

>sysctl -n machdep.cpu.brand_string
Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
>uname -a
Darwin Chriss-MacBook-Pro.local 18.7.0 Darwin Kernel Version 18.7.0: Sun Dec  1 18:59:03 PST 2019; root:xnu-4903.278.19~1/RELEASE_X86_64 x86_64
>hd-bet -i 2_T1.nii.gz -device cpu -mode fast -tta 0
########################
If you are using hd-bet, please cite the following paper:
Isensee F, Schell M, Tursunova I, Brugnara G, Bonekamp D, Neuberger U, Wick A, Schlemmer HP, Heiland S, Wick W,Bendszus M, Maier-Hein KH, Kickingereder P. Automated brain extraction of multi-sequence MRI using artificialneural networks. arXiv preprint arXiv:1901.11341, 2019.
########################

Downloading https://zenodo.org/record/2540695/files/0.model?download=1 ...
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1317, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1244, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1290, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1239, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1026, in _send_output
    self.send(msg)
...

Can't run hd-bet on apple silicon

I'm currently trying to run the application on an M3Pro processor, unfortunately I'm only getting the following error messages.

Regular usage:
hd-bet -i /Users/XXXXXXXXX/Desktop/01005097/01005097_T1.nii.gz -o /Users/XXXXXXXXX/Desktop/01005097/01005097_T1_brainextracted.nii.gz

Output:
Original error was: dlopen(/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/core/_multiarray_umath.cpython-311-darwin.so, 0x0002): tried: '/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/core/_multiarray_umath.cpython-311-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/core/_multiarray_umath.cpython-311-darwin.so' (no such file), '/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/core/_multiarray_umath.cpython-311-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

Using CPU-mode only:
hd-bet -i /Users/XXXXXXXXX/Desktop/01005097/01005097_T1.nii.gz -o /Users/XXXXXXXXX/Desktop/01005097/01005097_T1_brainextracted.nii.gz -device cpu -mode fast -tta 0

Output:
Original error was: dlopen(/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/core/_multiarray_umath.cpython-311-darwin.so, 0x0002): tried: '/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/core/_multiarray_umath.cpython-311-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/core/_multiarray_umath.cpython-311-darwin.so' (no such file), '/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/core/_multiarray_umath.cpython-311-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

Both error massages are a bit longer, as another exception occurred during the handling of the first exception.

Has anyone found a solution to this problem?

Oddly enough, I have also installed the HD-BET extension for Slicer, where it seems to work as expected.

How to train HD-bet on new data?

Hi,
I was able to use the HD-bet on our data. The pros are it is fast (on a Tesla P100 GPU) and fully automatic but the results were not exactly better than a semi-automatic modified FSL/BET.
I wonder whether I can somehow train the model on our data and improve the outputs?

Thanks,
Mahmoud

Contribute HD-BET to OpenSource Framework Nobrainer-ZOO

I am contacting you from Seanseable Intelligence group in McGovern Brain Institute at MIT. We are developing a toolbox called Nobrainer-zoo which is a collection of state of the art deep models for the neuroimaging community.

In Nobrainer-zoo, we are facilitating the use of pre-trained models for inference and retraining by providing the environment and easy to use commands for users. HD-BET is a very interesting and useful model for the community and we would like your collaboration to add it to the Nobrainer-zoo.

To add it, we are considering models with the structure of “Organization_name/Model_name/version​” in the zoo repository. We will deeply appreciate if you could provide the organization name and a version number (based on https://semver.org/) for the model ?
ccing: @Hoda1394

Deprecation warning

I see this warning, how to resolve it:

/opt/miniconda/bin/hd-bet:4: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  __import__('pkg_resources').require('HD-BET==1.0')

hd-bet not recognized

Thank you for the repository!

I'm trying to run the code in the terminal and I received the error
'hd-bet' is not recognized as an internal or external command,
operable program or batch file.

What should I do to fix?

Running HD-BET from a python script in a Jupyter Notebook

Hello,

I am trying to run hd-bet in a Jupyter Notebook. I have an anaconda environment and I go into its location and install HD-BET. Once I have activated the environment and run 'hd-bet' in the command line I get the below output. Do you have any idea how to fix this? It doesn't give an error if I do it when not in the anaconda environment.

File "/home/jmcn735/fsl/fslpython/bin/hd-bet", line 7, in
exec(compile(f.read(), file, 'exec'))
File "/home/jmcn735/fsl/fslpython/HD-BET/HD_BET/hd-bet", line 4, in
from HD_BET.run import run_hd_bet
File "/home/jmcn735/fsl/fslpython/HD-BET/HD_BET/run.py", line 4, in
from HD_BET.data_loading import load_and_preprocess, save_segmentation_nifti
File "/home/jmcn735/fsl/fslpython/HD-BET/HD_BET/data_loading.py", line 3, in
from skimage.transform import resize
File "/home/jmcn735/fsl/fslpython/lib/python3.9/site-packages/skimage/transform/init.py", line 4, in
from .radon_transform import (radon, iradon, iradon_sart,
File "/home/jmcn735/fsl/fslpython/lib/python3.9/site-packages/skimage/transform/radon_transform.py", line 5, in
from scipy.fft import fft, ifft, fftfreq, fftshift
File "/home/jmcn735/fsl/fslpython/lib/python3.9/site-packages/scipy/fft/init.py", line 91, in
from ._helper import next_fast_len
File "/home/jmcn735/fsl/fslpython/lib/python3.9/site-packages/scipy/fft/_helper.py", line 3, in
from ._pocketfft import helper as _helper
File "/home/jmcn735/fsl/fslpython/lib/python3.9/site-packages/scipy/fft/_pocketfft/init.py", line 3, in
from .basic import *
File "/home/jmcn735/fsl/fslpython/lib/python3.9/site-packages/scipy/fft/_pocketfft/basic.py", line 6, in
from . import pypocketfft as pfft
ImportError: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /home/jmcn735/fsl/fslpython/lib/python3.9/site-packages/scipy/fft/_pocketfft/pypocketfft.cpython-39-x86_64-linux-gnu.so)

ConnectionRefusedError: [Errno 111] Connection refused

Hello!
When I run this code, there are some mistakes.
Downloading https://zenodo.org/record/2540695/files/0.model?download=1 ... Traceback (most recent call last): File "/software/anaconda3/lib/python3.6/urllib/request.py", line 1318, in do_open encode_chunked=req.has_header('Transfer-encoding')) File "/software/anaconda3/lib/python3.6/http/client.py", line 1239, in request self._send_request(method, url, body, headers, encode_chunked) File "/software/anaconda3/lib/python3.6/http/client.py", line 1285, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/software/anaconda3/lib/python3.6/http/client.py", line 1234, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/software/anaconda3/lib/python3.6/http/client.py", line 1026, in _send_output self.send(msg) File "/software/anaconda3/lib/python3.6/http/client.py", line 964, in send self.connect() File "/software/anaconda3/lib/python3.6/http/client.py", line 1392, in connect super().connect() File "/software/anaconda3/lib/python3.6/http/client.py", line 936, in connect (self.host,self.port), self.timeout, self.source_address) File "/software/anaconda3/lib/python3.6/socket.py", line 722, in create_connection raise err File "/software/anaconda3/lib/python3.6/socket.py", line 713, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused

I want to know how to solve it, thank you very much!

Multi-GPU

Hi, firstly thanks for a great package. I wanted to know if I can somehow implement multiple gpus when available. I am not so familiar with pytorch, can you tell me if you are planning to make it a feature or can you help me with how i can integrate multiple gpus using existing scripts?

default parameter download folder inconsistent

Hello, it seems that the default parameter download folder is inconsistent between that in readme(~/.hd-bet_params) and that in HD-BET/paths.py(~/hd-bet_params). A single dot is the difference, maybe a typo.

pip3 NOT pip!

Ubuntu18 and Mate19 have python 2.7 and python 3.7 running, but python 2.7 is the default.

the install directions need to include (for Ubuntu18 & Mate19)

sudo apt-get install python3-pip
cd ~/HD-BET
pip3 install -e .

the directions as written use pip (which defaults to python 2.7 in ubuntu and generates a "there is no python3.5 or greater" error when trying to install HD-BET)

which then prompts one to one either try and alias out the python2.7 in ubuntu, which works poorly...or uninstall python 2.7, and for ubuntu, that leads to a truly epic fail/disaster.

existing install directions are TOO GENERAL...need to be more specific as stated above if the install is to work smoothlyfor Ubuntu18 or MATE19

SimpleITK==2.0.2

Dear @FabianIsensee,

if I use versions higher than 2.0.2, I receive the following error: ITK only supports orthonormal direction cosines. No orthonormal definition found. This is also mentioned in (MIC-DKFZ/nnDetection#24).

Could please undo your change in the requirement.txt file please? I have corrected this in the past and now I receive the same errors as before.

If you want I can push this change also, but this seems a bit back and forth to me.

Best regards,
Patricio

ModuleNotFoundError: No module named 'imp' with Python v3.12

The imp module has been removed in Python3.12 in favor of importlib.
Ref: https://docs.python.org/3.11/library/imp.html

Deprecated since version 3.4, will be removed in version 3.12: The imp module is deprecated in favor of importlib.

Currently this throws the following error:

Traceback (most recent call last):
File "/home/sappukuttan/miniconda3/bin/hd-bet", line 7, in
exec(compile(f.read(), file, 'exec'))
File "/<>/HD-BET/HD_BET/hd-bet", line 4, in
from HD_BET.run import run_hd_bet
File "/<>/HD-BET/HD_BET/run.py", line 6, in
import imp
ModuleNotFoundError: No module named 'imp'

error running bet-hd on cpu

Hi,
I followed the installation instructions on a Dell Laptop without GPU. The OS is Linux 4.15.0-45-generic x86_64. I am receiving the following error:

mahmoud@Latitude:~/HD-BET$ hd-bet -i ~/data/10942/data_MNI.nii.gz -o ~/data/10942/data2_HD_BET.nii.gz -device cpu -mode fast -tta 0

########################
If you are using hd-bet, please cite the following paper:
Isensee F, Schell M, Tursunova I, Brugnara G, Bonekamp D, Neuberger U, Wick A, Schlemmer HP, Heiland S, Wick W,Bendszus M, Maier-Hein KH, Kickingereder P. Automated brain extraction of multi-sequence MRI using artificialneural networks. arXiv preprint arXiv:1901.11341, 2019.
########################

File: /home/mahmoud/data/10942/data_MNI.nii.gz
preprocessing...
Traceback (most recent call last):
File "/home/mahmoud/anaconda3/bin/hd-bet", line 6, in
exec(compile(open(file).read(), file, 'exec'))
File "/home/mahmoud/HD-BET/HD_BET/hd-bet", line 119, in
run_hd_bet(input_files, output_files, mode, config_file, device, pp, tta, save_mask, overwrite_existing)
File "/home/mahmoud/HD-BET/HD_BET/run.py", line 83, in run_hd_bet
data, data_dict = load_and_preprocess(in_fname)
File "/home/mahmoud/HD-BET/HD_BET/data_loading.py", line 46, in load_and_preprocess
images[k] = preprocess_image(images[k], is_seg=False, spacing_target=(1.5, 1.5, 1.5))
File "/home/mahmoud/HD-BET/HD_BET/data_loading.py", line 21, in preprocess_image
image = resize_image(image, spacing, spacing_target).astype(np.float32)
File "/home/mahmoud/HD-BET/HD_BET/data_loading.py", line 10, in resize_image
return resize(image, new_shape, order=order, mode='edge', cval=0, anti_aliasing=False)
TypeError: resize() got an unexpected keyword argument 'anti_aliasing'

Security policy error

Hi,

I have succesfully installed HD-BET. However, on first run using ./hd-bet -device cpu -mode fast -tta 0 I get the following error:

import-im6.q16: attempt to perform an operation not allowed by the security policy `PS' @ error/constitute.c/IsCoderAuthorized/408.
from: can't read /var/mail/HD_BET.run
from: can't read /var/mail/HD_BET.utils
import-im6.q16: attempt to perform an operation not allowed by the security policy `PS' @ error/constitute.c/IsCoderAuthorized/408.
./hd-bet: line 8: syntax error near unexpected token `"\n########################"'
./hd-bet: line 8: `    print("\n########################")'

Has anybody encountered something like this before?

Cannot run postprocessing because the postprocessing file is missing

Hello,

I'm encountering this issue with HD-BM:

WARNING! Cannot run postprocessing because the postprocessing file is missing. Make sure to run consolidate_folds in the
output folder of the model first!
The folder you need to run this in is /home/dezubica/NeuroAI-HD/HD-BM/normal

The folder 'normal' contains only the following files: fold_0 fold_1 fold_2 fold_3 fold_4 plans.pkl

Set number of cores

Hey devs!

Thanks for this tool! I am testing it currently on FDG-PET images and it seems to do a good job. I am also wrapping it in a custom nipype interface and was wondering if you could add a parameter that sets the max number of CPU cores. Currently, I have no control over it and it seems to grab all available cores.

-Jelle

AI behind HD-BET?

Hello everyone,

This is not an issue.

Thank you for providing this highly interesting module and great to have the HD-BET 3D Slicer extension available.

Is there any information on how you trained your software technically? What is the AI framework behind HD-BET?
Asking because similar tissue stripping modules could be interesting for other organ systems. Example: stripping off the thoracic wall in lung CT.
Kind regards
Rudolf

Regarding application of InstanceNorm3d and F.leaky_relu twice on the input

Hi Fabian,

I noticed something odd in the code. It seems to me that you are applying BatchNormalization followed by a LeakyReLU twice for a given input.
It can be spotted by the following behavior.
`

class DownsamplingModule(nn.Module):

def __init__(self, in_channels, out_channels, leakiness=1e-2, conv_bias=True, inst_norm_affine=True,
             lrelu_inplace=True):
    nn.Module.__init__(self)
    self.lrelu_inplace = lrelu_inplace
    self.inst_norm_affine = inst_norm_affine
    self.conv_bias = conv_bias
    self.leakiness = leakiness
    self.bn = nn.InstanceNorm3d(in_channels, affine=self.inst_norm_affine, track_running_stats=True)
    self.downsample = nn.Conv3d(in_channels, out_channels, 3, 2, 1, bias=self.conv_bias)

def forward(self, x):
    x = F.leaky_relu(self.bn(x), negative_slope=self.leakiness, inplace=self.lrelu_inplace)
    b = self.downsample(x)
    return x, b

class LocalizationModule(nn.Module):

def __init__(self, in_channels, out_channels, leakiness=1e-2, conv_bias=True, inst_norm_affine=True,
             lrelu_inplace=True):
    nn.Module.__init__(self)
    self.lrelu_inplace = lrelu_inplace
    self.inst_norm_affine = inst_norm_affine
    self.conv_bias = conv_bias
    self.leakiness = leakiness
    self.conv1 = nn.Conv3d(in_channels, in_channels, 3, 1, 1, bias=self.conv_bias)
    self.bn_1 = nn.InstanceNorm3d(in_channels, affine=self.inst_norm_affine, track_running_stats=True)
    self.conv2 = nn.Conv3d(in_channels, out_channels, 1, 1, 0, bias=self.conv_bias)
    self.bn_2 = nn.InstanceNorm3d(out_channels, affine=self.inst_norm_affine, track_running_stats=True)

def forward(self, x):
    x = F.leaky_relu(self.bn_1(self.conv1(x)), negative_slope=self.leakiness, inplace=self.lrelu_inplace)
    x = F.leaky_relu(self.bn_2(self.conv2(x)), negative_slope=self.leakiness, inplace=self.lrelu_inplace)
    return x

skip4, x = self.down4(x)
x = torch.cat((skip4, x), dim=1)
x = self.loc1(x)
x = self.up2(x)

`
If we see carefully, Downsampling module returns the skip4 after it has applied BatchNormalization and LeakyReLU on its input and then also returns the Downsampled Convolution operation.

Then we later concatenate the skip4 to x and apply BatchNormalization and LeakyReLU on the initial input. But we know skip4 has already been applied with BatchNormalization and LeakyReLU.

I don't understand how it makes sense to apply the input with BatchNormalization and LeakyReLU twice to a given input. Can you please state the reason why you do such an operation?

Trouble installing on Mac OS X 10.13.6

Hi Fabian,

I was having trouble installing HD_BET. I'm on Mac OS X 10.13.6 ( this comes with a system python 2.7 ) so to setup with python 3 & pip3, I had to do so with conda virtual environment.

I used the "sudo -H install -e ." as when I ran the install command without the "sudo -H" I got the following warning:
(Defaulting to user installation because normal site-packages is not writeable), and for some reason after the install, I simply couldn't find hd-bet or HD_BET on my path at all.

After a few attempts, I got it to work. Long story short, for Mac OS X, users will need a conda virtual environment with python3 and pip3 activated, then using "sudo -H pip install -e ." everything should be fine.

If the user attempts to install with "pip install -e ." or "pip install -e . --user", it still won't work.
Also make sure to remove the previous attempts to install before going for the "sudo -H pip install -e ."

I thought this would be worth sharing for other Mac OS X users, although it is no longer an issue for me.

Thanks and best regards,
AR

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.