}
private ParameterIAR calculateIAR() {
//int posOfMaxFirstDerivative = this.firsDerivatite.getPosOfMax(this.posOfMax, this.posBeginigDiastole);//Coordenada en X del maximo derivada 1
int posOfMaxFirstDerivative = this.finalSignal.getSecondDerivative().getPosOfMin(this.posOfMax, this.posBeginigDiastole);
ParameterIAR param = new ParameterIAR();
//param.setInitPos(0f);
// if distance is zero, search from other postion
if (posOfMaxFirstDerivative == 0) {
int half = (this.posBeginigDiastole - this.posOfMax) / 2;
posOfMaxFirstDerivative = half + this.finalSignal.getSecondDerivative().getPosOfMin(this.posOfMax + half, this.posBeginigDiastole);
}
posOfMaxFirstDerivative += this.posOfMax;
posOfMaxFirstDerivative = this.posOfMax + this.finalSignal.getFourthDerivative().looksFirstPositionOfNearestValueOnSubSegmentDowTo(FIFTY, posOfMax, posOfMaxFirstDerivative);
// previo a la linea superiro 30/11/11
// posOfMaxFirstDerivative = this.obtainIntersectionDownTo(this.finalSignal.getSecondDerivative(), this.finalSignal.getFourthDerivative(), posOfMaxFirstDerivative);
param.setInitPos(new ParameterCoord(this.k.multiply(new BigDecimal(posOfMaxFirstDerivative)), BigDecimal.ZERO));
param.setEndPos(new ParameterCoord(this.k.multiply(new BigDecimal(posOfMaxFirstDerivative)), this.finalSignal.getFinalSegment().elementAt(posOfMaxFirstDerivative)));
//param.setEndPos(new Float(this.posOfMax + posOfMaxFirstDerivative));
this.posOfIAR = posOfMaxFirstDerivative;
return (param);
}