|
Medical Imaging Interaction Toolkit
2026.06.00
Medical Imaging Interaction Toolkit
|
Test fixture base class for model fit unit tests. More...
#include <mitkModelTestFixture.h>


Static Public Member Functions | |
| static json | ParseJSONFile (const std::string path) |
| Parse a JSON file from the test data directory. More... | |
| static ModelBase::ParametersType | ParseTestParameters (const json modelValues_json_obj) |
| Extract model parameter values from a JSON object into a ParametersType array. More... | |
| static ModelBase::StaticParameterMapType | ParseStaticParameters (const json profile_json_obj, const json modelValues_json_obj) |
| Parse static parameter names and values from JSON into a StaticParameterMapType. More... | |
| static void | SetStaticParametersForTest (mitk::ModelBase::Pointer testmodel, const json profile_json_obj, const json modelValues_json_obj) |
| Convenience method that parses static parameters from JSON and applies them to a model. More... | |
| static void | CompareModelAndReferenceProfile (const mitk::ModelBase::Pointer testmodel, const json profile_json_obj) |
| Assert that a model's profile (parameter names, scales, units, etc.) matches a JSON reference. More... | |
| static void | CompareModelAndReferenceSignal (mitk::ModelBase::Pointer testmodel, const json modelValues_json_obj, const json profile_json_obj) |
| Assert that a model's computed signal matches a JSON reference for all parameter sets. More... | |
| static void | CompareModelAndReferenceDerivedParameters (const mitk::ModelBase::Pointer testmodel, json modelValues_json_obj) |
| Assert that a model's derived parameters match a JSON reference for all parameter sets. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from mitk::TestFixture | |
| std::vector< std::string > | GetTestParameter () const |
| Get parameters for this test fixture. More... | |
Static Protected Member Functions inherited from mitk::TestFixture | |
| static std::string | GetTestDataFilePath (const std::string &testData) |
| Get the absolute path for test data. More... | |
Test fixture base class for model fit unit tests.
Provides static helper methods that load model reference data from JSON files and compare a model's profile, signal output, and derived parameters against the reference values. Subclass this fixture, set up your model in setUp(), and use the provided comparison methods in your test cases.
The expected JSON structure contains:
Definition at line 55 of file mitkModelTestFixture.h.
|
inlinestatic |
Assert that a model's derived parameters match a JSON reference for all parameter sets.
For each entry in the "modelValues" array, sets the time grid, computes the derived parameters via GetDerivedParameters(), and compares each value against the reference "derivedParameterValues" array with a tolerance of 1e-6.
| testmodel | The model instance to validate. |
| modelValues_json_obj | JSON object containing the "modelValues" array. |
Definition at line 245 of file mitkModelTestFixture.h.
References mitk::Equal(), and ParseTestParameters().
|
inlinestatic |
Assert that a model's profile (parameter names, scales, units, etc.) matches a JSON reference.
Checks numberOfParameters, parameterNames, parameterScales, parameterUnits, derived parameters, static parameters, functionString, classID, modelDisplayName, modelType, axis names, and axis units.
| testmodel | The model instance to validate. |
| profile_json_obj | JSON object containing the expected profile values. |
Definition at line 152 of file mitkModelTestFixture.h.
|
inlinestatic |
Assert that a model's computed signal matches a JSON reference for all parameter sets.
For each entry in the "modelValues" array, sets the static parameters and time grid, computes the signal via GetSignal(), and compares each sample against the reference "signal" array with a tolerance of 1e-6.
| testmodel | The model instance to validate. |
| modelValues_json_obj | JSON object containing the "modelValues" array. |
| profile_json_obj | JSON object containing static parameter names. |
Definition at line 196 of file mitkModelTestFixture.h.
References mitk::Equal(), ParseTestParameters(), and SetStaticParametersForTest().
|
inlinestatic |
Parse a JSON file from the test data directory.
| path | Relative path to the JSON file within the MITK test data directory. |
Definition at line 64 of file mitkModelTestFixture.h.
References mitk::TestFixture::GetTestDataFilePath(), and MITK_ERROR.
|
inlinestatic |
Parse static parameter names and values from JSON into a StaticParameterMapType.
| profile_json_obj | JSON object containing "staticParameterNames". |
| modelValues_json_obj | JSON object containing "staticParameterValues". |
Definition at line 111 of file mitkModelTestFixture.h.
Referenced by SetStaticParametersForTest().
|
inlinestatic |
Extract model parameter values from a JSON object into a ParametersType array.
Reads the "modelParameterValues" array from the JSON object and returns it as a ModelBase::ParametersType.
| modelValues_json_obj | JSON object containing a "modelParameterValues" array. |
Definition at line 93 of file mitkModelTestFixture.h.
Referenced by CompareModelAndReferenceDerivedParameters(), and CompareModelAndReferenceSignal().
|
inlinestatic |
Convenience method that parses static parameters from JSON and applies them to a model.
| testmodel | The model instance to configure. |
| profile_json_obj | JSON object containing "staticParameterNames". |
| modelValues_json_obj | JSON object containing "staticParameterValues". |
Definition at line 135 of file mitkModelTestFixture.h.
References ParseStaticParameters().
Referenced by CompareModelAndReferenceSignal().