Skip to main content

Anatomical curvature processing for medical images.

Project description

curvanato

local curvature quantification for anatomical data

Installation & Testing

To install the package locally, navigate to the package root and run:

python3 -m pip install curvanato 

if you want to see some examples of different things the package can do, clone the source package and investigate the contents of the tests directory.

Usage

import ants
import antspynet
import antspyt1w
import curvanato
import re
import os  # For checking file existence
import pandas as pd
import numpy as np
os.environ["ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS"] = "32"
ctype='fs'
tcaudR=curvanato.load_labeled_caudate( option='hmt', binarize=False, label=[2,4,6] )
caudseg=curvanato.load_labeled_caudate( option=ctype )
# this step is important - fs caudate segmentations look pretty terrible in comparison to what i am used to ....
caudseg=ants.threshold_image( caudseg, 50, 50 ).resample_image( [0.5,0.5,0.5], interp_type=0 ).threshold_image(0.5,1)
fn='/tmp/cc_example.nii.gz'
vlab=None
gr=0
subd=0
ccfn = [
        re.sub( ".nii.gz", "_"+ctype+"Rkappa.nii.gz" , fn ), 
        re.sub( ".nii.gz", "_"+ctype+"R.nii.gz" , fn ),
        re.sub( ".nii.gz", "_"+ctype+"Rthk.nii.gz" , fn ),
        re.sub( ".nii.gz", "_"+ctype+"Rkappa.csv" , fn ),
        re.sub( ".nii.gz", "_"+ctype+"Rkappa.png" , fn ),
        re.sub( ".nii.gz", "_"+ctype+"Rthk.png" , fn ) ]
pcaud=[3,4]
plabs=[4]
mytl=1
xx = curvanato.t1w_caudcurv(  caudseg, target_label=mytl, ventricle_label=vlab, 
        prior_labels=pcaud, prior_target_label=plabs, subdivide=subd, grid=gr,
        priorparcellation=tcaudR,  plot=True, smoothing=0.5,
        verbose=True )
ants.plot( xx[0], xx[1], crop=True, axis=2, nslices=21, ncol=7, filename=ccfn[4] )
ants.plot( xx[0], xx[2], crop=True, axis=2, nslices=21, ncol=7, filename=ccfn[5] )
for j in range(3):
    ants.image_write( xx[j], ccfn[j] )
xx[3].to_csv( ccfn[3] )

Example data

this package has been tested on ANTPD data from openneuro.

could also try data here which included repeated T1w acquisitions on same subjects but with different parameters. however, last time i tried this, the link was not working.

rm -r -f build/ curvanato.egg-info/ dist/
python3 -m  build .
python3 -m pip install --upgrade twine
python3 -m twine upload --repository curvanato dist/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

curvanato-1.2.0.tar.gz (91.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

curvanato-1.2.0-py3-none-any.whl (84.7 kB view details)

Uploaded Python 3

File details

Details for the file curvanato-1.2.0.tar.gz.

File metadata

  • Download URL: curvanato-1.2.0.tar.gz
  • Upload date:
  • Size: 91.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for curvanato-1.2.0.tar.gz
Algorithm Hash digest
SHA256 6351fff497326325c6c41af17657462c18c4c14abbd96f1f7fd8acded713c32d
MD5 bbd869fea66cda8527676cafe1a473e8
BLAKE2b-256 61b7f255229db22a9bb914194b919f62077a22386b3aa704dbde5fd7b693c5f8

See more details on using hashes here.

File details

Details for the file curvanato-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: curvanato-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 84.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for curvanato-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1a818bd13ddb66854198c8764f8f1d7749d727cfbbfe9a0c77653eaf63a60105
MD5 afb0cdfc6b537f6eefee8b0291ce3354
BLAKE2b-256 5a0b48d6c7c36aa81c74edc0e5b364df94e25889167fa2c661673d1d87159ed4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page