Skip to content

learning of parameter maps for tv reconstruction #700

Open
koflera wants to merge 18 commits intomainfrom
tv_maps
Open

learning of parameter maps for tv reconstruction #700
koflera wants to merge 18 commits intomainfrom
tv_maps

Conversation

@koflera
Copy link
Copy Markdown
Collaborator

@koflera koflera commented Mar 6, 2025

we here try to include basic code for being able to run the method described in

https://arxiv.org/abs/2301.05888

using MRpro in an "advanced example" or so

@koflera koflera changed the title learning of parameter maps learning of parameter maps for tv reconstruction Mar 6, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 6, 2025

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/mrpro
   _version.py6267%7–8
src/mrpro/algorithms/csm
   inati.py25196%43
src/mrpro/algorithms/dcf
   dcf_voronoi.py55493%15, 55–56, 89
src/mrpro/algorithms/optimizers
   adam.py30680%108, 125–129
   cg.py56198%139
   pdhg.py81396%178–179, 185
   pgd.py53492%107, 152–155
src/mrpro/algorithms/reconstruction
   DirectReconstruction.py28679%62, 65, 70, 77–79
   IterativeSENSEReconstruction.py13192%79
   Reconstruction.py501374%54–56, 80–87, 109, 112
   RegularizedIterativeSENSEReconstruction.py512649%104–108, 122–161
src/mrpro/data
   AcqInfo.py171796%49, 56, 134–135, 137, 243, 367
   CsmData.py47589%17–19, 233–235
   Dataclass.py3142791%59, 320, 336, 402, 460–462, 475, 570, 590–591, 593, 608–609, 611, 645, 658–659, 664–665, 832–833, 858, 865, 870–871, 873
   DcfData.py35294%15, 62
   EncodingLimits.py97397%37, 127, 130
   IData.py52296%119, 133
   IHeader.py127794%68–71, 250, 254, 258, 262
   KData.py2282489%122–123, 138, 145, 156–167, 178, 186, 197, 236, 258–260, 304–305, 377, 543, 545, 616
   KHeader.py1781492%31, 115–121, 148, 196, 203–204, 231–238
   KNoise.py22195%44
   KTrajectory.py95397%163, 165, 185
   QData.py32197%43
   Rotation.py7644295%104, 202, 339, 437, 481, 499, 586, 588, 597, 631, 633, 696, 773, 778, 781, 796, 813, 818, 894, 1082, 1087, 1090, 1114, 1118, 1142, 1262, 1264, 1272–1273, 1337, 1419, 1623, 1630–1632, 1691, 1787, 1939, 1974, 1978, 2154, 2175
   SpatialDimension.py2402092%34, 103, 146, 152, 158, 278–280, 293–295, 329, 347, 360, 373, 386, 399, 408–409, 437
src/mrpro/data/traj_calculators
   KTrajectoryCalculator.py26292%84, 95
   KTrajectoryCartesian.py28486%107–110, 114
   KTrajectoryIsmrmrd.py19195%57
   KTrajectorySpiral2D.py571377%63–66, 69, 71, 73, 75, 77, 105, 107, 134–136
src/mrpro/operators
   AveragingOp.py34294%53, 78
   CartesianSamplingOp.py108496%143, 182, 257, 361
   ConjugateGradientOp.py911089%35–43, 62, 64, 100, 106, 211, 213, 216
   ConstraintsOp.py79495%78, 80, 211, 216
   EndomorphOperator.py32294%52, 58
   FiniteDifferenceOp.py27293%40, 105
   FourierOp.py97694%169–170, 189, 234, 272, 277
   Functional.py71494%17–18, 116, 118
   GridSamplingOp.py1631591%72–73, 82–83, 90–91, 94, 96, 98, 282, 290–291, 303, 309–310
   LinearOperator.py201797%107, 217, 255, 296, 305, 313, 330
   LinearOperatorMatrix.py1721989%82, 119, 152, 161, 166, 175–178, 191–194, 202–203, 208–209, 221, 324, 354, 381
   MultiIdentityOp.py13285%43, 48
   NonUniformFastFourierOp.py1901095%69, 96, 206, 208, 242, 244, 321, 379, 429, 434
   Operator.py89496%32, 89, 122, 132
   OptimizerOp.py65395%48–57
   PatchOp.py47394%81, 112, 127
   ProximableFunctionalSeparableSum.py64395%107, 198, 209
   SliceProjectionOp.py1781094%45, 62, 64, 70, 153, 179, 215, 236, 269, 309
   WaveletOp.py119596%151, 169, 204, 209, 232
   ZeroPadOp.py16194%30
src/mrpro/operators/functionals
   SSIM.py71790%60–80, 82, 86, 114, 147
src/mrpro/operators/models
   EPG.py2044379%85–100, 148–152, 172–175, 196–201, 264, 269, 285–287, 307–308, 313, 337, 342, 367, 372, 426, 483, 584, 611
src/mrpro/phantoms
   brainweb.py2974087%276, 290–294, 349–359, 398, 454–457, 479–480, 485–486, 488–489, 493, 501, 508–509, 550, 621, 624–625, 644, 653–656, 667, 669, 700–701, 715, 723
   fastmri.py1061091%50–51, 59, 65, 162, 169–171, 174–175, 189
   m4raw.py74495%58–59, 74, 76
   mdcnn.py71790%58, 62–63, 70, 82, 88, 135
src/mrpro/utils
   RandomGenerator.py1561590%23–24, 36, 38, 188, 212, 428, 446, 528, 799, 829–832, 895, 898
   filters.py62297%44, 49
   indexing.py182199%321
   pad_or_crop.py32681%27, 31, 62, 65, 68, 71
   reshape.py139994%112, 306, 418–420, 441, 443, 450, 465
   slice_profiles.py49688%21, 37, 119–122, 155
   split_idx.py10280%43, 47
   summarize.py57788%40–41, 70–73, 77, 81
   typing.py735623%9–236
   unit_conversion.py721678%34, 44, 51, 53, 60, 62, 69, 71, 78, 80, 89, 100, 121, 123, 144, 146
