Skip to main content

midas-nf-process-images

Differentiable PyTorch port of NF_HEDM/src/ProcessImagesCombined.c for CPU, CUDA, and MPS.

Notebooks

Worked-example Jupyter notebooks live in notebooks/. They are not shipped with pip install — get them by cloning the MIDAS repository.

Pipeline

For one layer of a near-field HEDM scan:

  1. Load NrFilesPerLayer raw TIFF frames into a [N, Z, Y] tensor.
  2. Temporal median across frames → per-pixel background [Z, Y].
  3. Per-frame:
    • Subtract median + BlanketSubtraction, clamp at 0.
    • Spatial median (3x3 or 5x5).
    • LoG response at one or more scales.
    • Threshold and label connected components → integer spot labels (detached).
    • Sigmoid surrogate → continuous spot-probability map (autograd path).
  4. Accumulate spot pixels into a bit-packed SpotsInfo.bin mmap (drop-in compatible with FitOrientationOMP / simulateNF).

Phases 1, 2, and 3 (filtered, log_response, soft spot probability) are differentiable end-to-end. Connected components and the binary SpotsInfo.bin output are computed on detached tensors and do not participate in autograd.

Quickstart

from midas_nf_process_images import ProcessParams, ProcessImagesPipeline

params = ProcessParams.from_paramfile("ps.txt")
pipe = ProcessImagesPipeline(params, device="cuda")  # or "mps", "cpu"
spots = pipe.process_layer(layer_nr=1)
spots.write("/path/to/SpotsInfo.bin")

# Or all layers in one call:
spots = pipe.process_all(layers=range(1, params.n_distances + 1))

CLI

midas-nf-process-images <ParameterFile> <LayerNr> [--device cuda] [--dtype fp32] [--n-cpus 8]

Behaves like the C ProcessImagesCombined executable.

Backend selection

Same contract as midas-transforms:

  • Default device: cuda -> mps -> cpu.
  • Default dtype: float64 on CPU, float32 on CUDA/MPS.
  • Override with device= / dtype= kwargs, or env vars MIDAS_NF_PROCESS_IMAGES_DEVICE / MIDAS_NF_PROCESS_IMAGES_DTYPE.

Differentiability

The end-to-end pipeline produces three tensors:

  • filtered: median-subtracted, spatial-median-filtered image (autograd).
  • log_response: LoG convolution output (autograd).
  • spot_prob: soft, continuous spot-probability map via sigmoid(L / temperature) (autograd).

Plus one detached output:

  • labels: integer connected-component IDs from hard-thresholded LoG (no gradient).

Optimization through the discrete spot mask uses the soft spot_prob surrogate.

Download files

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

Source Distribution

midas_nf_preprocess-0.3.0.tar.gz (69.3 kB view details)

Uploaded Source

Built Distribution

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

midas_nf_preprocess-0.3.0-py3-none-any.whl (86.1 kB view details)

Uploaded Python 3

File details

Details for the file midas_nf_preprocess-0.3.0.tar.gz.

File metadata

  • Download URL: midas_nf_preprocess-0.3.0.tar.gz
  • Upload date:
  • Size: 69.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for midas_nf_preprocess-0.3.0.tar.gz
Algorithm Hash digest
SHA256 3b12d1d078ac026b4e117f5d6599eb849de979f1b2341b6b0eb56e1c60e9d62d
MD5 d77c70db84206999f0460e2585a04725
BLAKE2b-256 f64413c86749cee2d32c5a59d9d6319a70dabd86f7fa9e9d6c018b4ff0d77e27

See more details on using hashes here.

Provenance

The following attestation bundles were made for midas_nf_preprocess-0.3.0.tar.gz:

Publisher: python-packages.yml on marinerhemant/MIDAS

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file midas_nf_preprocess-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for midas_nf_preprocess-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3d3df04cc9fda325bb6295eb0157a15aab54b57cb795be3a4d3874d38f2699ac
MD5 8a75c1b29b81c3eae2b4393a3380f5ae
BLAKE2b-256 43212f9663fbf669df554285128ab73ce06640ef236be2f5815cbb0d8d84a35d

See more details on using hashes here.

Provenance

The following attestation bundles were made for midas_nf_preprocess-0.3.0-py3-none-any.whl:

Publisher: python-packages.yml on marinerhemant/MIDAS

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.7.1

2 files

0.7.0

2 files

0.6.1

2 files

0.6.0

2 files

0.5.1

2 files

0.5.0

2 files

0.4.0

2 files

This release

0.3.0 This release

2 files

0.2.0

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

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