Skip to main content

Compute cross sectional area of 3d shapes.

Project description

xs3d: Compute cross sectional area for 3D image objects

import xs3d

# let binary image be a boolean numpy array 
# in fortran order that is 500 x 500 x 500 voxels
# containing a shape, which may have multiple 
# connected components, representing e.g. a neuron
binary_image = np.load(...)

# a point inside the shape (must be integer)
vertex = np.array([200,121,78])
# normal vector defining sectioning plane
# it doesn't have to be a unit vector
# vector can be of arbitrary orientation
normal = np.array([0.01, 0.033, 0.9])

# voxel dimensions in e.g. nanometers
resolution = np.array([32,32,40]) 

# cross sectional area returned as a float
area = xs3d.cross_sectional_area(binary_image, vertex, normal, resolution)

When using skeletons (one dimensional stick figure representations) to create electrophysiological compartment simulations of neurons, some additional information is required for accuracy. The caliber of the neurite changes over the length of the cell.

Previously, the radius from the current skeleton vertex to the nearest background voxel was used, but this was often an underestimate as it is sensitive to noise and divots in a shape.

A superior measure would be the cross sectional area using a section plane that is orthogonal to the direction of travel along the neurite. This library provides that missing capability.

How Does it Work?

The algorithm roughly works as follows.

  1. Label voxels that are intercepted by the sectioning plane.
  2. Label the connected components of those voxels.
  3. Filter out all components except the region of interest.
  4. Compute the polygon formed by the intersection of the plane with the 8 corners and 12 edges of each voxel.
  5. Add up the area contributed by each polygon so formed in the component of interest.

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

xs3d-0.1.0.tar.gz (27.0 kB view details)

Uploaded Source

Built Distribution

xs3d-0.1.0-cp311-cp311-macosx_10_9_universal2.whl (156.4 kB view details)

Uploaded CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)

File details

Details for the file xs3d-0.1.0.tar.gz.

File metadata

  • Download URL: xs3d-0.1.0.tar.gz
  • Upload date:
  • Size: 27.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.21.0 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.10

File hashes

Hashes for xs3d-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0747cb6fc2f042d5bc5928a79d7286283e32acf10b0ad507d1750f79d0fa7eb9
MD5 fb49c17088cb61ba544aa823b8b8123a
BLAKE2b-256 18aed0e72e3833b8d9ca60f9cd85966149fa6dd6be8cef2472405ab87506401a

See more details on using hashes here.

File details

Details for the file xs3d-0.1.0-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

  • Download URL: xs3d-0.1.0-cp311-cp311-macosx_10_9_universal2.whl
  • Upload date:
  • Size: 156.4 kB
  • Tags: CPython 3.11, macOS 10.9+ universal2 (ARM64, x86-64)
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.21.0 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.10

File hashes

Hashes for xs3d-0.1.0-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 e5f953998698309da0629600ef575023f0dce15097bd38d06b46ba1669146906
MD5 0ddeb51d055a0103826ec03001b542e2
BLAKE2b-256 339dd4f19b472b1bacfb41b84b49cbf9076a44488cb9d3e699cc2fdac4362aa9

See more details on using hashes here.

Supported by

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