Skip to content

Commit 067df5d

Browse files
committed
feat: start point 2 params added
1 parent fd59a8b commit 067df5d

14 files changed

+126
-34
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Tomato
1+
# TOMATO
22

33
A library to calculate parametric maps in MRI. It contains ShMOLLI implementation as in [this article](https://jcmr-online.biomedcentral.com/articles/10.1186/1532-429X-12-69).
44
* **Github** repository can be found [here](https://github.com/MRKonrad/tomato).
@@ -61,9 +61,11 @@ Please see [contributing.md](contributing.md) and [codeofconduct.md](codeofcondu
6161
## TODO
6262

6363
* add acceptance test for 2param
64-
* maybe rename calculatormolli to calculator3param?
64+
* maybe rename calculatormolli to calculator3param?
65+
* maybe add calculator2param to produce different results?
6566
* Deployment: exe and lib in one zip
6667
* Deployment: cmake to download ITK and lmfit
68+
* update comments in configuration yaml files
6769
* output SNR maps
6870
* make sure SNR and nAmoebaCalls is the same as in Shmolli
6971
* fix downloadITK_linux_osx

app/OxFactoryOfStartPointCalculators.h

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include "CmakeConfigForTomato.h"
1111

12+
#include "OxStartPointCalculatorDefault2Dims.h"
1213
#include "OxStartPointCalculatorDefault3Dims.h"
1314
#ifdef USE_PRIVATE_NR2
1415
#include "OxStartPointCalculatorShmolli.h"
@@ -21,18 +22,21 @@ namespace Ox {
2122

2223

2324
static const char *startPointCalculatorsTypeNames[] = {
24-
"Default",
25+
"DefaultThreeParam",
26+
"DefaultTwoParam",
2527
"StartPointSHMOLLI"
2628
};
2729

2830
enum startPointCalculatorsType_t {
29-
Default = 0,
30-
StartPointSHMOLLI = 1,
31+
DefaultThreeParam = 0,
32+
DefaultTwoParam = 1,
33+
StartPointSHMOLLI = 2,
3134
lastStartPointCalculatorType = StartPointSHMOLLI
3235
};
3336

3437
static int startPointCalculatorsAvailability[] = {
35-
1, // Default
38+
1, // DefaultThreeParam
39+
1, // DefaultTwoParam
3640
#ifdef USE_PRIVATE_NR2
3741
1, // StartPointSHMOLLI
3842
#else
@@ -47,9 +51,12 @@ namespace Ox {
4751

4852
static StartPointCalculator<TYPE>* newByFactory(TomatoOptions<TYPE> *opts){
4953
switch (opts->start_point_calc_method){
50-
case Default: {
54+
case DefaultThreeParam: {
5155
return new StartPointCalculatorDefault3Dims<TYPE>();
5256
}
57+
case DefaultTwoParam: {
58+
return new StartPointCalculatorDefault2Dims<TYPE>();
59+
}
5360
#ifdef USE_PRIVATE_NR2
5461
case StartPointSHMOLLI: {
5562
return new StartPointCalculatorShmolli<TYPE>();

app/TomatoOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ namespace Ox {
7878
fitting_method = LevMarVnl;
7979
functions_type = FunctionsThreeParams;
8080
sign_calc_method = NoSign;
81-
start_point_calc_method = Default;
81+
start_point_calc_method = DefaultThreeParam;
8282

8383
fTolerance = 1e-12;
8484
max_function_evals = 4000;

codeofconduct.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Contributor Covenant Code of Conduct
1+
# Code of Conduct
22

33
## Our Pledge
44

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/*!
2+
* \file OxStartPointCalculatorDefault2Dims.h
3+
* \author Konrad Werys
4+
* \date 2018/08/10
5+
*/
6+
7+
#ifndef Tomato_OXSTARTPOINTCALCULATORDefault2Dims_H
8+
#define Tomato_OXSTARTPOINTCALCULATORDefault2Dims_H
9+
10+
#include "OxStartPointCalculator.h"
11+
12+
namespace Ox {
13+
14+
/**
15+
* \class StartPointCalculatorDefault2Dims
16+
* \brief
17+
* \details
18+
* @tparam MeasureType
19+
*/
20+
template< typename MeasureType >
21+
class StartPointCalculatorDefault2Dims : public StartPointCalculator<MeasureType>{
22+
23+
public:
24+
25+
/**
26+
* the most important function of this class
27+
* @return success/failure
28+
*/
29+
virtual int calculateStartPoint(){
30+
setStartPointToDefault();
31+
return 0; // EXIT_SUCCESS
32+
};
33+
34+
int setStartPointToDefault(){
35+
this->getCalculatedStartPoint()[0] = _DefaultStartPoint[0];
36+
this->getCalculatedStartPoint()[1] = _DefaultStartPoint[1];
37+
38+
return 0; // EXIT_SUCCESS
39+
}
40+
41+
/**
42+
* \brief constructor
43+
*/
44+
StartPointCalculatorDefault2Dims() : StartPointCalculator<MeasureType>(){
45+
this->_nDims = 2;
46+
47+
_DefaultStartPoint[0] = 100;
48+
_DefaultStartPoint[1] = 1000;
49+
50+
}
51+
52+
/**
53+
* \brief copy constructor
54+
*/
55+
StartPointCalculatorDefault2Dims(const StartPointCalculatorDefault2Dims &old){
56+
this->setAllPointersToNull();
57+
58+
_DefaultStartPoint[0] = old._DefaultStartPoint[0];
59+
_DefaultStartPoint[1] = old._DefaultStartPoint[1];
60+
this->_nSamples = old._nSamples;
61+
this->_nDims = old._nDims;
62+
};
63+
64+
/**
65+
* cloning
66+
* @return
67+
*/
68+
virtual StartPointCalculator<MeasureType> *newByCloning() { return new StartPointCalculatorDefault2Dims<MeasureType>(*this); }
69+
70+
/**
71+
* \brief do not forget about the virtual destructor, see
72+
* https://stackoverflow.com/questions/461203/when-to-use-virtual-destructors
73+
*/
74+
virtual ~StartPointCalculatorDefault2Dims(){};
75+
76+
protected:
77+
MeasureType _DefaultStartPoint[2];
78+
79+
};
80+
} //namespace Ox
81+
82+
#endif //Tomato_OXStartPointCalculatorDefault2Dims_H

scriptsOther/tagtagtag.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
git push --delete origin v0.4.1
4-
git tag --delete v0.4.1
5-
git tag v0.4.1 -m "updating documentation"
6-
git push origin v0.4.1
3+
git push --delete origin v0.4.2
4+
git tag --delete v0.4.2
5+
git tag v0.4.2 -m "2 parameter fitting"
6+
git push origin v0.4.2

tests/OxCalculatorT1_saturation_recovery_test.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "OxFitterAmoebaVnl.h"
1616
#include "OxSignCalculatorNoSign.h"
1717
#include "OxStartPointCalculatorDefault3Dims.h"
18+
#include "OxStartPointCalculatorDefault2Dims.h"
1819
#include "OxCalculatorT1Molli.h"
1920

2021
#ifdef USE_ITK
@@ -34,7 +35,7 @@ TEST(OxCalculatorT1_saturation_recovery, twoParam) {
3435
Ox::FunctionsT1TwoParam<TYPE> functionsObject;
3536
Ox::FitterAmoebaVnl<TYPE> fitterAmoebaVnl;
3637
Ox::SignCalculatorNoSign<TYPE> signCalculator;
37-
Ox::StartPointCalculatorDefault3Dims<TYPE> startPointCalculator;
38+
Ox::StartPointCalculatorDefault2Dims<TYPE> startPointCalculator;
3839
Ox::CalculatorT1Molli<TYPE> calculatorT1Molli;
3940

4041
// configure

tests/OxTestData.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ namespace Ox {
2626
virtual std::vector<MeasureType> getSigns() const { return _signs; }
2727
virtual std::vector<MeasureType> getSignal() const { return _signal; }
2828
virtual std::vector<MeasureType> getInvTimes() const { return _invTimes; }
29-
virtual std::vector<MeasureType> getResultsMolli() const { return _resultsMolli; }
30-
virtual std::vector<MeasureType> getResultsShmolli() const { return _resultsShmolli; }
31-
virtual std::vector<MeasureType> getResultsTwoParam() const { return _resultsTwoParam; }
32-
virtual std::vector<MeasureType> getResultsThreeParam() const { return _resultsThreeParam; }
29+
virtual std::vector<MeasureType> getResultsMolli() const { return _resultsMolli; }
30+
virtual std::vector<MeasureType> getResultsShmolli() const { return _resultsShmolli; }
31+
virtual std::vector<MeasureType> getResultsTwoParam() const { return _resultsTwoParam; }
32+
virtual std::vector<MeasureType> getResultsThreeParam() const { return _resultsThreeParam; }
3333

3434

3535
virtual const MeasureType* getSignalMagPtr() const {

tests/testData/Hcmr_Phantom_1916_Shmolli_192i_e11_fileList.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
# output_fitparams_series_number: <number, for example 10008>
1616
#
1717
# parameter_to_map: <T1_Molli/T1_Shmolli/T1_SHMOLLI_original>
18-
# functions_object: <FunctionsThreeParams/FunctionsShmolli>
18+
# functions_object: <FunctionsThreeParams FunctionsTwoParams FunctionsShmolli>
1919
# fitting_method: <AmoebaVnl/LevMarVnl/AmoebaPrivateNr2>
2020
# fTolerance: <number, for example 1e-12>
2121
# max_function_evals: <number, for example 4000>
2222
# sign_calc_method: <MagOnly/MagPhase/RealImag>
23-
# start_point_calc_method: <Default StartPointSHMOLLI>
23+
# start_point_calc_method: <DefaultThreeParam DefaultTwoParam StartPointSHMOLLI>
2424
#
2525
# numberOfThreads: <number, 0 = max allowed threads>
2626
# visualise: <0 = false, anything else = true>
@@ -54,7 +54,7 @@ fitting_method: LevMarVnl
5454
max_function_evals: 4000
5555
fTolerance: 1e-12
5656
sign_calc_method: RealImag
57-
start_point_calc_method: Default
57+
start_point_calc_method: DefaultThreeParam
5858

5959
number_of_threads: 0
6060
visualise: 1

tests/testData/Hcmr_Phantom_1916_Shmolli_192i_e11_fileList_noPhase.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
# output_fitparams_series_number: <number, for example 10008>
1616
#
1717
# parameter_to_map: <T1_Molli/T1_Shmolli/T1_SHMOLLI_original>
18-
# functions_object: <FunctionsThreeParams/FunctionsShmolli>
18+
# functions_object: <FunctionsThreeParams FunctionsTwoParams FunctionsShmolli>
1919
# fitting_method: <AmoebaVnl/LevMarVnl/AmoebaPrivateNr2>
2020
# fTolerance: <number, for example 1e-12>
2121
# max_function_evals: <number, for example 4000>
2222
# sign_calc_method: <MagOnly/MagPhase/RealImag>
23-
# start_point_calc_method: <Default StartPointSHMOLLI>
23+
# start_point_calc_method: <DefaultThreeParam DefaultTwoParam StartPointSHMOLLI>
2424
#
2525
# numberOfThreads: <number, 0 = max allowed threads>
2626
# visualise: <0 = false, anything else = true>
@@ -45,7 +45,7 @@ fitting_method: LevMarVnl
4545
max_function_evals: 4000
4646
fTolerance: 1e-12
4747
sign_calc_method: RealImag
48-
start_point_calc_method: Default
48+
start_point_calc_method: DefaultThreeParam
4949

5050
number_of_threads: 0
5151
visualise: 1

0 commit comments

Comments
 (0)