or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

core-image-operations.mdfeature-detection.mdimage-filtering.mdindex.mdmorphological-operations.mdregistration-transforms.mdsegmentation.md
tile.json

tessl/pypi-simpleitk

Simplified interface to the Insight Toolkit for medical image analysis and processing.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/simpleitk@2.5.x

To install, run

npx @tessl/cli install tessl/pypi-simpleitk@2.5.0

index.mddocs/

SimpleITK

SimpleITK is a comprehensive image analysis toolkit that provides a simplified interface to the powerful Insight Segmentation and Registration Toolkit (ITK). This Python library offers extensive functionality for medical and scientific image processing, including filtering operations, image segmentation, and registration algorithms.

Package Information

  • Package Name: SimpleITK
  • Language: Python (with C++ backend)
  • Installation: pip install SimpleITK

Core Imports

import SimpleITK as sitk

Common for working with NumPy arrays:

import SimpleITK as sitk
import numpy as np

Basic Usage

import SimpleITK as sitk

# Read an image
image = sitk.ReadImage('input.nii.gz')

# Apply Gaussian smoothing
smoothed = sitk.SmoothingRecursiveGaussian(image, sigma=2.0)

# Write the result
sitk.WriteImage(smoothed, 'output.nii.gz')

# NumPy integration
array = sitk.GetArrayFromImage(image)
processed_array = array * 2  # Simple processing
result_image = sitk.GetImageFromArray(processed_array)
result_image.CopyInformation(image)  # Copy spacing, origin, direction

Architecture

SimpleITK provides both procedural and object-oriented interfaces:

  • Image: Core data structure representing n-dimensional images with metadata
  • Filters: Image processing algorithms with configurable parameters
  • Transforms: Geometric transformations for registration and resampling
  • Readers/Writers: I/O operations for various medical image formats
  • NumPy Integration: Seamless conversion between SimpleITK images and NumPy arrays

The toolkit supports 2D, 3D, and 4D images with various pixel types and provides language bindings for Python, R, Java, C#, Lua, TCL, and Ruby.

Capabilities

Core Image Operations

Basic image I/O, NumPy integration, and fundamental image manipulations including creation, copying, and format conversion.

def ReadImage(fileName, outputPixelType=sitkUnknown, imageIO=""): ...
def WriteImage(image, fileName, useCompression=False, compressionLevel=-1): ...
def GetArrayFromImage(image): ...
def GetImageFromArray(arr, isVector=None): ...
def GetArrayViewFromImage(image): ...

Core Image Operations

Image Filtering

Comprehensive filtering operations including smoothing, edge detection, noise reduction, mathematical operations, and morphological processing.

def SmoothingRecursiveGaussian(image, sigma=[1]*3, normalizeAcrossScale=False): ...
def DiscreteGaussian(image, variance=[1]*3, maximumKernelWidth=32): ...
def BinaryThreshold(image, lowerThreshold=0, upperThreshold=255): ...
def CannyEdgeDetection(image, lowerThreshold=0, upperThreshold=0): ...

Image Filtering

Segmentation

Advanced segmentation algorithms including threshold-based, region growing, watershed, and level set methods for extracting regions of interest.

def ConnectedThreshold(image, seedList, lower=0, upper=255): ...
def RegionGrowing(image, seedList, multiplier=2.5, numberOfIterations=5): ...
def Watershed(image, level=0, markWatershedLine=True): ...
def FastMarchingImageFilter(): ...

Segmentation

Registration and Transforms

Image registration algorithms and geometric transformations for aligning images and correcting spatial distortions.

def Resample(image, referenceImage=None, transform=Transform()): ...
class ImageRegistrationMethod: ...
class Transform: ...
class AffineTransform: ...
class BSplineTransform: ...

Registration and Transforms

Morphological Operations

Mathematical morphology operations including erosion, dilation, opening, closing, and distance transforms for shape analysis.

def BinaryErode(image, kernelRadius=[1]*3, kernelType=sitkBall): ...
def BinaryDilate(image, kernelRadius=[1]*3, kernelType=sitkBall): ...
def BinaryOpening(image, kernelRadius=[1]*3, kernelType=sitkBall): ...
def BinaryClosing(image, kernelRadius=[1]*3, kernelType=sitkBall): ...

Morphological Operations

Feature Detection

Advanced feature detection algorithms including corner detection, blob detection, and texture analysis for image analysis.

def LaplacianRecursiveGaussian(image, sigma=1.0): ...
def HessianRecursiveGaussian(image, sigma=1.0): ...
def LaplacianImageFilter(): ...
def HoughTransform(): ...

Feature Detection

Types

class Image:
    def __init__(size, pixelType, numberOfComponents=1): ...
    def GetSize(): ...
    def GetOrigin(): ...
    def GetSpacing(): ...
    def GetDirection(): ...
    def GetPixelIDValue(): ...
    def CopyInformation(sourceImage): ...

class Transform:
    def __init__(): ...
    def SetParameters(parameters): ...
    def GetParameters(): ...

class ImageFileReader:
    def SetFileName(fileName): ...
    def Execute(): ...

class ImageFileWriter:
    def SetFileName(fileName): ...
    def Execute(image): ...