42 #ifndef SVK_2_SITE_PERF_COST_COST_FUNCTION_H
43 #define SVK_2_SITE_PERF_COST_COST_FUNCTION_H
50 #define ARRIVAL_TIME 1
69 this->InitNumberOfSignals();
81 double T1all = parameters[0];
82 double Kpl = parameters[1];
83 double Ktrans = parameters[2];
90 int arrivalTime = GetArrivalTime( this->GetSignal(0) );
102 float* inputFunction =
new float [numTimePoints];
103 for(
int t = 0; t < numTimePoints; t++ ) {
104 inputFunction [t] = Ao * powf((t),alpha) * exp(-(t)/beta);
116 for (
int t = 0; t < numTimePoints; t++ ) {
118 if (t < arrivalTime ){
119 this->GetModelSignal(0)[t] = this->GetSignalAtTime(0, t);
120 this->GetModelSignal(1)[t] = this->GetSignalAtTime(1, t);
123 if (t >= arrivalTime ) {
127 this->GetModelSignal(0)[t] = this->GetSignalAtTime(0, arrivalTime)
128 * exp( -((T1all) + Kpl) * ( t - arrivalTime) ) + (1-exp(-Ktrans*t))*inputFunction[t];
132 this->GetModelSignal(1)[t] = this->GetSignalAtTime(1, arrivalTime)
133 * exp( -( t - arrivalTime )*T1all)
134 - this->GetSignalAtTime(0, arrivalTime)
135 * exp( -( t - arrivalTime )*T1all)
136 * ( exp( -Kpl * ( t - arrivalTime )) - 1 );
154 this->GetModelSignal(2)[t] = inputFunction[t];
170 int numParameters = 3;
171 return numParameters;
181 this->SetNumberOfSignals(3);
191 outputDescriptionVector->resize( this->GetNumberOfOutputPorts() );
192 (*outputDescriptionVector)[0] =
"pyr";
193 (*outputDescriptionVector)[1] =
"lac";
194 (*outputDescriptionVector)[2] =
"urea";
195 (*outputDescriptionVector)[3] =
"T1all";
196 (*outputDescriptionVector)[4] =
"Kpl";
197 (*outputDescriptionVector)[5] =
"Ktrans";
206 upperBounds[0] = 28/this->TR;
207 lowerBounds[0] = 8/this->TR;
209 upperBounds[1] = .05 * this->TR;
210 lowerBounds[1] = 0.000 * this->TR;
212 upperBounds[2] = 0 * this->TR;
213 lowerBounds[2] = 0 * this->TR;
226 if (this->TR == 0 ) {
227 cout <<
"ERROR: TR Must be set before initializing parameters" << endl;
231 (*initialPosition)[0] = (1./35) / this->TR;
232 (*initialPosition)[1] = 0.01 * this->TR;
233 (*initialPosition)[2] = 1 * this->TR;
234 (*initialPosition)[3] = (1./40) * this->TR;
243 if (this->TR == 0 ) {
244 cout <<
"ERROR: TR Must be set before scaling final parameters" << endl;
248 (*finalPosition)[0] *= this->TR;
249 (*finalPosition)[1] /= this->TR;
250 (*finalPosition)[2] /= this->TR;
251 (*finalPosition)[2] /= this->TR;
260 int GetArrivalTime(
float* firstSignal )
const
263 float maxValue0 = firstSignal[0];
265 for(t = arrivalTime; t < this->numTimePoints; t++ ) {
266 if( firstSignal[t] > maxValue0) {
267 maxValue0 = firstSignal[t];
281 #endif// SVK_2_SITE_PERF_COST_COST_FUNCTION_H
Definition: svkKineticModelCostFunction.h:53
virtual unsigned int GetNumberOfParameters(void) const
Definition: svk2SitePerfCostFunction.h:168
virtual void InitNumberOfSignals(void)
Definition: svk2SitePerfCostFunction.h:178
virtual void GetKineticModel(const ParametersType ¶meters) const
Definition: svk2SitePerfCostFunction.h:78
svk2SitePerfCostFunction Self
Definition: svk2SitePerfCostFunction.h:60
svk2SitePerfCostFunction()
Definition: svk2SitePerfCostFunction.h:67
virtual void InitParamInitialPosition(ParametersType *initialPosition)
Definition: svk2SitePerfCostFunction.h:224
virtual void InitParamBounds(float *lowerBounds, float *upperBounds)
Definition: svk2SitePerfCostFunction.h:204
Definition: svk2SitePerfCostFunction.h:55
virtual void GetParamFinalScaledPosition(ParametersType *finalPosition)
Definition: svk2SitePerfCostFunction.h:241
Superclass::ParametersType ParametersType
Definition: svkKineticModelCostFunction.h:64
virtual void InitOutputDescriptionVector(vector< string > *outputDescriptionVector) const
Definition: svk2SitePerfCostFunction.h:189