void ContourExtractData::SetImage( vtkImageData* imagedata)
{
this->imagedata = imagedata;
+ this->imagedata->GetScalarRange(scalarRange);
// RaC 20-11-09 Changes in InitLstContoursLinesYPoints
int ext[6];
int result = 0;
int i;
- //cout<<"RaC ContourExtractData::AnalisisContourInsideV2-iContour:"<<iContour<<" y:"<<y<<endl;
-
int nps=_lstlstlstVecX1[iContour][y].size();
double x1,y1,x2,y2;
if ((i>=0) && (i<=ext[1]) && (j>=0) && (j<=ext[3]))
{
- if (isInside(i,j,_typeOperation)==true)
+ if (isInside(i,j,_typeOperation)==true)
{
- value = GetDataValue(i,j,zImage);
+ value = GetDataValue(i,j,zImage);
+ if ( (value>=scalarRange[0]) && (value<=scalarRange[1]) )
+ {
PutVtkImageDataResultValue(i,j,zImage, value );
- } // if
-
- }//if
+ } // scalarRange
+ } // if isInside
+ } // if ext
} // for i
} // for j
}
//------------------------------------------------------------------------
-void ContourExtractData::GetValuesInsideCrown(std::vector<double> *pLstValue,
- std::vector<double> *pLstValuePosX,
- std::vector<double> *pLstValuePosY,
- std::vector<double> *pLstValuePosZ)
+void ContourExtractData::GetValuesInsideCrown( int *numberOfPixels,
+ std::vector<double> *pLstValue,
+ std::vector<double> *pLstValuePosX,
+ std::vector<double> *pLstValuePosY,
+ std::vector<double> *pLstValuePosZ)
{
pLstValue->clear();
pLstValuePosX->clear();
int maxPoint[2];
int i,j;
double value;
-
+ int acum=0;
minPoint[0] = 999999;
minPoint[1] = 999999;
if ((i>=0) && (i<=ext[1]) && (j>=0) && (j<=ext[3]))
{
-
- if (isInside(i,j,_typeOperation)==true)
+ if (isInside(i,j,_typeOperation)==true)
{
- value = GetDataValue(i,j,zImage);
-
- // Borrame
- // if (okImagesResults==true){
- // PutVtkImageDataResultValue(i,j,zImage, value );
- // }
-
- pLstValue -> push_back( value );
- pLstValuePosX -> push_back( i );
- pLstValuePosY -> push_back( j );
- pLstValuePosZ -> push_back( -1 );
- } // if
-
- } //if
+ acum++;
+ value = GetDataValue(i,j,zImage);
+ if ( (value>=scalarRange[0]) && (value<=scalarRange[1]) )
+ {
+ pLstValue -> push_back( value );
+ pLstValuePosX -> push_back( i );
+ pLstValuePosY -> push_back( j );
+ pLstValuePosZ -> push_back( -1 );
+ } // scalarRange
+ } // if isInside
+ } // if ext
} // for
} // for
- // Borrame
- // if (this->okImagesResults==true){
- // imagedataValueResult->Modified();
- // imagedataMaskResult->Modified();
- // }
-
-
+ *numberOfPixels = acum;
}
//------------------------------------------------------------------------
acum_standardeviation = acum_standardeviation + tmp*tmp;
} // for standar deviation
standardeviation = sqrt(acum_standardeviation/size);
- SetVolumeStatistics(countRange, size,
- min,max,
- acum_average,acum_standardeviation);
+ SetVolumeStatistics(countRange, (*rsize),
+ min,max,
+ acum_average,acum_standardeviation);
} // if size
} // if NULL
}
+void ContourExtractData::SetScalarRange(double min, double max)
+{
+ scalarRange[0]=min;
+ scalarRange[1]=max;
+}
+
void ContourExtractData::SetSizeImageY(int pSizeImageY)
{
_sizeImageY=pSizeImageY;