Skip to content

Commit

Permalink
Valve Landmark Bundle: Update to fix changes to EnsureChannelFirstd a…
Browse files Browse the repository at this point in the history
…nd further documentation (#542)

### Description
This fixes a discovered issue with the way transforms are used and adds
a little more clarification to the documentation.

### Status
**Work in progress**

### Please ensure all the checkboxes:
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Codeformat tests passed locally by running `./runtests.sh
--codeformat`.
- [ ] In-line docstrings updated.
- [x] Update `version` and `changelog` in `metadata.json` if changing an
existing bundle.
- [x] Please ensure the naming rules in config files meet our
requirements (please refer to: `CONTRIBUTING.md`).
- [x] Ensure versions of packages such as `monai`, `pytorch` and `numpy`
are correct in `metadata.json`.
- [x] Descriptions should be consistent with the content, such as
`eval_metrics` of the provided weights and TorchScript modules.
- [x] Files larger than 25MB are excluded and replaced by providing
download links in `large_file.yml`.
- [x] Avoid using path that contains personal information within config
files (such as use `/home/your_name/` for `"bundle_root"`).

---------

Signed-off-by: Eric Kerfoot <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Yiheng Wang <[email protected]>
  • Loading branch information
3 people authored Jan 25, 2024
1 parent 5d285f1 commit 7d46af8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
9 changes: 5 additions & 4 deletions models/valve_landmarks/configs/metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20220729.json",
"version": "0.4.3",
"version": "0.5.0",
"changelog": {
"0.5.0": "Fix transform usage",
"0.4.3": "README.md fix",
"0.4.2": "add name tag",
"0.4.1": "modify dataset key name",
Expand All @@ -10,9 +11,9 @@
"0.2.0": "Unify naming",
"0.1.0": "Initial version"
},
"monai_version": "1.0.1",
"pytorch_version": "1.13.0",
"numpy_version": "1.21.2",
"monai_version": "1.3.0",
"pytorch_version": "2.1.1",
"numpy_version": "1.25.2",
"optional_packages_version": {},
"name": "Valve landmarks regression",
"task": "Given long axis MR images of the heart, identify valve insertion points through the full cardiac cycle",
Expand Down
6 changes: 4 additions & 2 deletions models/valve_landmarks/configs/train.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@
},
{
"_target_": "EnsureChannelFirstd",
"keys": "@both_keys"
"keys": "@both_keys",
"channel_dim": "no_channel"
},
{
"_target_": "RandAxisFlipd",
Expand Down Expand Up @@ -166,7 +167,8 @@
},
{
"_target_": "EnsureChannelFirstd",
"keys": "@both_keys"
"keys": "@both_keys",
"channel_dim": "no_channel"
},
{
"_target_": "Lambdad",
Expand Down
11 changes: 10 additions & 1 deletion models/valve_landmarks/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Example plot of landmarks on a single frame, see [view_results.ipynb](./view_res

The training script `train.json` is provided to train the network using a dataset of image pairs containing the MR image and a landmark image. This is done to reuse image-based transforms which do not currently operate on geometry. A number of other transforms are provided in `valve_landmarks.py` to implement Fourier-space dropout, image shifting which preserve landmarks, and smooth-field deformation applied to images and landmarks.

The dataset used for training unfortunately cannot be made public, however the training script can be used with any NPZ file containing the training image stack in key `trainImgs` and landmark image stack in `trainLMImgs`, plus `testImgs` and `testLMImgs` containing validation data. The landmark images are defined as 0 for every non-landmark pixel, with landmark pixels contaning the following values for each landmark type:
The dataset used for training unfortunately cannot be made public, however the training script can be used with any NPZ file containing the training image stack in key `trainImgs` and landmark image stack in `trainLMImgs`, plus `testImgs` and `testLMImgs` containing validation data. The landmark images are defined as 0 for every non-landmark pixel, with landmark pixels containing the following values for each landmark type:

* 10: Mitral anterior in 2CH
* 15: Mitral posterior in 2CH
Expand All @@ -39,6 +39,15 @@ The dataset used for training unfortunately cannot be made public, however the t
* 200: Tricuspid septal
* 250: Tricuspid free wall

The MR and landmark images should be 2D with no channel dimension. Within the npz file these images should be stored in single large arrays with the batch dimension first. For example, the contents of the training dataset are:

* trainImgs (8574, 256, 256)
* testImgs (930, 256, 256)
* trainLMImgs (8574, 256, 256)
* testLMImgs (930, 256, 256)

This shows a training set of 8574 image pairs and a test set of 930 image pairs. The transforms provided with the bundle assume these dimensions so your own dataset should stick to this format.

The following command will train with the default NPZ filename `./valvelandmarks.npz`, assuming the current directory is the bundle directory:

```sh
Expand Down

0 comments on commit 7d46af8

Please sign in to comment.