{ "schema_version": "medmlx.run.v1", "model": "segresnet-renal-cect", "configuration": "MONAI renalStructures_CECT_segmentation (SegResNet, 3-phase CECT)", "date": "2026-10-12", "package": { "name": "segresnet-mlx", "path": "/mlx/segresnet-mlx", "git_revision": "0503a9a3ad1c1c4f2fa0abd033b31c223763b43f", "branch": "main", "dirty": true, "remote": "https://github.com/MedMLX/segresnet-mlx.git", "patch": "work/runs/renal-numerics-20261012/segresnet-mlx-renal-fix.patch" }, "environment": { "machine": "MacBook Pro (2021), Apple M1 Max, 10-core CPU, 24-core GPU, 64 GB", "macos": "27.0.1", "python": "3.12.12", "mlx_version": "0.32.3", "device": "gpu", "dependency_versions": { "mlx": "0.32.3", "torch": "2.14.1", "monai": "1.6.0", "numpy": "2.5.3", "medmlx-core": "0.1.4", "segresnet-mlx": "0.1.2" } }, "command": { "entry_point": "segresnet_mlx.medmlx:run", "kwargs": { "bundle": "renalStructures_CECT_segmentation", "arterial_path": "/work/runs/inputs/renal-cect/prepared_denoised/arterial.nii.gz", "venous_path": "/work/runs/inputs/renal-cect/prepared_denoised/venous.nii.gz", "excretory_path": "/work/runs/inputs/renal-cect/prepared_denoised/excretory.nii.gz", "weights_path": "/work/runs/weights/segresnet-renal-cect.safetensors", "output_dir": "/work/runs/renal-numerics-20261012/mlx-final", "overwrite": false }, "invocation": "MEDMLX_RENAL_WORK=/work/runs/renal-numerics-20261012 MEDMLX_RENAL_MLX_SUBDIR=mlx-final /mlx/segresnet-mlx/.venv/bin/python /benchmarks/reference/renal_cect/mlx_probe.py", "process": "fresh Python process per model", "script_sha256": "66ba2e5a17d34beaf714de38db3be39969d216e6cca463030bbec3d6bc5c6313" }, "checkpoint": { "path": "/work/runs/weights/segresnet-renal-cect.safetensors", "sha256": "b45d0e917429f43aae433ba621099e0813550ea348f6389e4fe68f04765580ad", "source": "huggingface.co/MONAI/renalStructures_CECT_segmentation@8ccbcd9573c004dc435d1913c0459ccd1a110ed1 models/model.pt", "source_path": "/work/runs/renal-numerics-20261012/bundles/renalStructures_CECT_segmentation/models/model.pt", "source_sha256": "ef934ae5b6fdf9a19b83ab9ec28b64d63dca43aea8ef3e177724c3076170a21f", "registry_sha256_match": true, "conversion": "segresnet_mlx.convert_checkpoint(spec=BUNDLES['renalStructures_CECT_segmentation'].spec)" }, "inputs": [ { "role": "arterial_path", "path": "/work/runs/inputs/renal-cect/prepared_denoised/arterial.nii.gz", "sha256": "ce70fa42b63eb44df2d1e4906c61eca23ba80c748ee5358137452b4d5aeed6ff", "dataset": "CPTAC-CCRCC (TCIA), patient C3L-01458, CC BY 4.0", "license": "Creative Commons Attribution 4.0 International (https://creativecommons.org/licenses/by/4.0/)", "collection_doi": "https://doi.org/10.7937/k9/tcia.2018.oblamn27", "patient_id": "C3L-01458", "study_instance_uid": "1.3.6.1.4.1.14519.5.2.1.6450.3304.327311208844769188742356824359", "study_date": "2009-02-07", "series_instance_uid": "1.3.6.1.4.1.14519.5.2.1.6450.3304.276941581005689097417793544344", "series_description": "ARTERIAL", "dicom_image_count": 71, "source_url": "https://services.cancerimagingarchive.net/nbia-api/services/v1/getImage?SeriesInstanceUID=1.3.6.1.4.1.14519.5.2.1.6450.3304.276941581005689097417793544344", "source_zip_sha256": "25a0ee8cbe751c50c2cff0436f9cabab49303a4ecb570327be5d7937691eb57e", "source_dicom_dir_sha256": "3d16c3f83111a943f6a8136509d27cd71f6f95871f423023d27cd51bedcd76b7", "nifti_after_dcm2niix_sha256": "aa3992e81e4fed399db5f5896be5538b3df4a2a318b0eb45533238b1f8872184", "derivation": "dcm2niix -> registration to venous grid (arterial/excretory) -> kidney crop -> median + curvature anisotropic diffusion" }, { "role": "venous_path", "path": "/work/runs/inputs/renal-cect/prepared_denoised/venous.nii.gz", "sha256": "27673abe6398be15f0b35629e986372cae7f3128dc3e278c4939587ca72f448a", "dataset": "CPTAC-CCRCC (TCIA), patient C3L-01458, CC BY 4.0", "license": "Creative Commons Attribution 4.0 International (https://creativecommons.org/licenses/by/4.0/)", "collection_doi": "https://doi.org/10.7937/k9/tcia.2018.oblamn27", "patient_id": "C3L-01458", "study_instance_uid": "1.3.6.1.4.1.14519.5.2.1.6450.3304.327311208844769188742356824359", "study_date": "2009-02-07", "series_instance_uid": "1.3.6.1.4.1.14519.5.2.1.6450.3304.206210010421226090542971714778", "series_description": "VENOUS", "dicom_image_count": 71, "source_url": "https://services.cancerimagingarchive.net/nbia-api/services/v1/getImage?SeriesInstanceUID=1.3.6.1.4.1.14519.5.2.1.6450.3304.206210010421226090542971714778", "source_zip_sha256": "6113c77d6b2d4efeafca7fa54149063fe8b3db98cb7f04d43e5ad7ce63c5309c", "source_dicom_dir_sha256": "358b5f4c1eb08875778016cb4c15eaf51460e34422f632caa7a4d9219f29ce08", "nifti_after_dcm2niix_sha256": "acc2ec2ad6f1fef56f6def4e3a82b7d4f0b6bcaf4c4666e764fdfb28617d4330", "derivation": "dcm2niix -> registration to venous grid (arterial/excretory) -> kidney crop -> median + curvature anisotropic diffusion" }, { "role": "excretory_path", "path": "/work/runs/inputs/renal-cect/prepared_denoised/excretory.nii.gz", "sha256": "31a43dd92124042b7ac612f72ee117f87dd1755045aaa580a7a66c43a90f4c7a", "dataset": "CPTAC-CCRCC (TCIA), patient C3L-01458, CC BY 4.0", "license": "Creative Commons Attribution 4.0 International (https://creativecommons.org/licenses/by/4.0/)", "collection_doi": "https://doi.org/10.7937/k9/tcia.2018.oblamn27", "patient_id": "C3L-01458", "study_instance_uid": "1.3.6.1.4.1.14519.5.2.1.6450.3304.327311208844769188742356824359", "study_date": "2009-02-07", "series_instance_uid": "1.3.6.1.4.1.14519.5.2.1.6450.3304.187333619377884523543352490654", "series_description": "4 MIN DELAY", "dicom_image_count": 180, "source_url": "https://services.cancerimagingarchive.net/nbia-api/services/v1/getImage?SeriesInstanceUID=1.3.6.1.4.1.14519.5.2.1.6450.3304.187333619377884523543352490654", "source_zip_sha256": "65d76ee2f4815cf19d955d1d24b1fca36e8ab3c9b79bc415783ff6719b0c44d7", "source_dicom_dir_sha256": "8bb1256f43b42ed2b52636774c52ee6462ae7c3b4e8817d179a4274e8155f114", "nifti_after_dcm2niix_sha256": "2a6352aad8250e227b85a44d5713f5e75253135b97bbfda37896e033b0419410", "derivation": "dcm2niix -> registration to venous grid (arterial/excretory) -> kidney crop -> median + curvature anisotropic diffusion" } ], "outputs": { "mask": { "path": "/work/runs/renal-numerics-20261012/mlx-final/renalStructures_CECT_segmentation_mask.nii.gz", "sha256": "fa6de5a6a23f0216a1ca477ee75222e9599058753ec029e64a6afebca9cb3314", "dtype": "float32", "shape": [ 380, 220, 71 ], "affine_max_abs_diff": 0.0, "label_voxel_counts": { "0": 5412229, "1": 84553, "2": 32851, "3": 23363, "4": 276280, "5": 106324 }, "volume_mL": { "1": 104.50428771972656, "2": 40.60258483886719, "3": 28.875778198242188, "4": 341.4715576171875, "5": 131.41241455078125 }, "checks": { "mask_reopens": true, "finite_integer_labels": true, "shape_matches_input": true, "affine_matches_input": true, "allowed_labels_only": true, "foreground_nonempty": true } }, "details": { "bundle": "renalStructures_CECT_segmentation", "labels": { "0": "background", "1": "artery", "2": "vein", "3": "ureter", "4": "neoplasm", "5": "parenchyma" }, "labels_present": [ 0, 1, 2, 3, 4, 5 ], "input_shape": [ 380, 220, 71 ], "network_input_shape": [ 334, 193, 220 ], "output_dtype": "float32", "sliding_window": { "roi_size": [ 96, 96, 96 ], "sw_batch_size": 4, "overlap": 0.25 }, "weights_sha256": "b45d0e917429f43aae433ba621099e0813550ea348f6389e4fe68f04765580ad", "mlx_device": "Device(gpu, 0)", "peak_mlx_bytes": 4140949628, "seconds": { "load_inputs_and_weights": 0.4349, "preprocess": 1.9682, "inference": 12.5464, "postprocess_and_write": 1.9927 }, "requires_human_review": true } }, "checks": [ { "name": "mask_reopens", "result": "pass", "detail": { "dtype": "float32", "shape": [ 380, 220, 71 ] } }, { "name": "finite_integer_labels", "result": "pass", "detail": null }, { "name": "shape_matches_input", "result": "pass", "detail": { "input": [ 380, 220, 71 ], "mask": [ 380, 220, 71 ] } }, { "name": "affine_matches_input", "result": "pass", "detail": { "max_abs_diff": 0.0 } }, { "name": "labels_in_expected_set", "result": "pass", "detail": { "observed": [ 0, 1, 2, 3, 4, 5 ], "allowed": [ 0, 1, 2, 3, 4, 5 ] } }, { "name": "foreground_nonempty", "result": "pass", "detail": { "foreground_voxels": 523371 } }, { "name": "source_exported_mask_comparison_completed", "result": "pass", "detail": { "mismatched_voxels": 0, "total_voxels": 5935600, "voxel_agreement": 1.0, "scope": "Independent MONAI full pipeline; no anatomical-accuracy claim." } }, { "name": "released_checkpoint_sparse_raw_logit_qualification", "result": "pass", "detail": { "authority": "segresnet-mlx tests/test_torch_oracles.py:_RAW_LOGIT_RTOL/_RAW_LOGIT_ATOL", "rtol": 0.0001, "atol": 0.0001, "result": "Four dense/sparse cases over seeds 23/47 pass unchanged criteria." } }, { "name": "full_case_raw_logit_qualification", "result": "pass", "detail": { "shape": [ 1, 6, 334, 193, 220 ], "elements": 85089840, "dtype": "float32", "rtol": 0.0001, "atol": 0.0001, "finite": true, "max_abs": 0.0, "failing_elements": 0, "sign_mismatches": 0, "differing_elements": 0, "array_equal": true, "allclose": true, "normalized_l2": 0.0 } } ], "duration_s": 16.991902624984505, "timing_boundary": "wall clock around the single run() call: weight loading, preprocessing, MLX inference and export; interpreter start-up and package import excluded; one run, no warmup", "mlx_peak_gb": 4.140949628, "memory_definition": "mx.get_peak_memory() after mx.reset_peak_memory() immediately before run(); decimal GB", "panel": "paper/figures/runs/segresnet-renal-cect.png", "status": "success", "failure_cause": null, "notes": "Source-order FP32 convolution and GroupNorm resolve the retained numerical discrepancy. All 85,089,840 full-case logits and 5,935,600 mask voxels match the fresh independent MONAI CPU pipeline exactly. Anatomical accuracy remains unverified; preparation and the source model's predictions are unchanged. Historical failed records are preserved.", "execution_status": "completed", "qualification_status": "passed_released_checkpoint_and_retained_case_raw_logits", "key_check": "raw logits: 0/85,089,840 differing elements; mask: 0/5,935,600 differing voxels; unchanged rtol=atol=1e-4 and exact sign agreement pass", "preparation": { "patient_selection_rule": "Fixed before any model output: scan collections in the order C4KC-KiTS, TCGA-KIRC, TCGA-KIRP, CPTAC-CCRCC (TCIA getSeries, Modality=CT), patients in sorted ID order; take the first patient with one study holding separate axial arterial, venous/portal and delayed/excretory series (by SeriesDescription).", "search_result": "C4KC-KiTS: studies are noncontrast/arterial/'late' only (no separate venous and delayed). TCGA-KIRC/TCGA-KIRP: at most arterial + nephrographic/'Delay Nephro' (two contrast phases) per study. CPTAC-CCRCC: first match in sorted order = C3L-01458 (ARTERIAL, VENOUS, 4 MIN DELAY, plus UNENHANCED). TCGA-KICH also had one 3-phase case (TCGA-KM-8441) but was not in the rule.", "conversion": "dcm2niix v1.0.20260724 (-z y), HU preserved (int16)", "registration": "SimpleITK 2.5.6; fixed = venous (unchanged); moving = arterial, delayed. Euler3D rigid then affine, Mattes MI (50 bins, 20% random sampling, seed 1, body mask), 3-level pyramid, registration images clamped to [-200, 400] HU; transform = best full-sampling MI of identity/rigid/affine (arterial: affine; delayed: rigid); linear resampling onto the venous grid, -1024 HU outside.", "registration_report": { "fixed": "venous", "metric": "Mattes MI (50 bins, 20% random sampling, seed 1, fixed body mask HU>-300); NCC on body mask, HU clipped to [-200,400]", "registrations": [ { "moving": "arterial", "ncc_identity": 0.8082911835308257, "rigid_stop": "RegularStepGradientDescentOptimizerv4: Step too small after 31 iterations. Current step (0.000797923) is less than minimum step (0.001).", "affine_stop": "RegularStepGradientDescentOptimizerv4: Step too small after 23 iterations. Current step (0.000814207) is less than minimum step (0.001).", "mi_metric_full": { "identity": -0.644816794828831, "rigid": -0.6912422330256605, "affine": -0.7051755570784678 }, "selected": "affine", "selection_rule": "lowest full-sampling Mattes MI metric over identity/rigid/affine", "rigid_params_euler_rad_then_mm": [ 0.0056508383764504976, 0.002343669555555565, -0.0011454668240039366, -0.2570590771572359, -0.3774074675497483, -0.8838321401458896 ], "rigid_center_mm": [ 8.748443603515625, -0.3515625, -217.5, 0.0 ], "affine_matrix": [ 0.996809179646179, 0.003656404071089731, -0.00044015364500102664, -0.0003091213578136837, 1.0043418715160786, -0.0031618346520931413, -0.005001929707088511, 0.005074753488242583, 0.9840177451335207 ], "affine_translation_mm": [ -0.32442920771278827, -0.5139241483157303, -0.9535384254277904 ], "affine_center_mm": [ 8.748443603515625, -0.3515625, -217.5 ], "ncc_selected": 0.8294820231833323, "mask_voxels": 9415516, "output": "arterial" }, { "moving": "delay", "ncc_identity": 0.8346221831405791, "rigid_stop": "RegularStepGradientDescentOptimizerv4: Step too small after 23 iterations. Current step (0.000797923) is less than minimum step (0.001).", "affine_stop": "RegularStepGradientDescentOptimizerv4: Step too small after 24 iterations. Current step (0.000814207) is less than minimum step (0.001).", "mi_metric_full": { "identity": -0.7436560751665575, "rigid": -0.7640989222838821, "affine": -0.7447032018198703 }, "selected": "rigid", "selection_rule": "lowest full-sampling Mattes MI metric over identity/rigid/affine", "rigid_params_euler_rad_then_mm": [ -0.0014328554927025279, -0.0016714343257006612, -0.0006300420690045122, -0.07712311013748022, -0.14258548962052492, -0.47614984858695375 ], "rigid_center_mm": [ 8.748443603515625, -0.3515625, -217.5, 0.0 ], "affine_matrix": [ 1.0058799569246073, 0.0008686112874522285, -0.002171033943256529, -0.0008263557448896974, 1.008134318165822, 0.004771381120059627, 0.0017248076262913919, -0.0046946122732977975, 1.005512891291459 ], "affine_translation_mm": [ -0.0945802475750815, -0.37995403277841416, -0.2653121855141817 ], "affine_center_mm": [ 8.748443603515625, -0.3515625, -217.5 ], "ncc_selected": 0.8379312376325521, "mask_voxels": 9415516, "output": "excretory" } ] }, "kidney_crop": "x 70:450, y 110:330, all 71 slices of the 512x512x71 venous grid -> 380x220x71 at 0.703x0.703x2.5 mm (bundle README preprocessing step 1; chosen by eye on the venous phase)", "denoise": "median radius 1 then CurvatureAnisotropicDiffusion (time step 0.04, conductance 3, 5 iterations); a substitute for the bundle's median + non-local-means (SimpleITK PatchBasedDenoising did not finish in >10 min)", "package_preprocessing": "inside run(): reorient to LPS, resample to 0.8 mm, clip/scale [-1000,1000] HU to [0,1]; channel order arterial, venous, excretory", "scripts": [ "work/runs/_harness/prep_renal_cect.py", "work/runs/_harness/prep_renal_cect_crop.py", "work/runs/_harness/prep_renal_cect_denoise.py" ] }, "prior_attempts": [ { "schema_version": "medmlx.run.v1", "model": "segresnet-renal-cect", "configuration": "MONAI renalStructures_CECT_segmentation (SegResNet, 3-phase CECT)", "date": "2026-10-09", "package": { "name": "segresnet-mlx", "path": "/segresnet-mlx", "git_revision": "40cbce54523632fbc8cdfc564a9cce48d8df3424", "branch": "main", "dirty": false, "remote": "https://github.com/MedMLX/segresnet-mlx.git" }, "environment": { "machine": "MacBook Pro (2021), Apple M1 Max, 10-core CPU, 24-core GPU, 64 GB", "macos": "27.0", "python": "3.12.12", "mlx_version": "0.32.3", "device": "gpu" }, "command": { "entry_point": "segresnet_mlx.medmlx:run", "kwargs": { "bundle": "renalStructures_CECT_segmentation", "arterial_path": "/work/runs/inputs/renal-cect/prepared_denoised/arterial.nii.gz", "venous_path": "/work/runs/inputs/renal-cect/prepared_denoised/venous.nii.gz", "excretory_path": "/work/runs/inputs/renal-cect/prepared_denoised/excretory.nii.gz", "weights_path": "/work/runs/weights/segresnet-renal-cect.safetensors", "output_dir": "/work/runs/segresnet-renal-cect", "overwrite": true }, "invocation": "cd /segresnet-mlx && .venv/bin/python /work/runs/_harness/run_one.py segresnet_mlx.medmlx ", "process": "fresh Python process per model" }, "checkpoint": { "path": "/work/runs/weights/segresnet-renal-cect.safetensors", "sha256": "b45d0e917429f43aae433ba621099e0813550ea348f6389e4fe68f04765580ad", "source": "huggingface.co/MONAI/renalStructures_CECT_segmentation@8ccbcd95 models/model.pt (radnn checkpoints copy; registry sha matches)", "source_path": "/radnn/checkpoints/monai/model-zoo/renalStructures_CECT_segmentation/models/model.pt", "source_sha256": "ef934ae5b6fdf9a19b83ab9ec28b64d63dca43aea8ef3e177724c3076170a21f", "registry_sha256_match": true, "conversion": "segresnet_mlx.convert_checkpoint(spec=BUNDLES['renalStructures_CECT_segmentation'].spec)" }, "inputs": [ { "role": "arterial_path", "path": "/work/runs/inputs/renal-cect/prepared_denoised/arterial.nii.gz", "sha256": "ce70fa42b63eb44df2d1e4906c61eca23ba80c748ee5358137452b4d5aeed6ff", "dataset": "CPTAC-CCRCC (TCIA), patient C3L-01458, CC BY 4.0", "license": "Creative Commons Attribution 4.0 International (https://creativecommons.org/licenses/by/4.0/)", "collection_doi": "https://doi.org/10.7937/k9/tcia.2018.oblamn27", "patient_id": "C3L-01458", "study_instance_uid": "1.3.6.1.4.1.14519.5.2.1.6450.3304.327311208844769188742356824359", "study_date": "2009-02-07", "series_instance_uid": "1.3.6.1.4.1.14519.5.2.1.6450.3304.276941581005689097417793544344", "series_description": "ARTERIAL", "dicom_image_count": 71, "source_url": "https://services.cancerimagingarchive.net/nbia-api/services/v1/getImage?SeriesInstanceUID=1.3.6.1.4.1.14519.5.2.1.6450.3304.276941581005689097417793544344", "source_zip_sha256": "25a0ee8cbe751c50c2cff0436f9cabab49303a4ecb570327be5d7937691eb57e", "source_dicom_dir_sha256": "3d16c3f83111a943f6a8136509d27cd71f6f95871f423023d27cd51bedcd76b7", "nifti_after_dcm2niix_sha256": "aa3992e81e4fed399db5f5896be5538b3df4a2a318b0eb45533238b1f8872184", "derivation": "dcm2niix -> registration to venous grid (arterial/excretory) -> kidney crop -> median + curvature anisotropic diffusion" }, { "role": "venous_path", "path": "/work/runs/inputs/renal-cect/prepared_denoised/venous.nii.gz", "sha256": "27673abe6398be15f0b35629e986372cae7f3128dc3e278c4939587ca72f448a", "dataset": "CPTAC-CCRCC (TCIA), patient C3L-01458, CC BY 4.0", "license": "Creative Commons Attribution 4.0 International (https://creativecommons.org/licenses/by/4.0/)", "collection_doi": "https://doi.org/10.7937/k9/tcia.2018.oblamn27", "patient_id": "C3L-01458", "study_instance_uid": "1.3.6.1.4.1.14519.5.2.1.6450.3304.327311208844769188742356824359", "study_date": "2009-02-07", "series_instance_uid": "1.3.6.1.4.1.14519.5.2.1.6450.3304.206210010421226090542971714778", "series_description": "VENOUS", "dicom_image_count": 71, "source_url": "https://services.cancerimagingarchive.net/nbia-api/services/v1/getImage?SeriesInstanceUID=1.3.6.1.4.1.14519.5.2.1.6450.3304.206210010421226090542971714778", "source_zip_sha256": "6113c77d6b2d4efeafca7fa54149063fe8b3db98cb7f04d43e5ad7ce63c5309c", "source_dicom_dir_sha256": "358b5f4c1eb08875778016cb4c15eaf51460e34422f632caa7a4d9219f29ce08", "nifti_after_dcm2niix_sha256": "acc2ec2ad6f1fef56f6def4e3a82b7d4f0b6bcaf4c4666e764fdfb28617d4330", "derivation": "dcm2niix -> registration to venous grid (arterial/excretory) -> kidney crop -> median + curvature anisotropic diffusion" }, { "role": "excretory_path", "path": "/work/runs/inputs/renal-cect/prepared_denoised/excretory.nii.gz", "sha256": "31a43dd92124042b7ac612f72ee117f87dd1755045aaa580a7a66c43a90f4c7a", "dataset": "CPTAC-CCRCC (TCIA), patient C3L-01458, CC BY 4.0", "license": "Creative Commons Attribution 4.0 International (https://creativecommons.org/licenses/by/4.0/)", "collection_doi": "https://doi.org/10.7937/k9/tcia.2018.oblamn27", "patient_id": "C3L-01458", "study_instance_uid": "1.3.6.1.4.1.14519.5.2.1.6450.3304.327311208844769188742356824359", "study_date": "2009-02-07", "series_instance_uid": "1.3.6.1.4.1.14519.5.2.1.6450.3304.187333619377884523543352490654", "series_description": "4 MIN DELAY", "dicom_image_count": 180, "source_url": "https://services.cancerimagingarchive.net/nbia-api/services/v1/getImage?SeriesInstanceUID=1.3.6.1.4.1.14519.5.2.1.6450.3304.187333619377884523543352490654", "source_zip_sha256": "65d76ee2f4815cf19d955d1d24b1fca36e8ab3c9b79bc415783ff6719b0c44d7", "source_dicom_dir_sha256": "8bb1256f43b42ed2b52636774c52ee6462ae7c3b4e8817d179a4274e8155f114", "nifti_after_dcm2niix_sha256": "2a6352aad8250e227b85a44d5713f5e75253135b97bbfda37896e033b0419410", "derivation": "dcm2niix -> registration to venous grid (arterial/excretory) -> kidney crop -> median + curvature anisotropic diffusion" } ], "outputs": { "mask": { "path": "/work/runs/segresnet-renal-cect/renalStructures_CECT_segmentation_mask.nii.gz", "sha256": "eb06d7f179074a1172756993b855d5d9a7ae88e4d51addebaf2e1b5f52813821", "label_voxel_counts": { "0": 5563122, "1": 17709, "2": 4320, "3": 56070, "4": 5609, "5": 288770 }, "volume_mL": { "artery": 21.9, "vein": 5.3, "ureter": 69.3, "neoplasm": 6.9, "parenchyma": 356.9 }, "fraction_in_kidney_boxes": { "artery": 0.146, "vein": 0.602, "ureter": 0.398, "neoplasm": 0.421, "parenchyma": 0.431 } }, "details": { "labels_present": [ 0, 1, 2, 3, 4, 5 ], "input_shape": [ 380, 220, 71 ], "network_input_shape": [ 334, 193, 220 ], "sliding_window": { "roi_size": [ 96, 96, 96 ], "sw_batch_size": 4, "overlap": 0.25 }, "seconds": { "load_inputs_and_weights": 0.9165, "preprocess": 2.0619, "inference": 15.7734, "postprocess_and_write": 1.9687 } } }, "checks": [ { "name": "mask_reopens", "result": "pass", "detail": { "dtype": "float32", "shape": [ 380, 220, 71 ] } }, { "name": "finite_integer_labels", "result": "pass", "detail": null }, { "name": "shape_matches_input", "result": "pass", "detail": { "input": [ 380, 220, 71 ], "mask": [ 380, 220, 71 ] } }, { "name": "affine_matches_input", "result": "pass", "detail": { "max_abs_diff": 0.0 } }, { "name": "labels_in_expected_set", "result": "pass", "detail": { "observed": [ 0, 1, 2, 3, 4, 5 ], "allowed": [ 0, 1, 2, 3, 4, 5 ] } }, { "name": "foreground_nonempty", "result": "pass", "detail": { "foreground_voxels": 372478 } }, { "name": "grid_matches_reference_phase_venous", "result": "pass", "detail": { "venous_shape": [ 380, 220, 71 ], "mask_shape": [ 380, 220, 71 ], "affine_max_abs_diff": 0.0 } }, { "name": "renal_labels_in_kidneys", "result": "fail", "detail": { "criterion": "at least 80% of parenchyma (label 5) voxels inside two hand-placed kidney boxes (x 20-160 and 210-360, y 55-170, z 0-62 of the 380x220x71 input grid)", "fraction_in_kidney_boxes": { "artery": 0.146, "vein": 0.602, "ureter": 0.398, "neoplasm": 0.421, "parenchyma": 0.431 }, "volume_mL": { "artery": 21.9, "vein": 5.3, "ureter": 69.3, "neoplasm": 6.9, "parenchyma": 356.9 }, "observation": "parenchyma/ureter/vessel labels are scattered over liver, spleen, muscle, bowel and vertebral bone; kidneys are only partly covered" } } ], "duration_s": 20.77, "timing_boundary": "wall clock around the single run() call: weight loading, preprocessing, MLX inference and export; interpreter start-up and package import excluded; one run, no warmup", "mlx_peak_gb": 5.756, "memory_definition": "mx.get_peak_memory() after mx.reset_peak_memory() immediately before run(); decimal GB", "panel": "paper/figures/runs/segresnet-renal-cect-before-fix.png", "status": "failure", "failure_cause": "output check failed: renal_labels_in_kidneys", "notes": "Run completes and writes a valid on-grid mask, but the labels are not a usable renal segmentation. Preprocessing: see extra.preparation. Package warning: transforms.py:296 RuntimeWarning overflow in exp in sigmoid (harmless: saturates to 0). Attempts on the same patient are in extra.attempts; the recorded run is the last. Not clinical.", "preparation": { "patient_selection_rule": "Fixed before any model output: scan collections in the order C4KC-KiTS, TCGA-KIRC, TCGA-KIRP, CPTAC-CCRCC (TCIA getSeries, Modality=CT), patients in sorted ID order; take the first patient with one study holding separate axial arterial, venous/portal and delayed/excretory series (by SeriesDescription).", "search_result": "C4KC-KiTS: studies are noncontrast/arterial/'late' only (no separate venous and delayed). TCGA-KIRC/TCGA-KIRP: at most arterial + nephrographic/'Delay Nephro' (two contrast phases) per study. CPTAC-CCRCC: first match in sorted order = C3L-01458 (ARTERIAL, VENOUS, 4 MIN DELAY, plus UNENHANCED). TCGA-KICH also had one 3-phase case (TCGA-KM-8441) but was not in the rule.", "conversion": "dcm2niix v1.0.20260724 (-z y), HU preserved (int16)", "registration": "SimpleITK 2.5.6; fixed = venous (unchanged); moving = arterial, delayed. Euler3D rigid then affine, Mattes MI (50 bins, 20% random sampling, seed 1, body mask), 3-level pyramid, registration images clamped to [-200, 400] HU; transform = best full-sampling MI of identity/rigid/affine (arterial: affine; delayed: rigid); linear resampling onto the venous grid, -1024 HU outside.", "registration_report": { "fixed": "venous", "metric": "Mattes MI (50 bins, 20% random sampling, seed 1, fixed body mask HU>-300); NCC on body mask, HU clipped to [-200,400]", "registrations": [ { "moving": "arterial", "ncc_identity": 0.8082911835308257, "rigid_stop": "RegularStepGradientDescentOptimizerv4: Step too small after 31 iterations. Current step (0.000797923) is less than minimum step (0.001).", "affine_stop": "RegularStepGradientDescentOptimizerv4: Step too small after 23 iterations. Current step (0.000814207) is less than minimum step (0.001).", "mi_metric_full": { "identity": -0.644816794828831, "rigid": -0.6912422330256605, "affine": -0.7051755570784678 }, "selected": "affine", "selection_rule": "lowest full-sampling Mattes MI metric over identity/rigid/affine", "rigid_params_euler_rad_then_mm": [ 0.0056508383764504976, 0.002343669555555565, -0.0011454668240039366, -0.2570590771572359, -0.3774074675497483, -0.8838321401458896 ], "rigid_center_mm": [ 8.748443603515625, -0.3515625, -217.5, 0.0 ], "affine_matrix": [ 0.996809179646179, 0.003656404071089731, -0.00044015364500102664, -0.0003091213578136837, 1.0043418715160786, -0.0031618346520931413, -0.005001929707088511, 0.005074753488242583, 0.9840177451335207 ], "affine_translation_mm": [ -0.32442920771278827, -0.5139241483157303, -0.9535384254277904 ], "affine_center_mm": [ 8.748443603515625, -0.3515625, -217.5 ], "ncc_selected": 0.8294820231833323, "mask_voxels": 9415516, "output": "arterial" }, { "moving": "delay", "ncc_identity": 0.8346221831405791, "rigid_stop": "RegularStepGradientDescentOptimizerv4: Step too small after 23 iterations. Current step (0.000797923) is less than minimum step (0.001).", "affine_stop": "RegularStepGradientDescentOptimizerv4: Step too small after 24 iterations. Current step (0.000814207) is less than minimum step (0.001).", "mi_metric_full": { "identity": -0.7436560751665575, "rigid": -0.7640989222838821, "affine": -0.7447032018198703 }, "selected": "rigid", "selection_rule": "lowest full-sampling Mattes MI metric over identity/rigid/affine", "rigid_params_euler_rad_then_mm": [ -0.0014328554927025279, -0.0016714343257006612, -0.0006300420690045122, -0.07712311013748022, -0.14258548962052492, -0.47614984858695375 ], "rigid_center_mm": [ 8.748443603515625, -0.3515625, -217.5, 0.0 ], "affine_matrix": [ 1.0058799569246073, 0.0008686112874522285, -0.002171033943256529, -0.0008263557448896974, 1.008134318165822, 0.004771381120059627, 0.0017248076262913919, -0.0046946122732977975, 1.005512891291459 ], "affine_translation_mm": [ -0.0945802475750815, -0.37995403277841416, -0.2653121855141817 ], "affine_center_mm": [ 8.748443603515625, -0.3515625, -217.5 ], "ncc_selected": 0.8379312376325521, "mask_voxels": 9415516, "output": "excretory" } ] }, "kidney_crop": "x 70:450, y 110:330, all 71 slices of the 512x512x71 venous grid -> 380x220x71 at 0.703x0.703x2.5 mm (bundle README preprocessing step 1; chosen by eye on the venous phase)", "denoise": "median radius 1 then CurvatureAnisotropicDiffusion (time step 0.04, conductance 3, 5 iterations); a substitute for the bundle's median + non-local-means (SimpleITK PatchBasedDenoising did not finish in >10 min)", "package_preprocessing": "inside run(): reorient to LPS, resample to 0.8 mm, clip/scale [-1000,1000] HU to [0,1]; channel order arterial, venous, excretory", "scripts": [ "work/runs/_harness/prep_renal_cect.py", "work/runs/_harness/prep_renal_cect_crop.py", "work/runs/_harness/prep_renal_cect_denoise.py" ] }, "attempts": [ { "name": "full FOV (registered, no crop/denoise)", "duration_s": 79.8, "mlx_peak_gb": 5.756, "parenchyma_voxels": 1122691, "note": "labels scattered over the whole abdomen (10,047 parenchyma components)" }, { "name": "kidney crop, no denoise", "duration_s": 17.7, "mlx_peak_gb": 5.756, "parenchyma_voxels": 614193, "parenchyma_fraction_in_kidney_boxes": 0.457 }, { "name": "kidney crop + denoise (recorded run)", "duration_s": 20.77, "mlx_peak_gb": 5.756, "parenchyma_voxels": 288770, "parenchyma_fraction_in_kidney_boxes": 0.431 } ], "mlx_vs_torch_diagnostic": { "description": "Torch/MONAI SegResNet 1.6.0 (CPU, float32 and float64) vs segresnet_mlx.forward_patch on the same 96^3 patch from the recorded run's preprocessed input, same checkpoint (safetensors verified byte-identical to model.pt tensors)", "script": "work/runs/_harness/diagnostics/renal_cect_torch_vs_mlx_patch.py", "result": "torch float32 vs float64 relative L2 7.7e-7 (the network is numerically stable) but MLX vs torch relative L2 0.638, correlation 0.52; logits are large (|ref| mean 52) in both. Stage-by-stage (renal_cect_torch_vs_mlx_bisect.py): convInit, all down stages, up_samples.*.0 and the transposed convolution match torch to ~1e-6; the unforced MLX graph then diverges from the first up-path residual block on, although running that block alone on the torch input matches (4e-7). Forcing mx.eval after individual ops/blocks changes the result (0.14, 0.04, 9e-7 or 0.45 depending on which ops were forced and on prior allocations in the process), so the divergence depends on evaluation order/buffer reuse. Not isolated further; looks like an MLX 0.32.3 or medmlx-core op bug (stale/aliased buffer), not a preprocessing issue. The package's recorded qualification is synthetic-weight only." }, "key_check": "run completes; mask on input grid; labels 0-5; parenchyma only 43% inside kidney boxes (fails); MLX vs MONAI torch logits disagree on the same patch (rel L2 0.64)", "figure_use": "Do not use as a segmentation exemplar; usable only as an illustration of the three-phase input contract and of the failed parity check." } ], "repair": { "validated_package": { "name": "medmlx-core", "path": "/Documents/Codex/2026-10-09/new-chat/work/renal-core-typed-validation", "git_revision": "d8f4c05248fc27200e3ee9a3c7ba326d7d60b3a8", "branch": "codex/renal-deconv-typed-fix", "dirty": false, "remote": "https://github.com/MedMLX/medmlx-core.git" }, "executed_sources": { "medmlx-core": { "path": "/Documents/Codex/2026-10-09/new-chat/work/renal-core", "revision": "8d690574cdecc7fa1813680fae3e3fe8c934aa37", "branch": "codex/renal-deconv-fix", "status": "M src/medmlx_core/ops.py\n?? docs/\n?? scripts/reproduce_transpose_consumer.py\n?? tests/test_transpose_convolution.py", "diff_sha256": "b9276d78bbca6abc2967b05068aa1c984f9a0b526ed257fa01396af4b64fadb3" }, "segresnet-mlx": { "path": "/Documents/Codex/2026-10-09/new-chat/work/renal-segresnet", "revision": "40cbce54523632fbc8cdfc564a9cce48d8df3424", "branch": "codex/renal-kernel-fix", "status": "", "diff_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" } }, "typed_branch_operator_body_matches_executed_patch": true, "production_lines_added": 11, "checks": { "core_suite": "220 passed", "segresnet_suite": "99 passed, 2 optional checkpoint tests skipped", "enabled_checkpoint_suite": "1 passed, sparse case failed", "mlx_generate_consumer_suite": "223 passed", "ruff": "passed", "strict_typecheck": "passed" } }, "real_patch_comparison": { "convolution": "ordered", "normalization": "ordered", "reference": "/work/runs/renal-numerics-20261012/patch-reference.npz", "weights": "/work/runs/weights/segresnet-renal-cect.safetensors", "shape": [ 1, 3, 96, 96, 96 ], "dtype": "float32", "seconds": 0.28180804097792134, "peak_mlx_bytes": 1629269512, "finite": true, "max_abs": 0.0, "mean_abs": 0.0, "normalized_l2": 0.0, "rtol": 0.0001, "atol": 0.0001, "failing_elements": 0, "sign_mismatches": 0, "elements": 5308416, "array_equal": true, "versions": { "mlx": "0.32.3", "numpy": "2.5.3", "medmlx-core": "0.1.4", "segresnet-mlx": "0.1.2" }, "timing_limit": "Single diagnostic run; compile/cache state is uncontrolled." }, "source_full_mask_comparison": { "receipt": "results/renal-numerics-20261012.json", "mismatched_voxels": 0, "total_voxels": 5935600, "foreground": [ { "label": 1, "name": "artery", "actual_voxels": 84553, "reference_voxels": 84553, "intersection_voxels": 84553, "dice": 1.0, "actual_only_voxels": 0, "reference_only_voxels": 0 }, { "label": 2, "name": "vein", "actual_voxels": 32851, "reference_voxels": 32851, "intersection_voxels": 32851, "dice": 1.0, "actual_only_voxels": 0, "reference_only_voxels": 0 }, { "label": 3, "name": "ureter", "actual_voxels": 23363, "reference_voxels": 23363, "intersection_voxels": 23363, "dice": 1.0, "actual_only_voxels": 0, "reference_only_voxels": 0 }, { "label": 4, "name": "neoplasm", "actual_voxels": 276280, "reference_voxels": 276280, "intersection_voxels": 276280, "dice": 1.0, "actual_only_voxels": 0, "reference_only_voxels": 0 }, { "label": 5, "name": "parenchyma", "actual_voxels": 106324, "reference_voxels": 106324, "intersection_voxels": 106324, "dice": 1.0, "actual_only_voxels": 0, "reference_only_voxels": 0 } ], "scope": "Fresh independently parsed original MONAI full pipeline; prediction agreement is not anatomical accuracy." }, "figure_use": "Diagnostic illustration of input phases and source agreement; not a clinically valid segmentation exemplar.", "numerical_qualification_record": "results/renal-numerics-20261012.json", "prior_attempt_records": [ "results/runs/history/segresnet-renal-cect-before-20261012-fix.json" ] }