TOTAL766159292% 

Tests Skipped Failures Errors Time
2954 0 💤 0 ❌ 0 🔥 2m 1s ⏱️

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 6, 2025

📚 Documentation

📁 Download as zip
🔍 View online

@fzimmermann89 fzimmermann89 marked this pull request as draft March 7, 2025 10:30
@koflera
Copy link
Copy Markdown
Collaborator Author

koflera commented Mar 21, 2025

except that the example is probably not nice yet etc, the main problem is that while training on the GPU, the GPU memory continues to increase, eventually leading to a CUDA out of memory error.
Is it super evident where the problem lies?

@ckolbPTB ckolbPTB mentioned this pull request Apr 26, 2025
54 tasks
@koflera koflera marked this pull request as ready for review May 6, 2025 14:21
@koflera koflera requested review from ckolbPTB and fzimmermann89 May 6, 2025 14:21
@koflera
Copy link
Copy Markdown
Collaborator Author

koflera commented May 6, 2025

Finally, a first draft of the example is ready!
@fzimmermann89 I ended up undoing most of the changes that we had discussed. The most relevant were:

  • normalization by std instead of the norm: normalizing by the std had the problem that when at the end of the example, we want to compare the iterative SENSE recon to the PDHG ones, the resulting scaling factor was substantially different when normalizing by the std. normalizing by the norm was much more consistent, so I went for that.
  • initial value estimation as part of the network: given that approximately solving the normal equations only makes sense if we have multi-coil problem, I abstained from doing that and instead left that to the user to be done outside. I also think it makes the network more concise.
  • creating the dataset with a torch.utils.data.TensorDataset and using the split function, required wo write an additional Wrapper to able to use the method prepare_data of the resulting SubSets. Additionally, after a few hours of trying to stop mypy from complaining, I gave up and went back to manually creating two different datasets.

Comment thread src/mrpro/utils/RandomGenerator.py Outdated
Comment thread examples/scripts/learning_regularization_parameter_maps_for_tv_reconstruction.py Outdated
Comment thread examples/scripts/learning_regularization_parameter_maps_for_tv_reconstruction.py Outdated
Comment thread examples/scripts/learning_regularization_parameter_maps_for_tv_reconstruction.py Outdated
Comment thread examples/scripts/learning_regularization_parameter_maps_for_tv_reconstruction.py Outdated
Comment thread examples/scripts/learning_regularization_parameter_maps_for_tv_reconstruction.py Outdated
Comment thread examples/scripts/learning_regularization_parameter_maps_for_tv_reconstruction.py Outdated
Comment thread examples/scripts/learning_regularization_parameter_maps_for_tv_reconstruction.py Outdated
Comment thread examples/scripts/learning_regularization_parameter_maps_for_tv_reconstruction.py Outdated
Comment thread examples/scripts/learning_regularization_parameter_maps_for_tv_reconstruction.py Outdated
Comment thread examples/scripts/learning_regularization_parameter_maps_for_tv_reconstruction.py Outdated
Comment thread examples/scripts/learning_regularization_parameter_maps_for_tv_reconstruction.py Outdated
Comment thread examples/scripts/learning_regularization_parameter_maps_for_tv_reconstruction.py Outdated
Comment thread examples/scripts/learning_regularization_parameter_maps_for_tv_reconstruction.py Outdated
Comment thread examples/scripts/learning_regularization_parameter_maps_for_tv_reconstruction.py Outdated
Comment thread examples/scripts/learning_regularization_parameter_maps_for_tv_reconstruction.py Outdated
Comment thread examples/scripts/learning_regularization_parameter_maps_for_tv_reconstruction.py Outdated
Comment thread examples/scripts/learning_regularization_parameter_maps_for_tv_reconstruction.py Outdated
Comment thread examples/scripts/learning_regularization_parameter_maps_for_tv_reconstruction.py Outdated
Comment thread examples/scripts/learning_regularization_parameter_maps_for_tv_reconstruction.py Outdated
Comment thread examples/scripts/learning_regularization_parameter_maps_for_tv_reconstruction.py Outdated
@fzimmermann89
Copy link
Copy Markdown
Member

sorry, you did not push yet, did you? :D

@koflera
Copy link
Copy Markdown
Collaborator Author

koflera commented May 13, 2025

sorry, you did not push yet, did you? :D

no no, still waiting for the new training to finish... will probably push tomorrow in the morning ;)

@koflera koflera requested a review from fzimmermann89 May 14, 2025 13:16
Comment thread src/mrpro/data/traj_calculators/KTrajectoryCartesian.py
Comment thread examples/scripts/learning_regularization_parameter_maps_for_tv_reconstruction.py Outdated
Comment thread examples/scripts/learning_regularization_parameter_maps_for_tv_reconstruction.py Outdated
Comment thread examples/scripts/learning_regularization_parameter_maps_for_tv_reconstruction.py Outdated
Comment thread examples/scripts/learning_regularization_parameter_maps_for_tv_reconstruction.py Outdated
Comment thread examples/scripts/learning_regularization_parameter_maps_for_tv_reconstruction.py Outdated
Comment thread examples/scripts/learning_regularization_parameter_maps_for_tv_reconstruction.py Outdated
Comment thread examples/scripts/learning_regularization_parameter_maps_for_tv_reconstruction.py Outdated
@koflera koflera requested review from ckolbPTB and fzimmermann89 and removed request for ckolbPTB July 11, 2025 17:12
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.

2 participants