Closed FreshmanMa closed 4 months ago
I don't know about Windows. We recently got ANTsPy to build on Windows, but I don't know if ANTsPyNet will work.
On Mac or Linux, you can try installing with pip:
pip install antspynet
or via setup.py
git clone https://github.com/ANTsX/ANTsPyNet
cd ANTsPyNet
python setup.py install
If you have docker, you can get ANTsPyNet here
https://hub.docker.com/r/cookpa/antspynet/tags
On my Mac, I have
tensorflow==2.3.1 tensorflow-estimator==2.3.0 tensorflow-probability==0.11.1
If you're new to Python, I recommend learning about virtual environments and miniconda, because that will help you create an environment just for ANTsPyNet, where you can control the version of dependencies.
I don't know about Windows. We recently got ANTsPy to build on Windows, but I don't know if ANTsPyNet will work.
On Mac or Linux, you can try installing with pip:
pip install antspynet
or via setup.py
git clone https://github.com/ANTsX/ANTsPyNet cd ANTsPyNet python setup.py install
If you have docker, you can get ANTsPyNet here
https://hub.docker.com/r/cookpa/antspynet/tags
On my Mac, I have
tensorflow==2.3.1 tensorflow-estimator==2.3.0 tensorflow-probability==0.11.1
If you're new to Python, I recommend learning about virtual environments and miniconda, because that will help you create an environment just for ANTsPyNet, where you can control the version of dependencies.
First, thanks to your reply, and the tensorflow need a gpu version ?
To use the GPU, it needs to be tensorflow-gpu, yes.
To use the GPU, it needs to be tensorflow-gpu, yes.
Ok, thanks, I'll have a try now.
Sorry, there is a question I don't know how to deal with. I wanna use antspynet.utilities.deep_atropos() to segment one processed HCP data into Six-tissue segmentation.
I rent a server, I use the following codepip install antspynet -i https://pypi.tuna.tsinghua.edu.cn/simple
, to install antspynet, and wana use a demo with deep_atropos, but I can't do it . and using python setup.py install
,the error is Reading https://pypi.org/simple/matplotlib/ error: The read operation timed out
the code:
import ants
import antspynet
file_path = './dataset/test_GT/531536.nii.gz
image = ants.image_read(file_path)
segmentation = antspynet.utilities.deep_atropos(image)
segmentation_result = segmentation['segmentation']
ants.image_write(segmentation_result, "./dataset/segmentation/531536.nii.gz")
but there is error
Exception: URL fetch failure on https://figshare.com/ndownloader/files/34821874: 403 -- Forbidden
What should I do to resovle it? and if I use the code above, can get the segmentation.nii.gz data ?
Thanks!
To use the GPU, it needs to be tensorflow-gpu, yes.
It seems your server is not allowed to download from Figshare. I don't know how to solve that. If you can download by other means (eg from another machine), here's how you can add it to your ANTsPyNet:
mkdir ~/.keras
Copy this text into ~/.keras/keras.json
{
"floatx": "float32",
"epsilon": 1e-07,
"backend": "tensorflow",
"image_data_format": "channels_last"
}
mkdir ~/.keras/ANTsXNet
Copy the files (eg, https://figshare.com/ndownloader/files/34821874 downloads as brainExtractionRobustT1.h5
) to ~/.keras/ANTsXNet
It seems your server is not allowed to download from Figshare. I don't know how to solve that. If you can download by other means (eg from another machine), here's how you can add it to your ANTsPyNet:
- mkdir ~/.keras
- Copy this text into
~/.keras/keras.json
{ "floatx": "float32", "epsilon": 1e-07, "backend": "tensorflow", "image_data_format": "channels_last" }
- mkdir
~/.keras/ANTsXNet
- Copy the files (eg, https://figshare.com/ndownloader/files/34821874 downloads as
brainExtractionRobustT1.h5
) to~/.keras/ANTsXNet
Sorry,I don't know why it did not work. So today, I try use docker, and I had dodocker pull cookpa/antspynet:latest
and docker run -it cookpa/antspynet
, into a python environment,
How can I run a .py script and upload my mri.nii.gz data?and the docker will use the gpu of my pc? I wanna get this kind of segmentation data in picture.
It's hard for me now. Your help will be very useful for me, thanks a lot.
It seems your server is not allowed to download from Figshare. I don't know how to solve that. If you can download by other means (eg from another machine), here's how you can add it to your ANTsPyNet:
- mkdir ~/.keras
- Copy this text into
~/.keras/keras.json
{ "floatx": "float32", "epsilon": 1e-07, "backend": "tensorflow", "image_data_format": "channels_last" }
- mkdir
~/.keras/ANTsXNet
- Copy the files (eg, https://figshare.com/ndownloader/files/34821874 downloads as
brainExtractionRobustT1.h5
) to~/.keras/ANTsXNet
It seems your server is not allowed to download from Figshare. I don't know how to solve that. If you can download by other means (eg from another machine), here's how you can add it to your ANTsPyNet:
- mkdir ~/.keras
- Copy this text into
~/.keras/keras.json
{ "floatx": "float32", "epsilon": 1e-07, "backend": "tensorflow", "image_data_format": "channels_last" }
- mkdir
~/.keras/ANTsXNet
- Copy the files (eg, https://figshare.com/ndownloader/files/34821874 downloads as
brainExtractionRobustT1.h5
) to~/.keras/ANTsXNet
Sorry,I don't know why it did not work. So today, I try use docker, and I had do
docker pull cookpa/antspynet:latest
anddocker run -it cookpa/antspynet
, into a python environment,How can I run a .py script and upload my mri.nii.gz data?and the docker will use the gpu of my pc? I wanna get this kind of segmentation data in picture.
It's hard for me now. Your help will be very useful for me, thanks a lot.
Can you give me some advice? Thanks
Sorry, I encounter a new promle. using docker provided by, but can't use GPU. What should I do?
I didn't build that container with CUDA, because I don't have a machine that supports it. But deep Atropos will run quite quickly without it.
I didn't build that container with CUDA, because I don't have a machine that supports it. But deep Atropos will run quite quickly without it.
All right, Thanks! Can give me some advice to get the MRI after segmentation, like this picture
I didn't build that container with CUDA, because I don't have a machine that supports it. But deep Atropos will run quite quickly without it.
All right, Thanks! Can give me some advice to get the MRI after segmentation, like this picture
https://antsx.github.io/ANTsPyNet/docs/build/html/utilities.html#antspynet.utilities.deep_atropos
only requires tensorlfow-version? only uisng under mac or linux? I don't understand, sorry, I'm freshman.