From 7d46af8daf4967cb016f90c15dcef6a2897ee886 Mon Sep 17 00:00:00 2001 From: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> Date: Thu, 25 Jan 2024 03:49:17 +0000 Subject: [PATCH] Valve Landmark Bundle: Update to fix changes to EnsureChannelFirstd and 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: - [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 Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Yiheng Wang <68361391+yiheng-wang-nv@users.noreply.github.com> --- models/valve_landmarks/configs/metadata.json | 9 +++++---- models/valve_landmarks/configs/train.json | 6 ++++-- models/valve_landmarks/docs/README.md | 11 ++++++++++- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/models/valve_landmarks/configs/metadata.json b/models/valve_landmarks/configs/metadata.json index 589e1b8c..b5d12539 100644 --- a/models/valve_landmarks/configs/metadata.json +++ b/models/valve_landmarks/configs/metadata.json @@ -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", @@ -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", diff --git a/models/valve_landmarks/configs/train.json b/models/valve_landmarks/configs/train.json index 4ce3f4d8..a6ac00a6 100644 --- a/models/valve_landmarks/configs/train.json +++ b/models/valve_landmarks/configs/train.json @@ -75,7 +75,8 @@ }, { "_target_": "EnsureChannelFirstd", - "keys": "@both_keys" + "keys": "@both_keys", + "channel_dim": "no_channel" }, { "_target_": "RandAxisFlipd", @@ -166,7 +167,8 @@ }, { "_target_": "EnsureChannelFirstd", - "keys": "@both_keys" + "keys": "@both_keys", + "channel_dim": "no_channel" }, { "_target_": "Lambdad", diff --git a/models/valve_landmarks/docs/README.md b/models/valve_landmarks/docs/README.md index 7eae020f..8ab60cb8 100644 --- a/models/valve_landmarks/docs/README.md +++ b/models/valve_landmarks/docs/README.md @@ -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 @@ -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