Giter Site home page Giter Site logo

hvpg's Introduction

Segmentation Network (2.5D)

The model is based on UNet with modifications of the dimension with shape of h x w x 5.

Dependencies

Ubuntu 20.04.3, python 3.6, CUDA 11.0, anaconda (4.10.1),nibabel (3.2.1), SimpleITK (2.1.1), numpy (1.19.5), scikit-image (0.17.2), scipy (1.5.2), pytorch (1.7.1), tqdm(4.46.0), opencv-python(4.46.0.66), itk(5.2.0), tensorboard(2.5.0)

Setup

conda install pytorch==1.7.1 torchvision==0.8.2 torchaudio==0.7.2 -c pytorch
pip install nibabel==3.2.1
pip install tensorboard==2.5.0
pip install simpleITK==5.2.0
...

Data

Prepare data
  1. Annotate your data and convert to nifity format files (.nii/.nii.gz).

    example(hepatic vein):

  2. Put the original image and the corresponding labels into two folders to prepare for preprocessing and training.

Preprocess data

Preprocess data into numpy files required by the network: modify the corresponding path parameters in the preprocess.py and run it by your environment.

You can train better network models by modifying these preprocessing parameters:

*spacing*, *shape*, *data_type*(can be modified by yourself)

Run

Train

run train.py

*You need check and set the parameters: CUDA_VISIBLE_DEVICES, dir_checkpoint, input_path, label_path, batchsize, lr, model_type, channels, classes...

Test

run predict.py

*You need to check and set the parameters: CUDA_VISIBLE_DEVICES, model_path, threshold, model_type, channels, classes, data_type, ornt, spacing, shape(according to your preprocess parameters), img_nii_dir, pred_dir...

Results

The following is one of my predicting results.

Extraction of Hepatic Vascular Parameters

Dependencies

python3.6.9. The used third-party libraries: vmtk, vtk, itk, scikit-image, nibabel, xlwt, xlrd, xlutils.

*Note: Nibabel is used to rewrite head information of nifti files. xlwt, xlrd, and xlutils are used to read, write, and copy excel files. Itk, vtk read nifti files, reading and writing 3-D model files(*vtk); vmtk is used to calculate vascular centerline.

Setup

conda create -n vmtk python 3.6.9 conda active vmtk" conda install -c vmtk vtk itk vmtk

Run

Use the source code

*Command "conda activate vmtk", to switch to the vmtk environment and enter the directory of the source code. *Command "python compute_vessel_params.py../../DemoData" and wait until completion. Generated 3-D model files and the corresponding centerline files will be stored in the directory "ProcessedData". Parameters will be stored in the directory "Features".

Results

  1. Model files

Generated 3-D files include model files of vessels and the corresponding centerline files. After running, they will be stored in the directory of "ProcessedData".

  1. Calculation of parameter index

Calculated parameter indexes will be stored in excel file in the directory "Features". For instance,

  • All parameters are stored in an excel file.

hvpg's People

Contributors

chengyanhupi avatar

Stargazers

 avatar ZhangZiyu avatar  avatar limy avatar  avatar  avatar Jun Li avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

hvpg's Issues

mitk

Hello, there is from mitk import npy_regionprops_denoise, nii_resample in predict.py. I have been unable to find this mitk. Is it your custom?

While using the compute_centerlines.py script, I encountered some intricate issues.

I conducted tests using the data from the DemoData directory and noticed that within the compute_centerlines function, the assignment centerline.SourcePoints = inlet (a list) was made. However, it was observed that the length of the inlet list was 1. This seems to be inconsistent with the requirements of the vmtk package, as the vmtkcenterlines.py module apparently mandates that the SourcePoints list should have a minimum length of 6 (because within that file, there is a line of code 'for i in range(len(self.SourcePoints)/3)', if the length of the SourcePoints is less than 6, a `TypeError: 'float' object cannot be interpreted as an integer' error will occur).

Could this issue be attributed to the utilization of a specific version of the vmtk package? The following are the commands I employed during the setup of the required environment:

conda create -n x_vmtk -c vmtk python=3.6.9 itk vtk vmtk llvm=3.3
pip install nibabel==3.2.1
pip install simpleITK==2.1.0 (I would like to remind you that there appears to be an error in this command in your readme)
pip install itk (When using pip install itk==5.2.0, I encountered a consistent error regarding a certain missing module)

Any insights or guidance you can provide would be greatly appreciated.

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.