Skip to content

gykovacs/maweight

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

maweight

A Python package for multi-atlas based weight estimation for CT images, including segmentation by registration, feature extraction and model selection for regression.

About

A detailed description of the implemented methodology can be found in the paper:

The package is used intensively in the case study of estimating weights of meat cuts from the CT images of rabbit in the repository: https://github.com/gykovacs/rabbit_ct_weights It is also used to estimate the valuable meat parts of chickens, as shown in the following repository: https://github.com/cseka7/chicken_ct_weights

If you use the package, please consider citing the papers:

@article{Csoka2022,
    author={\'Ad\'am Cs\'oka and Gy\"orgy Kov\'acs and Vir\'ag \'Acs and Zsolt Matics and Zsolt Gerencs\'er and Zsolt Szendr\"o and \"Ors Petneh\'azy and Imre Repa and Mariann Moizs and Tam\'as Donk\'o},
    title={A general technique for the estimation of farm animal body part weights from CT scans and its applications in a rabbit breeding program},
    volume = {196},
    pages = {106865},
    year = {2022},
    issn = {0168-1699},
    journal = {Computers and Electronics in Agriculture},
    doi = {https://doi.org/10.1016/j.compag.2022.106865},
    url = {https://www.sciencedirect.com/science/article/pii/S016816992200182X},
}

@article{Csoka2024,
author={\'Ad\'am Cs\'oka and Szilvia Eszter Simon and Tam\'as P\'eter Farkas and S\'andor Sz\'asz and Zolt\'an S\"ut\''o and \"Ors Petneh\'azy and Gy\"orgy Kov\'acs snd Imre Repa and Tam\'as Donk\'o},
title={ESTIMATION OF THE VALUABLE BROILER CHICKEN MEAT PARTS MASS FROM CT IMAGES USING ELASTIC REGISTRATION},
year={2024}
doi = {},
url = {}
}

Installation (Windows/Linux/Mac) -----------

Prerequisites: elastix **********

Make sure the elastix package (https://elastix.lumc.nl/) is installed and available in the command line by issuing

> elastix

If elastix is properly installed, the following textual output should appear in the terminal:

Use "elastix --help" for information about elastix-usage.

Installing the `maweight` package ***********

Clone the GitHub repository:

> git clone https://github.com/gykovacs/maweight.git

Navigate into the root directory of the repository:

> cd maweight

Install the code into the active Python environment

> pip install .

Usage examples ----------

Segmentation by elastic registration ********

The main functionality of the package is registering image A to image B by elastic registration and then transforming a set of images C, D, ... to image B by the same transformation field. This functionality is implemented in the `register_and_transform` function:

from maweight import register_and_transform

A # path, ndarray or Nifti1Image - the atlas image
B # path, ndarray or Nifti1Image - the unseen image
[C, D] # paths, ndarrays or Nifti1Image objects - the atlas annotations for A, to be transformed to B
[C_transformed_path, D_transformed_path] # paths of the output images

register_and_transform(A, B, [C, D], [C_transformed_path, D_transformed_path])

Feature extraction ******

Given an image B and a set of atlases registered to it [C, D, ...], with corresponding labels [Clabel, Dlabel, ...] (for the labeling of features), feature extraction with bin boundaries [b0, b1, ...] can be executed in terms of the `extract_features_3d` function:

from maweight import extract_features_3d

B # path, ndarray or Nifti1Image - a base image to extract features from
registered_atlases # list of paths, ndarrays or Nivti1Image objects
labels # list of labels of the atlases (used to label the features)
bins= [0, 20, 40, 60, 80, 100] # bin boundaries for histogram feature extraction

features= extract_features_3d(B, registered_atlases, labels, bins)

Model selection *******

Given a dataset of features extracted from the ensemble of segmentations, one can carry out regression model fitting by the `model_selection` function:

from maweight import model_selection

features # pandas DataFrame of features
targets # pandas Series of corresponding weights

results= model_selection(features, targets)

By default, the model selection runs simulated annealing based feature ssubset and regressor parameter selection for kNN, linear, lasso, ridge and PLS regression and returns the summary of results in a pandas DataFrame.

About

Weight estimation in CT by multi atlas techniques

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages