Add elastic image registration for 4D CT scenarios#918
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #918 +/- ##
==========================================
+ Coverage 54.96% 55.12% +0.16%
==========================================
Files 322 324 +2
Lines 20618 20795 +177
==========================================
+ Hits 11333 11464 +131
- Misses 9285 9331 +46 ☔ View full report in Codecov by Sentry. |
Test Results 3 files ± 0 3 suites ±0 33m 35s ⏱️ + 1m 23s For more details on these failures, see this check. Results for commit 5fd45c7. ± Comparison against base commit 174e756. |
wahln
left a comment
There was a problem hiding this comment.
Also a nice addition, have some comments regarding the metadata struct and naming though.
| ct | ||
| cst | ||
| refScen | ||
| metadata |
There was a problem hiding this comment.
Do you need the metadata object?
I think it should also be possible to just have the corresponding properties on the class. This makes it easier to have default values and understand which properties are necessary. E.g. you could instantiate the class and directly see the corresponding properties in the property explorer of matRad.
| @@ -0,0 +1,70 @@ | |||
| classdef (Abstract) matRad_ImageRegistration | |||
There was a problem hiding this comment.
Maybe use a class name that shows this is an Abstract class. This is not entirely consistent in the code base, which uses *Abstract and *Base, but matRad_ImageRegistrationBase would be preferable to the top-level Base class.
| function metadata = normalizeMetadata(metadata) | ||
| matRadCfg = MatRad_Config.instance(); | ||
|
|
||
| if ~isstruct(metadata) | ||
| matRadCfg.dispError('metadata must be a struct.'); | ||
| end | ||
|
|
||
| metadata = matRad_ElasticImageRegistration.setDefaultMetadataField(metadata, 'dvfType', 'pull'); | ||
| metadata = matRad_ElasticImageRegistration.setDefaultMetadataField(metadata, 'dvfUnits', 'voxel'); | ||
| metadata = matRad_ElasticImageRegistration.setDefaultMetadataField(metadata, 'numIterations', 100); | ||
| metadata = matRad_ElasticImageRegistration.setDefaultMetadataField(metadata, 'pyramidLevels', 1); | ||
| metadata = matRad_ElasticImageRegistration.setDefaultMetadataField(metadata, 'accumulatedFieldSmoothing', 1); | ||
|
|
||
| metadata.dvfType = char(metadata.dvfType); | ||
| metadata.dvfUnits = char(metadata.dvfUnits); | ||
|
|
||
| if ~any(strcmp(metadata.dvfType, {'pull', 'push'})) | ||
| matRadCfg.dispError('metadata.dvfType must be ''pull'' or ''push''.'); | ||
| end | ||
|
|
||
| if ~any(strcmp(metadata.dvfUnits, {'voxel', 'mm'})) | ||
| matRadCfg.dispError('metadata.dvfUnits must be ''voxel'' or ''mm''.'); | ||
| end | ||
|
|
||
| matRad_ElasticImageRegistration.validatePositiveInteger(metadata.numIterations, 'metadata.numIterations', matRadCfg); | ||
| matRad_ElasticImageRegistration.validatePositiveInteger(metadata.pyramidLevels, 'metadata.pyramidLevels', matRadCfg); | ||
| matRad_ElasticImageRegistration.validateNonnegativeScalar(metadata.accumulatedFieldSmoothing, ... | ||
| 'metadata.accumulatedFieldSmoothing', matRadCfg); | ||
| end |
There was a problem hiding this comment.
Probably this can be simplified if you drop the "metadata" field and just use properties on the class. Then you can use property set/get functions from Matlab to check the values.
| % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
|
|
||
| properties (Constant) | ||
| name = 'Elastic Registration' |
There was a problem hiding this comment.
Should we specify this class uses imregdemons in the name? Because someone could implement another Elastic Registration.
If you want to be extremely flexible for the future, you could have matRad_ElasticImageRegistrationAbstract as an intermediate Abstract class specifying the common properties, and then have matRad_ElasticImageRegistrationImregdemons as the final implementation.
Feature description
This PR adds elastic image registration support for 4D CT scenarios. It introduces a common image registration interface and a demons-based elastic registration implementation that computes deformation vector fields between a reference CT scenario and the remaining CT scenarios. The implementation can also use push deformation fields to propagate contours from the reference scenario.
Approach
matRad_ImageRegistrationas an abstract interface for 4D image registration classes.matRad_ElasticImageRegistration, which computes deformation vector fields using MATLAB'simregdemons.metadata.dvfType.metadata.dvfUnits.imwarp.ctstruct, including reference scenario and DVF settings.New metadata fields and defaults:
metadata.dvfType = 'pull'metadata.dvfUnits = 'voxel'metadata.numIterations = 100metadata.pyramidLevels = 1metadata.accumulatedFieldSmoothing = 1External dependencies:
imregdemons.imwarp.Open Questions and/or Concerns
References