Skip to content

Added data importer #2

Merged
decarlof merged 20 commits intotomography:mainfrom
decarlof:main
Apr 12, 2026
Merged

Added data importer #2
decarlof merged 20 commits intotomography:mainfrom
decarlof:main

Conversation

@decarlof
Copy link
Copy Markdown
Member

to handle 3D tiff stack reconstructions

Introduces a data_importers/ directory to hold format-conversion scripts
that produce the per-slice TIFF directories expected by Noise2Inverse360.

First converter (3dtiff_converter.py) splits a single volumetric TIFF
[Z, H, W] into numbered 2D slice files (00000.tiff, ...) so reconstructions
already saved as 3D stacks can be used for training without modifying the
core data pipeline
Removes the hardcoded paths and adds positional arguments so the script
works when the user lacks write permission to the source directory.
Output defaults to input_dir when not specified
@decarlof
Copy link
Copy Markdown
Member Author

@AustinYunker please keep this open until is fully tested. I will confirm

decarlof and others added 16 commits March 18, 2026 21:43
Fixes port conflict (EADDRINUSE) when running two training jobs in
parallel on the same node. Defaults to 29500 so existing workflows
are unaffected. Documented in usage.rst and README.
Add patience: N to the train section of the config YAML (default 0 = disabled).
Training stops automatically if val loss does not improve for N consecutive
epochs after warmup completes. The counter is saved in resume.pth so --resume
preserves the early stopping state across restarts. Docs and README updated
Add patience: N to the train section of the config YAML (default 0 = disabled).
Training stops automatically if val loss does not improve for N consecutive
epochs after warmup completes. Docs and README updated
Add optional z_stride config parameter (train.z_stride, default 1) to
TomoDatasetTrain. When set to N, every Nth slice is loaded from the
odd/even sub-reconstructions, reducing RAM usage and epoch time by ~N×
while preserving full anatomical coverage. Useful for large CT datasets
where adjacent slices are highly correlated.
When z_stride > 1, fewer batches are processed per epoch, so the
warmup threshold is divided by z_stride to keep the number of warmup
model updates proportional to the effective dataset size.
Add a dedicated section explaining z_stride — what it does, when to use
it, recommended value for large CT datasets, and the automatic warmup
scaling behavior.
…odel

Load model weights from a registry directory or .pth file without
restoring training state, allowing fast adaptation to new datasets.
Document the new flag in the usage guide
@decarlof decarlof requested a review from AustinYunker March 22, 2026 02:36
denoise slice and denoise volume now accept --model-dir to load model
checkpoints from a registry entry or any directory, enabling direct
inference with registered models without copying files. Defaults to
<directory_to_reconstructions>/TrainOutput/ when omitted, preserving
existing behavior.
  Integrates the full 3D U-Net from Laugros et al. (bioRxiv 2025) into the
  denoise CLI as an explicit --mode flag. The 2.5D path is unchanged; 3D is
  opt-in via --mode 3d on prepare, train, and volume commands.

  New files:
  - denoise/model3d.py  Full 3D U-Net with skip connections (from SSD_3D)
  - denoise/data3d.py   3D TIFF dataset classes: random cubic patch training
                        with 24-rotation geometric augmentation; sliding-window
                        3D inference with Hann overlap-add stitching

  Modified files:
  - denoise/__main__.py  --mode 2.5d/3d flag on all relevant commands
  - denoise/train.py     Branches on mode: 3D uses unet3d + TomoDataset3DTrain
  - denoise/volume.py    Branches on mode: 3D uses unet3d + TomoDataset3DInfer
  - denoise/slice.py     Raises a clear error in 3D mode (use volume instead)
  - README.md            Mode comparison table, 3D examples throughout
  - docs/source/about.rst    Full explanation of both modalities and trade-offs
  - docs/source/usage.rst    --mode documented everywhere; 3D config section
  - docs/source/api.rst      model3d and data3d added to API toctree
@decarlof decarlof merged commit 85eaa18 into tomography:main Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants