marAxisCT Class Reference

#include <marAxisCT.h>

Inheritance diagram for marAxisCT:

Inheritance graph
[legend]
Collaboration diagram for marAxisCT:

Collaboration graph
[legend]

List of all members.

Public Types

enum  AxisStateVectorIndexes {
  INDX_X = 0, INDX_Y, INDX_Z, INDX_V1X,
  INDX_V1Y, INDX_V1Z, INDX_V2X, INDX_V2Y,
  INDX_V2Z, INDX_V3X, INDX_V3Y, INDX_V3Z,
  INDX_LAMBDA1, INDX_LAMBDA2, INDX_LAMBDA3, INDX_MASSE,
  INDX_RAYON, INDX_INERTIE, INDX_PTAGEMASSE, INDX_PTAGERAYON,
  INDX_SIGNALVALUE, INDX_count
}

Public Member Functions

 marAxisCT ()
marContour * getContour (int point, kVolume *vol, int index)
vtkPoints * get3Dcontour (int point, kVolume *vol, int index)
vtkPolyData * get2Dcontour (int point, kVolume *vol, int index)
vtkPoints * get2DDiameterMin (int point, kVolume *vol, int index)
vtkPoints * get2DDiameterMax (int point, kVolume *vol, int index)
int getSignal (int point, int index, kVolume *vol)
void updateLumenPercentage (int point, kVolume *vol)
void updateCalcPercentage (int point, kVolume *vol)
void replaceContour2D (int point, int size, double *vx, double *vy, int type)
marContourVOsearchContour (int type, int point)
int getNumberOfContours (int point, kVolume *vol)
int getContourType (int point, int index, kVolume *vol)
void createEmptyContours ()
void eraseContours ()
void eraseContoursPartial (int start)
void histogram (int point, kVolume *vol)
void setCalibration (bool calib)
bool getCalibration ()
int getStartIndex ()
void setStartIndex (int start)
int getPointSize ()
marPointgetPoint (int i)
void markUpLumen (int point, kVolume *vol)
void generateFile (int point, kVolume *vol)
void cleanContours (int type, int point)
double performXOR (int type, int point, std::vector< marIsocontour * > manual, kVolume *vol)
double performAND (int type, int point, std::vector< marIsocontour * > manual, kVolume *vol)
double performUnion (int type, int point, std::vector< marIsocontour * > manual, kVolume *vol)
marIsocontourloadMarIsocontour (int size, double *vx, double *vy)
std::string & getDescription ()
void setDescription (std::string &d)
void addAxisPoint (double *p)
void changeAxisResolution ()
void calculateSignal (kVolume *vol)
int getActualQuant ()
float getSignal (uint slice)
double * getSplinePoint (uint i)
int getHealthySlice ()
int getHealthySliceStart ()
int getHealthySliceEnd ()
void setActualQuant (int act)
void setHealthySlice (int hsS, int hs, int hsE)
void setStartQuant (int sq)
void setFinishQuant (int fq)
int getStartQuant ()
int getFinishQuant ()
void start ()
void next ()
void stop ()
bool isFinished ()
void doSpline ()
void cut (int slice, bool up)
void sliceVolumeAxis (kVolume *vol, bool forceCnt=true)
double * getNormal (unsigned int slice)
int getNumberOfContours ()
int getNumberOfSplinePoints ()
bool if3DcontourExist (int i)
void Save3Dcontour (FILE *ff, int i)
void SaveExisting3DContours (FILE *ff)
marContour * getContour (int i, kVolume *vol)
kVolume * getSlice (int i, kVolume *vol)
vtkProbeFilter * get3DSlice (int i, kVolume *vol)
vtkPoints * get3Dcontour (int i, kVolume *vol)
vtkImageData * getSliceImage (int i, kVolume *vol)
vtkPolyData * get2Dcontour (int i, kVolume *vol)
vtkPoints * get2DDiameterMin (int i, kVolume *vol)
vtkPoints * get2DDiameterMax (int i, kVolume *vol)
void replaceContour2D (int i, int size, double *vx, double *vy)
void EraseContour (int i)
void createEmptyVectors ()
void clearAllVectors ()
void eraseContourVectorsContent ()
void set_points_disc (PPPOINTAXE p)
double getTotalLength ()
double getSubAxisLength ()
double getReferenceArea (kVolume *vol)
double getReferenceAverDiam (kVolume *vol)
double getAverageArea (int pIni, int pEnd, kVolume *vol)
void reset ()
void copyFrom (const marObject &from)
bool save (std::ofstream &os)
bool save (std::string &nw)
bool load (std::ifstream &is)
bool load (std::string &nr)
vtkPolyData * Draw ()
vtkPolyData * GetAxisData ()
void Delete ()
double * getPoints (int i)
void AddPointToList (double x, double y, double z, int signal)
void setParameters (marParameters *p)
void copyParameters (marParameters *p)
void makeACopyParameters ()
marParametersgetParameters ()
bool parametersOwned ()

Protected Attributes

std::vector
< marAxisContours * > 
quantContours
std::vector< marPoint * > vesselPoints
std::vector
< marIsocontour * > 
lumenContour
bool calibration

Private Member Functions

void createContours (int point, kVolume *vol)
void create3Dcontours (int point, kVolume *vol)
void create2Dcontours (int point, kVolume *vol)
void create2DDiametersMin (int point, kVolume *vol)
void create2DDiametersMax (int point, kVolume *vol)
void createSignals (int point, kVolume *vol)
void generatePoints (int point, kVolume *vol, std::vector< marIsocontour * > *list)
int getMaximumGrad (std::vector< marPoint * > list, int iniPos, int limit, double threshold)
int getMinimumGrad (std::vector< marPoint * > list, int iniPos, int limit, double threshold)
double interpolate (double x, double y, vtkImageData *imagedata)
void generateVector (int dir, int *coordBase, double originX, double originY, double *x, double *y)
bool detectNeighbor (marIsocontour *contour, int dir, int type)
marIsocontouraddPointToContour (marIsocontour *cont, bool inside, int type, marPoint *point)
void unifyDividedStructure (std::vector< marIsocontour * > *contList)
double getStatistics (marIsocontour *contour, double x, double y, vtkImageData *imagedata)
double getCalcStatistics (marIsocontour *contour, double x, double y, vtkImageData *imagedata, int i)
int round (double num)
int getMaxIntensity (int point)
bool pointInPolygon (marIsocontour *c, double x, double y)
marIsocontourparsePolyDataToMarIsocontour (marContourVO *contourVO)
marIsocontourfilterContour (marIsocontour *contExt, marIsocontour *contInt, double radio)
double obtainContourArea (marIsocontour *contour)
void adjustWall (int point, kVolume *vol)
void adjustCalcification (int point, kVolume *vol)
void adjustContour (int point, kVolume *vol)
int maxValue (std::vector< double > list)
int getDiameter (marContourVO *contourVO, double x, double y, int limInfX, int limInfY, int limSupX, int limSupY)
int searchData (std::vector< double > vec, double value)
void extractLumen (vtkImageData *lumenImage, marIsocontour *lumenContour, int point)

Private Attributes

double avgValue
double stdValue
int startIndex
double maxSignal


Detailed Description

Definition at line 30 of file marAxisCT.h.


Member Enumeration Documentation

enum marAxis::AxisStateVectorIndexes [inherited]

An enum.

More detailed enum description.

Enumerator:
INDX_X  X coordinate of an axis point.
INDX_Y  Y coordinate of an axis point.
INDX_Z  Z coordinate of an axis point.
INDX_V1X  X coordinate of the first eigen vector.
INDX_V1Y  Y coordinate of the first eigen vector.
INDX_V1Z  Z coordinate of the first eigen vector.
INDX_V2X  X coordinate of the second eigen vector.
INDX_V2Y  Y coordinate of the second eigen vector.
INDX_V2Z  Z coordinate of the second eigen vector.
INDX_V3X  X coordinate of the third eigen vector.
INDX_V3Y  Y coordinate of the third eigen vector.
INDX_V3Z  Z coordinate of the third eigen vector.
INDX_LAMBDA1  Value of the first eigen value.
INDX_LAMBDA2  Value of the second eigen value.
INDX_LAMBDA3  Value of the third eigen value.
INDX_MASSE  Weight of the optimal sphere.
INDX_RAYON  Radius of the optimal sphere.
INDX_INERTIE  Inertia of the optimal sphere.
INDX_PTAGEMASSE  X coordinate of an axis point.
INDX_PTAGERAYON  X coordinate of an axis point.
INDX_SIGNALVALUE  X coordinate of an axis point.
INDX_count  Allow counting of this enum.

Definition at line 52 of file marAxis.h.

00053 {
00054     INDX_X = 0,       
00055     INDX_Y,           
00056     INDX_Z,           
00057     INDX_V1X,         
00058     INDX_V1Y,         
00059     INDX_V1Z,         
00060     INDX_V2X,         
00061     INDX_V2Y,         
00062     INDX_V2Z,         
00063     INDX_V3X,         
00064     INDX_V3Y,         
00065     INDX_V3Z,         
00066     INDX_LAMBDA1,     
00067     INDX_LAMBDA2,     
00068     INDX_LAMBDA3,     
00069     INDX_MASSE,       
00070     INDX_RAYON,       
00071     INDX_INERTIE,     
00072     INDX_PTAGEMASSE,  
00073     INDX_PTAGERAYON,  
00074     INDX_SIGNALVALUE, 
00075     INDX_count        
00076     };


Constructor & Destructor Documentation

marAxisCT::marAxisCT (  ) 

Definition at line 32 of file marAxisCT.cpp.

00032                        : marAxis(  )                             
00033 {
00034 }


Member Function Documentation

marContour * marAxisCT::getContour ( int  point,
kVolume *  vol,
int  index 
)

Definition at line 37 of file marAxisCT.cpp.

References createContours(), and marAxis::quantContours.

Referenced by cleanContours(), create2DDiametersMax(), create2DDiametersMin(), create3Dcontours(), generateFile(), get2Dcontour(), get3Dcontour(), getMaxIntensity(), markUpLumen(), performAND(), performUnion(), performXOR(), and updateCalcPercentage().

00037                                                                        {
00038         if (quantContours[point] == NULL || quantContours[point]->getContour(index)->getContour() == NULL)
00039         {
00040                 createContours(point,vol);
00041         }
00042 
00043         return quantContours[point]->getContour(index)->getContour();
00044 } 

Here is the call graph for this function:

Here is the caller graph for this function:

vtkPoints * marAxisCT::get3Dcontour ( int  point,
kVolume *  vol,
int  index 
)

Definition at line 47 of file marAxisCT.cpp.

References create3Dcontours(), marContourVO::get3DContour(), marAxisContours::getContour(), getContour(), and marAxis::quantContours.

00047                                                                         {
00048         if (quantContours[point] == NULL || quantContours[point]->getContour(index)->get3DContour() == NULL)
00049         {
00050                 create3Dcontours(point,vol); 
00051         }
00052 
00053         marAxisContours* cont = quantContours[point];
00054 
00055         return cont->getContour(index)->get3DContour();
00056 }

Here is the call graph for this function:

vtkPolyData * marAxisCT::get2Dcontour ( int  point,
kVolume *  vol,
int  index 
)

Definition at line 59 of file marAxisCT.cpp.

References create2Dcontours(), marContourVO::get2DContour(), marAxisContours::getContour(), getContour(), and marAxis::quantContours.

00059                                                                           {
00060         if (quantContours[point] == NULL || quantContours[point]->getContour(index)->get2DContour() == NULL)
00061         {
00062                 create2Dcontours(point,vol); 
00063         }
00064 
00065         marAxisContours* cont = quantContours[point];
00066 
00067         
00068 
00069         return cont->getContour(index)->get2DContour();
00070 }

Here is the call graph for this function:

vtkPoints * marAxisCT::get2DDiameterMin ( int  point,
kVolume *  vol,
int  index 
)

Definition at line 73 of file marAxisCT.cpp.

References create2DDiametersMin(), marContourVO::get2DDiameterMin(), marAxisContours::getContour(), and marAxis::quantContours.

00073                                                                             {
00074 //      if (quantContours[point] == NULL || quantContours[point]->getContour(index)->get2DDiameterMin() == NULL)
00075 //      {
00076                 create2DDiametersMin(point,vol); 
00077 //      }
00078 
00079         marAxisContours* cont = quantContours[point];
00080 
00081         return cont->getContour(index)->get2DDiameterMin();
00082 }

Here is the call graph for this function:

vtkPoints * marAxisCT::get2DDiameterMax ( int  point,
kVolume *  vol,
int  index 
)

Definition at line 85 of file marAxisCT.cpp.

References create2DDiametersMax(), marContourVO::get2DDiameterMax(), marAxisContours::getContour(), and marAxis::quantContours.

00085                                                                             {
00086 //      if (quantContours[point] == NULL || quantContours[point]->getContour(index)->get2DDiameterMax() == NULL)
00087 //      {
00088                 create2DDiametersMax(point,vol); 
00089 //      }
00090 
00091         marAxisContours* cont = quantContours[point];
00092 
00093         return cont->getContour(index)->get2DDiameterMax();
00094 }

Here is the call graph for this function:

int marAxisCT::getSignal ( int  point,
int  index,
kVolume *  vol 
)

Definition at line 97 of file marAxisCT.cpp.

References createSignals(), and marAxis::quantContours.

00097                                                            {
00098         if (quantContours[point] == NULL )
00099         {
00100                 createSignals(point,vol); 
00101         }
00102 
00103         return (int) ( quantContours[point]->getContour(index)->getSignal() );
00104 }

Here is the call graph for this function:

void marAxisCT::updateLumenPercentage ( int  point,
kVolume *  vol 
)

Definition at line 1061 of file marAxisCT.cpp.

References create2Dcontours(), marContourVO::get2DContour(), marContourVO::getIsocontour(), marObject::getParameters(), marContourVO::getSignal(), marContourVO::getType(), marContourVO::isReplaced(), marAxis::quantContours, searchContour(), and marAxisContours::WALL.

Referenced by adjustWall(), create2Dcontours(), and histogram().

01062 {
01063         marContourVO* wallCont = searchContour(marAxisContours::WALL,point);
01064         if (quantContours[point] == NULL || wallCont->get2DContour() == NULL)
01065         {
01066                 create2Dcontours(point,vol); 
01067         }
01068 
01069         if (wallCont->getType() == marAxisContours::WALL
01070                         && wallCont->isReplaced() == false)
01071         {
01072                 int a = ((marParameters *) getParameters())->getLumenPercentage();
01073                 double oldValue = wallCont->getSignal();
01074                 double lumenPercentage=((marParameters *) getParameters())->getLumenPercentage();
01075                 double poww=pow(10.0,-2.0);
01076                 double newValue = oldValue * lumenPercentage*poww;
01077                 wallCont->getIsocontour()->SetValue(0,newValue);
01078                 wallCont->getIsocontour()->Update();
01079                 wallCont->get2DContour()->Update(); 
01080         }
01081         
01082 }

Here is the call graph for this function:

Here is the caller graph for this function:

void marAxisCT::updateCalcPercentage ( int  point,
kVolume *  vol 
)

Definition at line 1085 of file marAxisCT.cpp.

References marAxisContours::CALCIFICATION, create2Dcontours(), getContour(), getMaxIntensity(), marObject::getParameters(), and marAxis::quantContours.

Referenced by create2Dcontours().

01086 {
01087         double oldValue;
01088         int posMax;
01089 
01090         if (quantContours[point] == NULL)
01091         {
01092                 create2Dcontours(point,vol); 
01093         }
01094 
01095         posMax = getMaxIntensity(point);
01096         
01097         if (quantContours[point]->getSize() > 1)
01098         {
01099                 oldValue = quantContours[point]->getContour(posMax)->getSignal();
01100         }
01101         
01102         for (int i = 1; i < quantContours[point]->getSize(); i++)
01103         {
01104                 
01105                 if (quantContours[point]->getContour(i)->getType() == marAxisContours::CALCIFICATION 
01106                                 && quantContours[point]->getContour(i)->isReplaced() == false)
01107                 {
01108 
01109                         double newValue = oldValue * ((((marParameters *) getParameters())->getCalcPercentage())*pow(10.0,-2.0));
01110                         quantContours[point]->getContour(i)->getIsocontour()->SetValue(0,newValue);
01111                         quantContours[point]->getContour(i)->getIsocontour()->Update();
01112                         quantContours[point]->getContour(i)->get2DContour()->Update();
01113                 }
01114         
01115         }
01116         
01117 }

Here is the call graph for this function:

Here is the caller graph for this function:

void marAxisCT::replaceContour2D ( int  point,
int  size,
double *  vx,
double *  vy,
int  type 
)

this->searchContour(type,point);

Definition at line 2156 of file marAxisCT.cpp.

References marAxis::quantContours, marContourVO::set2DContour(), marContourVO::setReplaced(), and marContourVO::setType().

02157 {
02158 
02159         vtkPoints *_pts = vtkPoints::New();
02160         _pts->SetNumberOfPoints(size);
02161         int j;
02162 
02163         for (j=0 ; j<size ; j++){
02164                 _pts->SetPoint(j,       vx[j]   , vy[j] , 0 );
02165         }
02166 //      _pts->SetPoint(0,       vx[0]   , vy[0] , 0 );
02167 
02168         vtkCellArray *lines = vtkCellArray::New();
02169         lines->InsertNextCell( size );
02170         for ( j=0 ; j<size+1 ; j++ ){
02171                 lines->InsertCellPoint(j % size );
02172         }
02173 
02174         vtkPolyData *_pd = vtkPolyData::New();
02175         _pd->SetPoints( _pts );
02176         _pd->SetLines( lines );
02177         lines->Delete();  //do not delete lines ??
02178         _pts->Delete();  
02179 
02180         marContourVO* vo = new marContourVO();
02181         vo->setReplaced(true);
02182         vo->set2DContour(_pd);
02183         vo->setType(type);
02184         quantContours[point]->addContour(vo);   //->replaceContour(vo,i);
02185 /*      _2Dcontours[i]=_pd;
02186         createContour(i,NULL);*/
02187 }

Here is the call graph for this function:

marContourVO * marAxisCT::searchContour ( int  type,
int  point 
)

Definition at line 2214 of file marAxisCT.cpp.

References getContourType(), and marAxis::quantContours.

Referenced by adjustContour(), adjustWall(), extractLumen(), histogram(), markUpLumen(), and updateLumenPercentage().

02215 {
02216         marContourVO* cont = NULL;
02217 
02218         for (int i = 0; i < quantContours[point]->getSize(); i++)
02219         {
02220                 if (quantContours[point]->getContourType(i) == type)
02221                 {
02222                         cont = quantContours[point]->getContour(i);
02223                 }
02224         }
02225 
02226         return cont;
02227 }

Here is the call graph for this function:

Here is the caller graph for this function:

int marAxisCT::getNumberOfContours ( int  point,
kVolume *  vol 
)

Definition at line 463 of file marAxisCT.cpp.

References create2Dcontours(), and marAxis::quantContours.

00463                                                               {
00464         if (quantContours[point] == NULL )
00465         {
00466                 create2Dcontours(point,vol);//AQUI
00467         //      filterSignal(vol);
00468                 
00469         }
00470 
00471         return quantContours[point]->getSize();
00472 }

Here is the call graph for this function:

int marAxisCT::getContourType ( int  point,
int  index,
kVolume *  vol 
)

Definition at line 475 of file marAxisCT.cpp.

References create2Dcontours(), and marAxis::quantContours.

Referenced by cleanContours(), generateFile(), performAND(), performUnion(), performXOR(), and searchContour().

00475                                                                     {
00476         if (quantContours[point] == NULL )
00477         {
00478                 create2Dcontours(point,vol);
00479         }
00480         
00481         return quantContours[point]->getContourType(index);
00482 
00483 }

Here is the call graph for this function:

Here is the caller graph for this function:

void marAxisCT::createEmptyContours (  ) 

Definition at line 1048 of file marAxisCT.cpp.

References marAxis::getNumberOfSplinePoints(), marAxis::lumenContour, and marAxis::quantContours.

01048                                    {
01049 
01050         int nCnts = ( int ) getNumberOfSplinePoints( );
01051         
01052 
01053         for (int i = 0; i < nCnts; i++)
01054         {
01055                 quantContours.push_back( NULL );
01056                 lumenContour.push_back( NULL);
01057         }
01058 }

Here is the call graph for this function:

void marAxisCT::eraseContours (  ) 

Definition at line 1141 of file marAxisCT.cpp.

References marAxis::lumenContour, marAxis::quantContours, and marAxis::vesselPoints.

01142 {
01143 
01144         
01145                 int nCts = quantContours.size();
01146                 vesselPoints.clear();
01147 
01148                 int i = 0;
01149 
01150                 while (i < nCts)
01151                 {
01152                         delete quantContours[i];
01153                         quantContours[i] = NULL;
01154                         lumenContour[i] = NULL;
01155                         i++;
01156                 }
01157                 quantContours.clear();
01158                 lumenContour.clear();
01159 
01160         
01161 }

void marAxisCT::eraseContoursPartial ( int  start  ) 

Definition at line 1164 of file marAxisCT.cpp.

References marAxis::lumenContour, and marAxis::quantContours.

01165 {
01166 
01167         int nCts = 0;
01168         int i = start;
01169 
01170         while (i >= nCts)
01171         {
01172                 delete quantContours[i];
01173                 quantContours[i] = NULL;
01174                 lumenContour[i] = NULL;
01175                 i--;
01176         }
01177         quantContours.clear();
01178         lumenContour.clear();
01179 
01180         //TODO Revisar esto que no me convence
01181 }

void marAxisCT::histogram ( int  point,
kVolume *  vol 
)

Definition at line 1649 of file marAxisCT.cpp.

References marObject::getParameters(), marAxis::getSlice(), parsePolyDataToMarIsocontour(), pointInPolygon(), searchContour(), searchData(), updateLumenPercentage(), and marAxisContours::WALL.

01650 {
01651 
01652         vtkImageData* imagedata;
01653         int limInfX, limInfY, limInfZ;
01654         int limSupX, limSupY, limSupZ;
01655         int pos;
01656         
01657         
01658         FILE *archivo;
01659         char nomArchivo[30],temp[3];
01660         marContourVO* wallCont = searchContour(marAxisContours::WALL,point);
01661         
01662                 
01663 //      for (int point = 0; point <  quantContours.size(); point++)
01664 //      {
01665                 imagedata = (vtkImageData*) ((getSlice( point , vol ))->castVtk( ));
01666                 imagedata->GetExtent(limInfX,limSupX,limInfY,limSupY,limInfZ,limSupZ);
01667                 ((marParameters *) getParameters())->setLumenPercentage(86);
01668                 updateLumenPercentage(point,vol);
01669                 marIsocontour* contExt = parsePolyDataToMarIsocontour(wallCont);
01670 
01671                 std::vector<double> intensity;
01672                 std::vector<int> frecuencies;
01673             
01674                 for (int i = 0; i < limSupX; i++)
01675                 {
01676                         for (int j = 0; j < limSupY; j++)
01677                         {
01678                                 if(pointInPolygon(contExt,i,j))
01679                                 {
01680                                         
01681                                         pos = searchData(intensity,imagedata->GetScalarComponentAsDouble(i,j,0,0));
01682                                         if (pos == -1)
01683                                         {
01684                                                 intensity.push_back( imagedata->GetScalarComponentAsDouble(i,j,0,0));
01685                                                 frecuencies.push_back(1);
01686                                         
01687                                                 
01688                                         }
01689                                         else
01690                                         {
01691                                                 frecuencies[pos]++;
01692                                         }
01693                                 }
01694                                 
01695                         }
01696                 }
01697                         
01698                 strcpy(nomArchivo,"./histogram");
01699 
01700 // EED 06/06/2007 linux
01701 //              itoa(point,temp,10);
01702                 sprintf(temp,"%d",point);
01703 
01704                 strcat(nomArchivo,temp);
01705                 strcat(nomArchivo,".csv");
01706                 
01707                 
01708 
01709                 archivo = fopen(nomArchivo,"w");
01710                 for (int k = 0; k < frecuencies.size(); k++)
01711                 {
01712 
01713                         fprintf(archivo,"%f;%d\n",intensity[k],frecuencies[k]);
01714 
01715                 }
01716                 fclose(archivo);
01717                 
01718         
01719                 
01720 
01721                 //imagedata->Delete();
01722                 delete contExt;
01723 //      }
01724 
01725 }

Here is the call graph for this function:

void marAxisCT::setCalibration ( bool  calib  ) 

Definition at line 1746 of file marAxisCT.cpp.

References marAxis::calibration.

01747 {
01748         calibration = calib;
01749 }

bool marAxisCT::getCalibration (  ) 

Definition at line 1752 of file marAxisCT.cpp.

References marAxis::calibration.

01753 {
01754         return calibration;
01755 }

int marAxisCT::getStartIndex (  ) 

Definition at line 1911 of file marAxisCT.cpp.

References startIndex.

01912 {
01913         return startIndex;
01914 }

void marAxisCT::setStartIndex ( int  start  ) 

Definition at line 1917 of file marAxisCT.cpp.

References marObject::getParameters(), maxSignal, marAxis::quantContours, and startIndex.

01918 {
01919         startIndex = start;
01920 
01921         int per = ((marParameters *) getParameters())->getLumenPercentage();
01922         double oldValue = quantContours[start]->getContour(0)->getSignal()*per*pow(10.0,-2.0);
01923 
01924         maxSignal = oldValue; // / (per*pow(10.0,-2.0));
01925 }

Here is the call graph for this function:

int marAxisCT::getPointSize (  ) 

Definition at line 1928 of file marAxisCT.cpp.

References marAxis::vesselPoints.

01929 {
01930         return vesselPoints.size();
01931 }

marPoint * marAxisCT::getPoint ( int  i  ) 

Definition at line 1934 of file marAxisCT.cpp.

References marAxis::vesselPoints.

01935 {
01936         return vesselPoints[i];
01937 }

void marAxisCT::markUpLumen ( int  point,
kVolume *  vol 
)

Definition at line 1321 of file marAxisCT.cpp.

References marAxisContours::ELUMEN, extractLumen(), getContour(), marPoint::getIntensity(), marAxis::getSlice(), marAxis::lumenContour, maxSignal, parsePolyDataToMarIsocontour(), pointInPolygon(), marAxis::quantContours, searchContour(), marPoint::setIntensity(), and marAxis::vesselPoints.

Referenced by adjustContour().

01322 {
01323         
01324         marContourVO* aVO = this->searchContour(marAxisContours::ELUMEN,point);
01325 
01326         if (aVO != NULL)
01327         {
01328                 return;
01329         }
01330 
01331         int limInfX,limInfY,limInfZ,limSupX,limSupY,limSupZ;
01332         vtkImageData* imagedata;
01333         vtkImageData* erodedata;
01334         std::vector <marIsocontour* > polygons;
01335         std::vector <marPoint* > points;
01336         double average = 0, deviation = 0;
01337         vtkImageData* image = vtkImageData::New();
01338         vesselPoints.clear();
01339         
01340 
01341         imagedata = (vtkImageData*) ((getSlice( point , vol ))->castVtk( ));
01342         imagedata->GetExtent(limInfX,limSupX,limInfY,limSupY,limInfZ,limSupZ);
01343         image->SetDimensions(limSupX,limSupY,0);
01344         image->SetExtent(limInfX,limSupX,limInfY,limSupY,limInfZ,limSupZ);
01345         image->SetScalarTypeToUnsignedShort();
01346         image->AllocateScalars();
01347         image->Update();
01348         
01349         vtkImageThreshold *imageThreshold = vtkImageThreshold::New();
01350         imageThreshold->SetInput(imagedata);
01351         imageThreshold->ThresholdByUpper(maxSignal);
01352         imageThreshold->SetInValue(255);
01353         imageThreshold->SetOutValue(0.0);
01354         imageThreshold->Update();
01355 
01356         vtkImageContinuousErode3D *imageErode3D = vtkImageContinuousErode3D::New();
01357         imageErode3D->SetInput(imageThreshold->GetOutput());
01358         imageErode3D->SetKernelSize(4,4,1);
01359         imageErode3D->Update();
01360         erodedata = imageErode3D->GetOutput();
01361 
01362 //      polygons.push_back(contExt);
01363         for (int i = 0; i < quantContours[point]->getSize(); i++)
01364         {
01365                 polygons.push_back(parsePolyDataToMarIsocontour(quantContours[point]->getContour(i)));
01366         }
01367         
01368         //7- Wipe image to detect lumen
01369         
01370         int x;
01371         for (x = limInfX + 30; x < (limSupX - 1); x++)
01372         {
01373                 
01374                 for (int y = limInfY; y < (limSupY - 1) ; y++)
01375                 {
01376                         bool inWall = false;
01377                         bool outCalc = true;
01378                         
01379                         for (int numConts = 0; numConts < polygons.size(); numConts++)
01380                         {
01381                                 if (pointInPolygon(polygons[numConts],x,y) && erodedata->GetScalarComponentAsDouble(x,y,0,0) > 0)
01382                                 {
01383                                         if (numConts == 0)
01384                                         {
01385                                                 inWall = true;
01386                                         }
01387                                 
01388                                         else 
01389                                         {
01390                                                 outCalc = false;
01391                                         }
01392                                         
01393                                 }
01394                                 
01395                         }
01396 
01397                         if (inWall && outCalc)
01398                         {
01399                                 marPoint *p = new marPoint(x,y);
01400                                 p->setIntensity(imagedata->GetScalarComponentAsDouble(x,y,0,0));
01401                                 average += p->getIntensity();
01402                                 points.push_back(p);
01403                         }
01404 
01405                 /*      if (cont >= (limSupY - limSupX))
01406                         {
01407                                 contin = false;
01408                         }*/
01409                 }
01410         }
01411         
01412         if (points.size() > 0)
01413         {
01414                 average = average / points.size();
01415                 for (int k = 0; k < points.size(); k++)
01416                 {
01417                         marPoint *p = points[k];
01418                         double actualInt = p->getIntensity();
01419                         double temp = average - actualInt;
01420                         deviation += pow(temp,2.0);
01421                 }
01422                 deviation = sqrt(deviation / points.size());
01423 
01424         }
01425 
01426 
01427         polygons.push_back(lumenContour[point]);
01428 
01429 
01430         for (x = limInfX; x < (limSupX - 1); x++)
01431         {
01432                 for (int y = limInfY; y < (limSupY - 1); y++)
01433                 {
01434                         bool inWall = false;
01435                         bool outCalc = true;
01436                         bool inLumen = false;
01437                         unsigned short *refValue = (unsigned short *) image->GetScalarPointer(x,y,0);
01438                         *refValue = 0;
01439 
01440                         for (int numConts = 0; numConts < polygons.size(); numConts++)
01441                         {
01442                                 bool adentro = pointInPolygon(polygons[numConts],x,y);
01443                                 if (pointInPolygon(polygons[numConts],x,y) && erodedata->GetScalarComponentAsDouble(x,y,0,0) > 0)
01444                                 {
01445                                         if (numConts == 0)
01446                                         {
01447                                                 inWall = true;
01448                                         }
01449                                         else if (numConts == polygons.size() - 1)
01450                                         {
01451                                                 inLumen = true;
01452                                                 
01453                                         }
01454                                         else
01455                                         {
01456                                                 outCalc = false;
01457                                         }
01458                                 }
01459                         }
01460 
01461                         double intensidad = imagedata->GetScalarComponentAsDouble(x,y,0,0);
01462                         
01463                         if (inWall && outCalc && inLumen)
01464                         {
01465 
01466                                 if (imagedata->GetScalarComponentAsDouble(x,y,0,0) > (average - 1.5*deviation)
01467                                          && imagedata->GetScalarComponentAsDouble(x,y,0,0) < (average + 2.5*deviation))
01468                                 {
01469                                         *refValue = 255;                
01470                                 }
01471                         
01472                         }
01473 
01474                 }
01475         }
01476 
01477         
01478 
01479         extractLumen(image,lumenContour[point],point);
01480         
01481 //      fclose(archivo);
01482 }

Here is the call graph for this function:

Here is the caller graph for this function:

void marAxisCT::generateFile ( int  point,
kVolume *  vol 
)

Definition at line 2092 of file marAxisCT.cpp.

References getContour(), getContourType(), marIsocontour::getPoint(), marIsocontour::getSize(), marAxis::getSliceImage(), parsePolyDataToMarIsocontour(), marAxis::quantContours, and marRAW2Files::saveVolume().

02093 {
02094         FILE *archivo;
02095         char nomArchivo[30], temp[3];
02096 
02097         strcpy(nomArchivo,"./point");
02098 
02099 // EED 06/06/2007 linux
02100 //      itoa(point,temp,10);
02101         sprintf(temp,"%d",point);
02102 
02103         strcat(nomArchivo,temp);
02104         strcat(nomArchivo,".txt");
02105         archivo = fopen(nomArchivo,"w");
02106 
02107         fprintf(archivo, "%d", quantContours[point]->getSize());
02108 
02109         int i;
02110         for (i = 0; i < quantContours[point]->getSize(); i++)
02111         {
02112                 marIsocontour* iso =parsePolyDataToMarIsocontour(quantContours[point]->getContour(i));
02113                 fprintf(archivo, " %d",iso->getSize());
02114                 
02115         }
02116         fprintf(archivo,"\n");
02117 
02118         for ( i = 0; i < quantContours[point]->getSize(); i++)
02119         {
02120                 marIsocontour* iso =parsePolyDataToMarIsocontour(quantContours[point]->getContour(i));
02121                 fprintf(archivo,"Tipo: %d\n",quantContours[point]->getContourType(i));
02122                 for (int j = 0; j < iso->getSize(); j++)
02123                 {
02124                         double tempX, tempY;
02125                         iso->getPoint(j,&tempX,&tempY); 
02126                         fprintf(archivo,"%f;%f;%d\n",tempX,tempY,point);
02127                 }
02128         }
02129 
02130 // EED 30 Janvier 2007
02131         vtkImageData *vtkimagedata = this->getSliceImage(point,vol);
02132 
02133         std::string directory = "./";
02134         std::string filename  = "xx";
02135         float rescalaSlope           =  1;
02136         float rescalaIntercept       =  0;
02137         int dim[3];
02138         vtkimagedata->GetDimensions(dim);
02139         int voi[6];
02140         voi[0]=0;
02141         voi[1]=dim[0];
02142         voi[2]=0;
02143         voi[3]=dim[1];
02144         voi[4]=0;
02145         voi[5]=dim[2];
02146         marRAW2Files marraw2;
02147         marraw2.saveVolume(directory,filename,vtkimagedata,voi,rescalaSlope,rescalaIntercept);
02148 
02149 
02150 
02151         fclose(archivo);
02152 
02153 }

Here is the call graph for this function:

void marAxisCT::cleanContours ( int  type,
int  point 
)

Definition at line 2190 of file marAxisCT.cpp.

References marAxisContours::addContour(), getContour(), getContourType(), and marAxis::quantContours.

02191 {
02192         marAxisContours* newContours = new marAxisContours();
02193         if (quantContours[point] != NULL)
02194         {
02195                 for (int i = 0; i < quantContours[point]->getSize(); i++)
02196                 {
02197                         if (quantContours[point]->getContourType(i) != type)
02198                         {
02199                                 newContours->addContour(quantContours[point]->getContour(i));
02200                         }
02201                         else
02202                         {
02203                         /*      marContourVO* vo = quantContours[point]->getContour(i);
02204                                 vo->set2DContour(NULL);
02205                                 newContours->replaceContour(vo,i);*/
02206                         }
02207                 }
02208         }
02209 
02210         quantContours[point] = newContours;
02211 }

Here is the call graph for this function:

double marAxisCT::performXOR ( int  type,
int  point,
std::vector< marIsocontour * >  manual,
kVolume *  vol 
)

Definition at line 2230 of file marAxisCT.cpp.

References getContour(), getContourType(), marAxis::getSlice(), parsePolyDataToMarIsocontour(), pointInPolygon(), and marAxis::quantContours.

02231 {
02232         if (manual.size() == 0)
02233         {
02234                 return 0;
02235         }
02236 
02237         int limInfX,limInfY,limInfZ,limSupX,limSupY,limSupZ;
02238         std::vector <marIsocontour* > polygons;
02239         vtkImageData* imagedata;
02240 
02241         imagedata = (vtkImageData*) ((getSlice( point , vol ))->castVtk( ));
02242         imagedata->GetExtent(limInfX,limSupX,limInfY,limSupY,limInfZ,limSupZ);
02243         vtkImageData* imageA = vtkImageData::New();
02244         imageA->SetDimensions(limSupX,limSupY,0);
02245         imageA->SetExtent(limInfX,limSupX,limInfY,limSupY,limInfZ,limSupZ);
02246         imageA->SetScalarTypeToUnsignedShort();
02247         imageA->AllocateScalars();
02248         imageA->Update();
02249 
02250         vtkImageData* imageM = vtkImageData::New();
02251         imageM->SetDimensions(limSupX,limSupY,0);
02252         imageM->SetExtent(limInfX,limSupX,limInfY,limSupY,limInfZ,limSupZ);
02253         imageM->SetScalarTypeToUnsignedShort();
02254         imageM->AllocateScalars();
02255         imageM->Update();
02256 
02257         
02258         for (int i = 0; i < quantContours[point]->getSize(); i++)
02259         {
02260                 if (quantContours[point]->getContourType(i) == type)
02261                 {
02262                         polygons.push_back(parsePolyDataToMarIsocontour(quantContours[point]->getContour(i)));
02263                 }
02264                 
02265         }
02266 
02267         if (polygons.size() == 0)
02268         {
02269                 return 0;
02270         }
02271         int x,y;
02272         for (x = limInfX; x < (limSupX - 1); x++)
02273         {
02274                 for (y = limInfY; y < (limSupY - 1); y++)
02275                 {
02276                         unsigned short *refValueA = (unsigned short *) imageA->GetScalarPointer(x,y,0);
02277                         unsigned short *refValueM = (unsigned short *) imageM->GetScalarPointer(x,y,0);
02278                         *refValueA = 0;
02279                         *refValueM = 0;
02280 
02281                         int numConts;
02282                         for (numConts = 0; numConts < polygons.size(); numConts++)
02283                         {
02284                                 if (pointInPolygon(polygons[numConts],x,y))
02285                                 {
02286                                                 *refValueA = 255;
02287                                 }
02288                         }
02289 
02290                         for (numConts = 0; numConts < manual.size(); numConts++)
02291                         {
02292                                 if (pointInPolygon(manual[numConts],x,y))
02293                                 {
02294                                                 *refValueM = 255;
02295                                 }
02296                         }
02297                 }
02298         }
02299 
02300 /*      vtkImageLogic* xor = vtkImageLogic::New();
02301         xor->SetInput1(imageM);
02302         xor->SetInput2(imageA);
02303         xor->SetOutputTrueValue(255);
02304         xor->SetOperationToXor();
02305 
02306         vtkImageCast* cast = vtkImageCast::New();
02307         cast->SetInput(xor->GetOutput());
02308         cast->SetOutputScalarTypeToDouble();
02309 */
02310         int coincidencias = 0;
02311         for (x = limInfX; x < (limSupX - 1); x++)
02312         {
02313                 for (y = limInfY; y < (limSupY - 1); y++)
02314                 {
02315                         int compA = (int) imageA->GetScalarComponentAsDouble(x,y,0,0);
02316                         int compM = (int) imageM->GetScalarComponentAsDouble(x,y,0,0);
02317 
02318                         int xor_ = compA^compM;
02319                         if (xor_ == 255)
02320                         {
02321                                 coincidencias++;
02322                         }
02323                 }
02324         }
02325 
02326         double resp = (double)coincidencias ;
02327 
02328         return resp;
02329 
02330 }

Here is the call graph for this function:

double marAxisCT::performAND ( int  type,
int  point,
std::vector< marIsocontour * >  manual,
kVolume *  vol 
)

Definition at line 2333 of file marAxisCT.cpp.

References getContour(), getContourType(), marAxis::getSlice(), parsePolyDataToMarIsocontour(), pointInPolygon(), and marAxis::quantContours.

02334 {
02335 
02336         if (manual.size() == 0)
02337         {
02338                 return 0;
02339         }
02340 
02341         int limInfX,limInfY,limInfZ,limSupX,limSupY,limSupZ;
02342         std::vector <marIsocontour* > polygons;
02343         vtkImageData* imagedata;
02344 
02345         imagedata = (vtkImageData*) ((getSlice( point , vol ))->castVtk( ));
02346         imagedata->GetExtent(limInfX,limSupX,limInfY,limSupY,limInfZ,limSupZ);
02347         vtkImageData* imageA = vtkImageData::New();
02348         imageA->SetDimensions(limSupX,limSupY,0);
02349         imageA->SetExtent(limInfX,limSupX,limInfY,limSupY,limInfZ,limSupZ);
02350         imageA->SetScalarTypeToUnsignedShort();
02351         imageA->AllocateScalars();
02352         imageA->Update();
02353 
02354         vtkImageData* imageM = vtkImageData::New();
02355         imageM->SetDimensions(limSupX,limSupY,0);
02356         imageM->SetExtent(limInfX,limSupX,limInfY,limSupY,limInfZ,limSupZ);
02357         imageM->SetScalarTypeToUnsignedShort();
02358         imageM->AllocateScalars();
02359         imageM->Update();
02360 
02361         for (int i = 0; i < quantContours[point]->getSize(); i++)
02362         {
02363                 if (quantContours[point]->getContourType(i) == type)
02364                 {
02365                         polygons.push_back(parsePolyDataToMarIsocontour(quantContours[point]->getContour(i)));
02366                 }
02367                 
02368         }
02369 
02370         if (polygons.size() == 0)
02371         {
02372                 return 0;
02373         }
02374 
02375         int x,y;
02376         for (x = limInfX; x < (limSupX - 1); x++)
02377         {
02378                 for (y = limInfY; y < (limSupY - 1); y++)
02379                 {
02380                         unsigned short *refValueA = (unsigned short *) imageA->GetScalarPointer(x,y,0);
02381                         unsigned short *refValueM = (unsigned short *) imageM->GetScalarPointer(x,y,0);
02382                         *refValueA = 0;
02383                         *refValueM = 0;
02384 
02385                         int numConts;
02386                         for (numConts = 0; numConts < polygons.size(); numConts++)
02387                         {
02388                                 if (pointInPolygon(polygons[numConts],x,y))
02389                                 {
02390                                                 *refValueA = 255;
02391                                 }
02392                         }
02393 
02394                         for (numConts = 0; numConts < manual.size(); numConts++)
02395                         {
02396                                 if (pointInPolygon(manual[numConts],x,y))
02397                                 {
02398                                                 *refValueM = 255;
02399                                 }
02400                         }
02401                 }
02402         }
02403 
02404 /*      vtkImageLogic* and = vtkImageLogic::New();
02405         and->SetInput1(imageM);
02406         and->SetInput2(imageA);
02407         and->SetOutputTrueValue(255);
02408         and->SetOperationToAnd();
02409 */
02410         int coincidencias = 0;
02411         for (x = limInfX; x < (limSupX - 1); x++)
02412         {
02413                 for (y = limInfY; y < (limSupY - 1); y++)
02414                 {
02415                         int compA = (int) imageA->GetScalarComponentAsDouble(x,y,0,0);
02416                         int compM = (int) imageM->GetScalarComponentAsDouble(x,y,0,0);
02417 
02418                         int and_ = compA & compM;
02419                         if (and_ == 255)
02420                         {
02421                                 coincidencias++;
02422                         }
02423                 }
02424         }
02425 
02426         double resp = (double)coincidencias ;
02427 
02428 
02429         return resp;
02430 }

Here is the call graph for this function:

double marAxisCT::performUnion ( int  type,
int  point,
std::vector< marIsocontour * >  manual,
kVolume *  vol 
)

Definition at line 2446 of file marAxisCT.cpp.

References getContour(), getContourType(), marAxis::getSlice(), parsePolyDataToMarIsocontour(), pointInPolygon(), and marAxis::quantContours.

02447 {
02448                 if (manual.size() == 0)
02449         {
02450                 return 0;
02451         }
02452 
02453         int limInfX,limInfY,limInfZ,limSupX,limSupY,limSupZ;
02454         std::vector <marIsocontour* > polygons;
02455         vtkImageData* imagedata;
02456 
02457         imagedata = (vtkImageData*) ((getSlice( point , vol ))->castVtk( ));
02458         imagedata->GetExtent(limInfX,limSupX,limInfY,limSupY,limInfZ,limSupZ);
02459         vtkImageData* imageA = vtkImageData::New();
02460         imageA->SetDimensions(limSupX,limSupY,0);
02461         imageA->SetExtent(limInfX,limSupX,limInfY,limSupY,limInfZ,limSupZ);
02462         imageA->SetScalarTypeToUnsignedShort();
02463         imageA->AllocateScalars();
02464         imageA->Update();
02465 
02466         vtkImageData* imageM = vtkImageData::New();
02467         imageM->SetDimensions(limSupX,limSupY,0);
02468         imageM->SetExtent(limInfX,limSupX,limInfY,limSupY,limInfZ,limSupZ);
02469         imageM->SetScalarTypeToUnsignedShort();
02470         imageM->AllocateScalars();
02471         imageM->Update();
02472 
02473         int i;
02474         for (i = 0; i < quantContours[point]->getSize(); i++)
02475         {
02476                 if (quantContours[point]->getContourType(i) == type)
02477                 {
02478                         polygons.push_back(parsePolyDataToMarIsocontour(quantContours[point]->getContour(i)));
02479                 }
02480                 
02481         }
02482 
02483         if (polygons.size() == 0)
02484         {
02485                 return 0;
02486         }
02487 
02488         int x,y;
02489         for ( x = limInfX; x < (limSupX - 1); x++)
02490         {
02491                 for ( y = limInfY; y < (limSupY - 1); y++)
02492                 {
02493                         unsigned short *refValueA = (unsigned short *) imageA->GetScalarPointer(x,y,0);
02494                         unsigned short *refValueM = (unsigned short *) imageM->GetScalarPointer(x,y,0);
02495                         *refValueA = 0;
02496                         *refValueM = 0;
02497                         int  numConts; 
02498                         for ( numConts = 0; numConts < polygons.size(); numConts++)
02499                         {
02500                                 if (pointInPolygon(polygons[numConts],x,y))
02501                                 {
02502                                                 *refValueA = 255;
02503                                 }
02504                         }
02505 
02506                         for (numConts = 0; numConts < manual.size(); numConts++)
02507                         {
02508                                 if (pointInPolygon(manual[numConts],x,y))
02509                                 {
02510                                                 *refValueM = 255;
02511                                 }
02512                         }
02513                 }
02514         }
02515 
02516 /*      vtkImageLogic* and = vtkImageLogic::New();
02517         and->SetInput1(imageM);
02518         and->SetInput2(imageA);
02519         and->SetOutputTrueValue(255);
02520         and->SetOperationToAnd();
02521 */
02522         int coincidencias = 0;
02523         for (x = limInfX; x < (limSupX - 1); x++)
02524         {
02525                 for ( y = limInfY; y < (limSupY - 1); y++)
02526                 {
02527                         int compA = (int) imageA->GetScalarComponentAsDouble(x,y,0,0);
02528                         int compM = (int) imageM->GetScalarComponentAsDouble(x,y,0,0);
02529 
02530                         int or_ = compA | compM;
02531                         if (or_ == 255)
02532                         {
02533                                 coincidencias++;
02534                         }
02535                 }
02536         }
02537 
02538         double resp = (double)coincidencias;
02539 
02540 
02541         return resp;
02542 }

Here is the call graph for this function:

marIsocontour * marAxisCT::loadMarIsocontour ( int  size,
double *  vx,
double *  vy 
)

Definition at line 2433 of file marAxisCT.cpp.

References marIsocontour::insertPoint().

02434 {
02435         marIsocontour* cont = new marIsocontour();
02436                 
02437         for ( int j=0 ; j<size ; j++ )
02438         {
02439                 cont->insertPoint(vx[j], vy[j]);
02440         }
02441 
02442         return cont;
02443 }

Here is the call graph for this function:

void marAxisCT::createContours ( int  point,
kVolume *  vol 
) [private]

Definition at line 107 of file marAxisCT.cpp.

References create2Dcontours(), marContourVO::get2DContour(), marContourVO::getContour(), marAxisContours::getContour(), marParameters::getDimIma(), marObject::getParameters(), marAxisContours::getSize(), marParameters::getSizeIma(), marAxis::quantContours, and marContourVO::setContour().

Referenced by create2DDiametersMax(), create2DDiametersMin(), create3Dcontours(), and getContour().

00107                                                           {
00108 
00109         int j,id;
00110         int numberOfPoints,numberOfCells;
00111         vtkCell* cell;
00112         vtkIdList* pids;
00113         double p[ 3 ];
00114         vtkPolyData* vtkPolyData_2DContour;
00115         double x,y;
00116 
00117         int sizeIma                             =       getParameters( )->getSizeIma( );
00118         double dimIma                   =       getParameters( )->getDimIma( );
00119 
00120         if (quantContours.size() < point - 1 )
00121         {
00122                 create2Dcontours(point,vol);
00123         }
00124 
00125         marAxisContours* axisCont = quantContours[point];
00126         
00127         for (int i = 0; i < axisCont->getSize(); i++)
00128         {
00129                 marContourVO* aContourVO = axisCont->getContour(i);
00130                 aContourVO->setContour(new marContour( point, getParameters( ) ));
00131                 vtkPolyData_2DContour = aContourVO->get2DContour();
00132                 numberOfCells                   =       vtkPolyData_2DContour->GetNumberOfCells( );
00133                 cell                                    =       vtkPolyData_2DContour->GetCell( 0 );
00134                 pids                                    =       cell->GetPointIds( );
00135                 numberOfPoints                  =       pids->GetNumberOfIds( );
00136                 for( j = 0; j < numberOfPoints; j++ ) 
00137                 {
00138                         id = pids->GetId( j );
00139                         vtkPolyData_2DContour->GetPoint( id, p);
00140                         x=p[0]-64.0;
00141                         y=p[1]-64.0;
00142                         x=x * dimIma / ( float ) sizeIma;
00143                         y=y * dimIma / ( float ) sizeIma;
00144                         aContourVO->getContour()->addContourPoint( x , y );
00145                 }
00146 
00147                 aContourVO->getContour()->do_spline();
00148                 aContourVO->getContour()->calculateVariables();
00149         }
00150         
00151 }

Here is the call graph for this function:

Here is the caller graph for this function:

void marAxisCT::create3Dcontours ( int  point,
kVolume *  vol 
) [private]

Definition at line 154 of file marAxisCT.cpp.

References createContours(), marContourVO::get3DContour(), marAxisContours::getContour(), getContour(), marAxis::getNormal(), marAxis::getPoints(), marAxisContours::getSize(), marAxis::quantContours, and marContourVO::set3DContour().

Referenced by get3Dcontour().

00154                                                                  {
00155         
00156         if (quantContours[point] == NULL )
00157         {
00158                 createContours(point,vol);
00159         }
00160 
00161         marAxisContours* axisCont = quantContours[point];
00162 
00163         for (int i = 0; i < axisCont->getSize(); i++)
00164         {
00165                 vtkPoints *_vtkPoints;
00166                 double *o;
00167                 double *n;
00168                 vtkMatrix4x4* mat;
00169                 vtkTransform* trans;
00170                 double nn[3];
00171                 double c[3],p1[3],p2[3];
00172                 double nA,nB,nC;
00173 
00174                 _vtkPoints                                              = vtkPoints::New();
00175                 o                                                               = getPoints(point); //PENDIENTE  _points[i];
00176                 n                                                               = getNormal( i );
00177                 mat                                                             = vtkMatrix4x4::New();
00178                 trans                                                   = vtkTransform::New();
00179 
00180 
00181                 nn[0]=n[0];  nn[1]=n[1];  nn[2]=n[2];
00182                 nC=sqrt( nn[0]*nn[0] + nn[1]*nn[1] + nn[2]*nn[2] );
00183                 nn[0]=nn[0]/nC;  nn[1]=nn[1]/nC;  nn[2]=nn[2]/nC;
00184 
00185                 vtkPlaneSource* pSource = vtkPlaneSource::New( );
00186                 pSource->SetOrigin( 0, 0        , 0                             );
00187                 pSource->SetPoint1( 1, 0        , 0                             );
00188                 pSource->SetPoint2( 0, 0        , 1.0   );
00189                 pSource->SetCenter( 0,0,0 );
00190                 pSource->SetNormal( nn[ 0 ], nn[ 1 ], nn[ 2 ] );
00191                 pSource->Update( );
00192                 pSource->Update( );
00193                 pSource->GetOrigin(c);
00194                 pSource->GetPoint1(p1);
00195                 pSource->GetPoint2(p2);
00196                 pSource->Delete();
00197                 p1[0]=p1[0]-c[0];  p1[1]=p1[1]-c[1];  p1[2]=p1[2]-c[2];
00198                 p2[0]=p2[0]-c[0];  p2[1]=p2[1]-c[1];  p2[2]=p2[2]-c[2];
00199                 nA=sqrt( p1[0]*p1[0] + p1[1]*p1[1] + p1[2]*p1[2] );
00200                 nB=sqrt( p2[0]*p2[0] + p2[1]*p2[1] + p2[2]*p2[2] );
00201                 p1[0]=p1[0]/nA;  p1[1]=p1[1]/nA;  p1[2]=p1[2]/nA;
00202                 p2[0]=p2[0]/nB;  p2[1]=p2[1]/nB;  p2[2]=p2[2]/nB;
00203 
00204                 mat->SetElement (0,0, nn[0]);
00205                 mat->SetElement (1,0, nn[1]);
00206                 mat->SetElement (2,0, nn[2]);
00207                 mat->SetElement (3,0, 0);
00208                 mat->SetElement (0,1, p2[0]);
00209                 mat->SetElement (1,1, p2[1]);
00210                 mat->SetElement (2,1, p2[2]);
00211                 mat->SetElement (3,1, 0);
00212                 mat->SetElement (0,2, p1[0]);
00213                 mat->SetElement (1,2, p1[1]);
00214                 mat->SetElement (2,2, p1[2]);
00215                 mat->SetElement (3,2, 0);
00216                 mat->SetElement (0,3, 0);
00217                 mat->SetElement (1,3, 0);
00218                 mat->SetElement (2,3, 0);
00219                 mat->SetElement (3,3, 1);
00220 
00221                 double deter=mat->Determinant(mat);
00222                 trans->Identity();
00223                 trans->SetMatrix(mat);
00224                 float ang;
00225                 ang=-90;
00226                 trans->RotateWXYZ  ( ang,0,1,0); 
00227                 trans->Update();
00228 
00229                 vtkMatrix4x4 *m=vtkMatrix4x4::New();
00230                 trans->GetMatrix  (  m  );
00231     
00232                 int j,numberOfPoints;
00233 
00234                 marContour* contour2D   = getContour(point,vol,i);
00235                 marContourVO* aContourVO = axisCont->getContour(i);
00236                 numberOfPoints                  = contour2D->getNumberOfPoints( );
00237                 double fpA[3];
00238                 double pA[3],ppp[3];
00239 
00240                 for( j = 0; j <= numberOfPoints; j++ ) {
00241                         contour2D->getPoint( fpA,j % numberOfPoints);
00242                         pA[0]=fpA[0];
00243                         pA[1]=fpA[1];
00244                         pA[2]=0;
00245 
00246                         ppp[0] = m->GetElement(0,0)*pA[0] + m->GetElement(0,1)*pA[1] + m->GetElement(0,2)*pA[2] + m->GetElement(0,3);
00247                         ppp[1] = m->GetElement(1,0)*pA[0] + m->GetElement(1,1)*pA[1] + m->GetElement(1,2)*pA[2] + m->GetElement(1,3);
00248                         ppp[2] = m->GetElement(2,0)*pA[0] + m->GetElement(2,1)*pA[1] + m->GetElement(2,2)*pA[2] + m->GetElement(2,3);
00249 
00250                         ppp[0]=ppp[0]+o[0]-c[0]; ppp[1]=ppp[1]+o[1]-c[1]; ppp[2]=ppp[2]+o[2]-c[2];  
00251                         _vtkPoints->InsertNextPoint( (float)ppp[0],(float)ppp[1],(float)ppp[2] );
00252 
00253                 
00254                 }
00255 
00256         
00257                 m->Delete();
00258                 mat->Delete();
00259                 trans->Delete();
00260 
00261                 if (aContourVO->get3DContour()!=NULL){ aContourVO->get3DContour()->Delete(); }
00262                         aContourVO->set3DContour(_vtkPoints);
00263         
00264         }
00265 
00266 
00267         
00268         
00269 }

Here is the call graph for this function:

Here is the caller graph for this function:

void marAxisCT::create2Dcontours ( int  point,
kVolume *  vol 
) [private]

Definition at line 272 of file marAxisCT.cpp.

References marAxisContours::addContour(), adjustContour(), adjustWall(), marAxis::calibration, generatePoints(), marContourVO::get2DContour(), marIsocontour::getCG(), marContourVO::getIsocontour(), marContourVO::getIsocontourCpd(), marContourVO::getIsocontourCpd2(), marContourVO::getIsocontourDcf(), marContourVO::getIsocontourStripped(), marIsocontour::getMaxIntensity(), marAxis::getSlice(), marIsocontour::getType(), marAxisContours::LUMEN, marAxis::quantContours, marContourVO::set2DContour(), marContourVO::setIsocontour(), marContourVO::setIsocontourCpd(), marContourVO::setIsocontourCpd2(), marContourVO::setIsocontourDcf(), marContourVO::setIsocontourStripped(), marContourVO::setSignal(), marContourVO::setType(), startIndex, updateCalcPercentage(), updateLumenPercentage(), and marAxisContours::WALL.

Referenced by adjustContour(), createContours(), createSignals(), get2Dcontour(), getContourType(), getNumberOfContours(), updateCalcPercentage(), and updateLumenPercentage().

00272                                                                  {
00273         std::vector <marIsocontour *> contours;
00274 
00275         
00276 
00277         generatePoints(point,vol,&contours);
00278         
00279         vtkImageData* imagedata = (vtkImageData*) ((getSlice( point , vol ))->castVtk( ));
00280         marAxisContours* axisCont = new marAxisContours();
00281 
00282         for (int i = 0; i < contours.size(); i++)
00283         {
00284                 marContourVO* contourVO = new marContourVO();
00285                 marIsocontour* iso = contours[i];
00286         
00287                 contourVO->setIsocontour(vtkContourFilter::New());
00288                 contourVO->getIsocontour()->SetInput( imagedata );
00289                 contourVO->getIsocontour()->SetNumberOfContours( 1 );
00290                 contourVO->getIsocontour()->SetValue( 0, iso->getMaxIntensity() );      
00291                 contourVO->getIsocontour()->Update( );
00292                 
00293                 contourVO->setIsocontourCpd(vtkCleanPolyData::New());
00294                 contourVO->getIsocontourCpd()->SetInput( contourVO->getIsocontour()->GetOutput( ) );
00295                 contourVO->getIsocontourCpd()->ConvertLinesToPointsOff( );
00296                 contourVO->getIsocontourCpd()->Update( );
00297 
00298                 double cgx, cgy;
00299 
00300                 iso->getCG(&cgx,&cgy);
00301                 
00302                 contourVO->setIsocontourDcf(vtkPolyDataConnectivityFilter::New( ));
00303                 contourVO->getIsocontourDcf()->SetInput( contourVO->getIsocontourCpd()->GetOutput( ) );
00304                 
00305                 contourVO->getIsocontourDcf()->SetClosestPoint( cgx, cgy, 0 );
00306                 contourVO->getIsocontourDcf()->SetExtractionModeToClosestPointRegion( );
00307                 contourVO->getIsocontourDcf()->Update( );
00308                 
00309                 contourVO->setIsocontourCpd2(vtkCleanPolyData::New());
00310                 contourVO->getIsocontourCpd2()->SetInput( contourVO->getIsocontourDcf()->GetOutput( ) );
00311                 contourVO->getIsocontourCpd2()->Update();
00312 
00313                 contourVO->setIsocontourStripped(vtkStripper::New( ));
00314                 contourVO->getIsocontourStripped()->SetInput( contourVO->getIsocontourCpd2()->GetOutput() );
00315                 contourVO->getIsocontourStripped()->Update();
00316         
00317                 contourVO->set2DContour(contourVO->getIsocontourStripped()->GetOutput());
00318                 contourVO->get2DContour()->Update();
00319                 contourVO->setSignal(iso->getMaxIntensity());
00320                 
00321                 if (iso->getType() == marAxisContours::LUMEN)
00322                 {
00323                         contourVO->setType(marAxisContours::WALL);
00324                 }
00325                 else
00326                 {
00327                         contourVO->setType(iso->getType());
00328                 }
00329                 
00330                 
00331                 
00332                 axisCont->addContour(contourVO);
00333 
00334                 
00335                 delete iso;
00336                 contours[i] = NULL;
00337         }
00338 
00339         
00340 
00341         quantContours[point] = axisCont;
00342         
00343 
00344 
00345         updateLumenPercentage(point,vol);
00346         
00347         updateCalcPercentage(point,vol);
00348 //      adjustWall(point,vol);
00349         if (calibration && point < startIndex)
00350         {
00351                 this->adjustContour(point,vol); 
00352         }
00353         else
00354         {
00355                 adjustWall(point,vol);
00356         }
00357         contours.clear();
00358         imagedata->Delete();
00359 
00360 
00361 //      marIsocontour* cont = parsePolyDataToMarIsocontour(quantContours[point]->getContour(0));
00362 
00363         /*FILE *archivo;
00364         char nomArchivo[30], temp[3];
00365 
00366         strcpy(nomArchivo,"./points");
00367         itoa(point,temp,10);
00368         strcat(nomArchivo,temp);
00369         strcat(nomArchivo,".csv");
00370         
00371         archivo = fopen(nomArchivo,"w");
00372         
00373         for (int h = 0; h < cont->getSize(); h++)
00374         {
00375                 double x, y;
00376                 cont->getPoint(h,&x,&y);
00377                 fprintf(archivo,"%f;%f\n",x,y);
00378         }
00379 
00380         fclose(archivo);*/
00381 }

Here is the call graph for this function:

Here is the caller graph for this function:

void marAxisCT::create2DDiametersMin ( int  point,
kVolume *  vol 
) [private]

Definition at line 384 of file marAxisCT.cpp.

References createContours(), marContourVO::get2DDiameterMin(), marAxisContours::getContour(), getContour(), marParameters::getDimIma(), marObject::getParameters(), marAxisContours::getSize(), marParameters::getSizeIma(), marAxis::quantContours, and marContourVO::set2DDiameterMin().

Referenced by get2DDiameterMin().

00384                                                                  {
00385         
00386 if (quantContours[point] == NULL )
00387         {
00388                 createContours(point,vol);
00389         }
00390 
00391         marAxisContours* axisCont = quantContours[point];
00392 
00393         for (int i = 0; i < axisCont->getSize(); i++)
00394         {
00395                 double p1[2],p2[2];
00396                 marContour *marcontour=getContour(point,vol,i);
00397                 marContourVO* aContourVO = axisCont->getContour(i);
00398 
00399                 marcontour->getMinimumLine(p1,p2);
00400                 vtkPoints *_vtkPoints = vtkPoints::New();
00401                 
00402                 int sizeIma = getParameters( )->getSizeIma( );
00403                 double dimIma = getParameters( )->getDimIma( );
00404                 double factor=( float ) sizeIma / dimIma;
00405                 
00406                 p1[0]=p1[0]*factor+sizeIma/2;
00407                 p1[1]=p1[1]*factor+sizeIma/2;
00408                 p2[0]=p2[0]*factor+sizeIma/2;
00409                 p2[1]=p2[1]*factor+sizeIma/2;
00410                 _vtkPoints->InsertNextPoint( p1[0] , p1[1] , 1 );
00411                 _vtkPoints->InsertNextPoint( p2[0] , p2[1] , 1 );
00412 
00413                 if ( aContourVO->get2DDiameterMin()!=NULL ) { aContourVO->get2DDiameterMin()->Delete(); }
00414                         aContourVO->set2DDiameterMin(_vtkPoints);
00415 
00416         }
00417 
00418 }

Here is the call graph for this function:

Here is the caller graph for this function:

void marAxisCT::create2DDiametersMax ( int  point,
kVolume *  vol 
) [private]

Definition at line 421 of file marAxisCT.cpp.

References createContours(), marContourVO::get2DDiameterMax(), marAxisContours::getContour(), getContour(), marParameters::getDimIma(), marObject::getParameters(), marAxisContours::getSize(), marParameters::getSizeIma(), marAxis::quantContours, and marContourVO::set2DDiameterMax().

Referenced by get2DDiameterMax().

00421                                                                  {
00422         if (quantContours[point] == NULL )
00423         {
00424                 createContours(point,vol);
00425         }
00426 
00427         marAxisContours* axisCont = quantContours[point];
00428 
00429         for (int i = 0; i < axisCont->getSize(); i++)
00430         {
00431                 double p1[2],p2[2];
00432                 marContour *marcontour=getContour(point,vol,i);
00433                 marContourVO* aContourVO = axisCont->getContour(i);
00434 
00435                 marcontour->getMaximumLine(p1,p2);
00436                 vtkPoints *_vtkPoints = vtkPoints::New();
00437 
00438                 int sizeIma = getParameters( )->getSizeIma( );
00439                 double dimIma = getParameters( )->getDimIma( );
00440                 double factor=( float ) sizeIma / dimIma;
00441                 p1[0]=p1[0]*factor+sizeIma/2;
00442                 p1[1]=p1[1]*factor+sizeIma/2;
00443                 p2[0]=p2[0]*factor+sizeIma/2;
00444                 p2[1]=p2[1]*factor+sizeIma/2;
00445                 _vtkPoints->InsertNextPoint( p1[0] , p1[1] , 1 );
00446                 _vtkPoints->InsertNextPoint( p2[0] , p2[1] , 1 );
00447                 
00448                 if ( aContourVO->get2DDiameterMax()!=NULL ) { aContourVO->get2DDiameterMax()->Delete(); }
00449                         aContourVO->set2DDiameterMax(_vtkPoints);
00450         }
00451 }

Here is the call graph for this function:

Here is the caller graph for this function:

void marAxisCT::createSignals ( int  point,
kVolume *  vol 
) [private]

Definition at line 454 of file marAxisCT.cpp.

References create2Dcontours(), and marAxis::quantContours.

Referenced by getSignal().

00454                                                       {
00455         if (quantContours[point] == NULL )
00456         {
00457                 create2Dcontours(point,vol); //AQUI
00458         //      filterSignal(vol);
00459         }
00460 }

Here is the call graph for this function:

Here is the caller graph for this function:

void marAxisCT::generatePoints ( int  point,
kVolume *  vol,
std::vector< marIsocontour * > *  list 
) [private]

Definition at line 486 of file marAxisCT.cpp.

References addPointToContour(), marAxisContours::CALCIFICATION, detectNeighbor(), generateVector(), getCalcStatistics(), getMaximumGrad(), getMaxIntensity(), getMinimumGrad(), marObject::getParameters(), marAxis::getPoints(), marAxis::getSlice(), getStatistics(), interpolate(), marAxisContours::LUMEN, marAxis::lumenContour, marAxis::next(), marUtils::obtainAverage(), marUtils::obtainStandardDeviation(), marPoint::setDirection(), marPoint::setGradient(), marPoint::setIntensity(), and unifyDividedStructure().

Referenced by create2Dcontours().

00486                                                                                        {
00487 
00488         vtkImageData* imagedata;
00489         int dirs = 72;
00490         double aPoint[ 3 ];
00491         double *nPoint = new double[ 3 ];
00492         double x, y, prevIntensity, threshold;
00493         bool found, estStart, estDivided, isNeighbor;
00494         int actualZone, startZone, coordBase, maxPoint, lumenCount, calcCount;
00495         std::vector <marPoint  *> gradients;
00496         std::vector <double> average;
00497         std::vector <marIsocontour *> contoursLumen;
00498         std::vector <marIsocontour *> contoursCalc;
00499 
00500         contoursLumen.push_back(NULL);
00501         contoursCalc.push_back(NULL);
00502         
00503         
00504         
00505         //1. Check starting zone
00506         startZone = marAxisContours::LUMEN;
00507         actualZone = startZone;
00508         lumenCount = 0;
00509         calcCount = 0;
00510 
00511         imagedata = (vtkImageData*) ((getSlice( point , vol ))->castVtk( ));
00512 
00513         int limInfX, limInfY, limInfZ;
00514         int limSupX, limSupY, limSupZ;
00515         imagedata->GetExtent(limInfX,limSupX,limInfY,limSupY,limInfZ,limSupZ);
00516 
00517         vtkImageCast* cast = vtkImageCast::New();
00518         cast->SetInput(imagedata);
00519         cast->SetOutputScalarTypeToDouble();
00520 
00521         vtkImageGaussianSmooth* filter = vtkImageGaussianSmooth::New();
00522         filter->SetDimensionality(2);
00523         filter->SetInput(cast->GetOutput());
00524         filter->SetStandardDeviations((getParameters())->getStandardDeviation(),(getParameters())->getStandardDeviation());
00525         filter->SetRadiusFactors((getParameters())->getRadius(),(getParameters())->getRadius());
00526         filter->SetStandardDeviations(3,3);
00527         filter->SetRadiusFactors(3,3);
00528 
00529         //imagedata = filter->GetOutput();
00530         
00531         
00532         nPoint = getPoints(point);
00533 
00534         aPoint[ 0 ]     =  (limSupX - limInfX) / 2; //nPoint[0]; 
00535         aPoint[ 1 ]     =  (limSupY - limInfY) / 2; //nPoint[1]; 
00536         aPoint[ 2 ]     =  (limSupZ - limInfZ) / 2; // nPoint[2]; 
00537         estDivided = false;
00538         estStart = false;
00539         //3. Generate rays over all directions
00540         for (int dir = 0; dir < dirs; dir++)
00541         {
00542                 
00543                 x = aPoint[ 0 ];
00544                 y = aPoint[ 1 ];
00545                 coordBase = 1;
00546                 prevIntensity = interpolate(x,y,imagedata);
00547                 generateVector(dir,&coordBase,aPoint[0],aPoint[1],&x,&y);
00548 
00549                 //2.1 Evaluate gradient in every position of the ray 
00550                 while ((x > (limInfX+1) && x < (limSupX-1)) && (y > (limInfY+1) && y < (limSupY-1)))
00551                 {
00552                         
00553                         //2.1.1 Interpolate
00554                         double resp = interpolate(x,y,imagedata);
00555                         //2.1.2 Calcultate gradient
00556                         marPoint* p = new marPoint(x,y);
00557                         p->setGradient(prevIntensity - resp);
00558                         p->setDirection(dir);
00559                         p->setIntensity(resp);
00560                         
00561                         prevIntensity = resp;
00562 
00563                         gradients.push_back(p);
00564 
00565                         //2.1.3 Increase ray for next evaluation
00566                         generateVector(dir,&coordBase,aPoint[0],aPoint[1],&x,&y);
00567 
00568                 }// end while gradient
00569 
00570                 int index = 0;
00571                 found = false;
00572                 x = aPoint[ 0 ];
00573                 y = aPoint [ 1 ];
00574                 threshold = ((marParameters *) getParameters())->getContourThresh();
00575                 int mysize = gradients.size();
00576                 
00577                 //2.2 Compare every gradient value with threshold
00578                 while (index < gradients.size() && !found)
00579                 {
00580                         //2.2.1 Evaluate Lumen
00581                         if (actualZone == marAxisContours::LUMEN)
00582                         {
00583                                 average.push_back(gradients[index]->getIntensity());
00584                                 
00585                                 //2.2.1.1 If value > threshold there is a contour
00586                                 if (fabs(gradients[index]->getGradient()) > threshold 
00587                                         && fabs(gradients[index]->getGradient()) < 4000) {
00588                                                 //|| (calibration && (abs(gradients[index]->getIntensity()) > abs(avgValue - 2.5*stdValue)
00589                                                 //|| abs(gradients[index]->getIntensity()) > abs(avgValue + 2.5*stdValue)))) {
00590 
00591                                         
00592 
00593                                         if(gradients[index]->getGradient() > 0)
00594                                                 maxPoint = getMaximumGrad(gradients,index,gradients.size(),threshold);
00595                                         else
00596                                                 maxPoint = getMinimumGrad(gradients,index,gradients.size(),threshold);
00597 
00598                                         index = maxPoint;
00599                                         x = gradients[maxPoint]->getX();
00600                                         y = gradients[maxPoint]->getY();
00601 
00602                                         //2.2.1.1.1 Assign lumen structure
00603                                         isNeighbor = detectNeighbor(contoursLumen[lumenCount],dir,marAxisContours::LUMEN);
00604                                         if (!isNeighbor)
00605                                         {
00606                                                 lumenCount++;
00607                                         }
00608                                         
00609                                         marIsocontour* cont = addPointToContour(contoursLumen[lumenCount],false,marAxisContours::LUMEN,gradients[maxPoint]);
00610                                         contoursLumen[lumenCount] = cont;
00611 
00612                                         //2.2.1.1.2 Check step lumen->calcification
00613                                         double actualInt = interpolate(x,y,imagedata);
00614                                         double auxX = x;
00615                                         double auxY = y;
00616                                         generateVector(dir,&coordBase,aPoint[0],aPoint[1],&auxX,&auxY);
00617                                     double next = interpolate(auxX,auxY,imagedata);
00618                                         if (gradients[index]->getGradient() < 0 /*&& actualInt < next */&& (auxX > (limInfX+1) && auxX < (limSupX-1)) && (auxY > (limInfY+1) && auxY < (limSupY-1)))
00619                                         {
00620                                                 //2.2.1.1.2.1 Assign calcification structure
00621                                                 isNeighbor = detectNeighbor(contoursCalc[calcCount],dir,marAxisContours::CALCIFICATION);
00622                                                 if (!isNeighbor)
00623                                                 {
00624                                                         calcCount++;
00625                                                         contoursCalc.push_back(NULL);
00626                                                 }
00627 
00628                                                 cont = addPointToContour(contoursCalc[calcCount],true,marAxisContours::CALCIFICATION,gradients[maxPoint]);
00629                                                 
00630                                                 contoursCalc[calcCount] = cont;
00631 
00632                                                 actualZone = marAxisContours::CALCIFICATION;
00633                                                 //ASIGNACION varX???
00634 
00635                                                 //2.2.1.1.2.3 Verify divided structure
00636                                                 if (dir == 0)
00637                                                 {
00638                                                         estStart = true;
00639                                                 }
00640 
00641                                                 if ((dir == dirs - 1) && estStart)
00642                                                 {
00643                                                         estDivided = true;
00644                                                 }
00645 
00646                                         }//2.2.1.1.3 Transition lumen->background
00647                                         else
00648                                         {
00649                                                 //2.2.1.1.3.1 Asign border structure
00650                                                 //ASIGNAR ESTRUCTURA
00651                                                 
00652                                                 //2.2.1.1.3.2 Generate stop condition
00653                                                 found = true;
00654                                                 actualZone = startZone;
00655                                                 coordBase = 1;
00656                                                 x = aPoint[ 0 ];
00657                                                 y = aPoint[ 1 ];
00658                                                 threshold = ((marParameters *) getParameters())->getContourThresh();
00659                                         }
00660 
00661                                 }
00662                         }
00663                         //2.2.2 Evaluate calcification (MODIFIED IF THERE IS HYPODENSE)
00664                         else
00665                         {
00666                                 coordBase = 1;
00667                                 int calcIndex;
00668                                 double actualInt = interpolate(x,y,imagedata);
00669                                 generateVector(dir,&coordBase,aPoint[0],aPoint[1],&x,&y);
00670                                 double next = interpolate(x,y,imagedata);
00671 
00672                                 //2.2.2.1 If actual intensity is smaller than previous there is a contour
00673                                 if (actualInt < next)
00674                                 {
00675                                         while (actualInt < interpolate(x,y,imagedata) && (x > (limInfX+1) && x < (limSupX-1)) && (y > (limInfY+1) && y < (limSupY-1)))
00676                                         {
00677                                                 generateVector(dir,&coordBase,aPoint[0],aPoint[1],&x,&y);
00678                                                 index++;
00679                                         }
00680 
00681                                 }
00682 
00683                                 generateVector(dir,&coordBase,aPoint[0],aPoint[1],&x,&y);
00684 
00685                                 //2.2.2.2 Assign calcification structure
00686                                 isNeighbor = detectNeighbor(contoursCalc[calcCount],dir,marAxisContours::CALCIFICATION);
00687                                 if (!isNeighbor)
00688                                 {
00689                                         calcCount++;
00690                                         contoursCalc.push_back(NULL);
00691                                 }
00692 
00693                                 //Adjust index to avoiod crash
00694                                 if (index >= gradients.size())
00695                                 {
00696                                         calcIndex = gradients.size() - 1;
00697                                 }
00698                                 else
00699                                 {
00700                                         calcIndex = index;
00701                                 }
00702 
00703                                 marIsocontour* cont = addPointToContour(contoursCalc[calcCount],false,marAxisContours::CALCIFICATION,gradients[calcIndex]);
00704                                 contoursCalc[calcCount] = cont;
00705                                 
00706                                 //2.2.2.3 Asign border structure
00707                                 //ASIGNACION BORDE
00708 
00709                                 found = true;
00710                                 actualZone = startZone;
00711                                 x = aPoint[ 0 ];
00712                                 y = aPoint[ 1 ];
00713                                 threshold = ((marParameters *) getParameters())->getContourThresh();
00714 
00715                         }//end if zones
00716 
00717                         index++;
00718 
00719                         if (index == gradients.size() && !found)
00720                         {
00721                                 threshold = threshold - 1;
00722                                 index = 0;
00723                         }
00724 
00725                 }//end while evaluation
00726 
00727                 //TODO - SACAR A UTILS
00728                 for (int ind = 0; ind < gradients.size(); ind++)
00729                 {
00730                         marPoint* p = gradients[ind];
00731                         gradients[ind] = NULL;
00732                         delete p;
00733                         
00734                 }
00735                 gradients.clear();
00736 
00737         }//end for directions
00738 
00739         FILE *archivo;
00740         char nomArchivo[30]; //, temp[3]
00741 
00742         strcpy(nomArchivo,"./debug");
00743 //      itoa(point,temp,10);
00744 //      strcat(nomArchivo,temp);
00745         strcat(nomArchivo,".txt");
00746         archivo = fopen(nomArchivo,"w");
00747         
00748   
00749 
00750 
00751         
00752 //      lumenContour[point] = contoursLumen[marAxisContours::LUMEN];
00753         
00754         double  tempXi, tempYi;
00755         int polySides = contoursLumen[marAxisContours::LUMEN]->getSize();
00756         
00757     
00758         marIsocontour* alc = new marIsocontour();
00759         for (int m=0; m<polySides; m++) {
00760                 contoursLumen[marAxisContours::LUMEN]->getPoint(m,&tempXi,&tempYi);          
00761                 alc = addPointToContour(lumenContour[point],false,marAxisContours::LUMEN,new marPoint(tempXi,tempYi));
00762                 lumenContour[point] = alc;
00763                 fprintf(archivo,"X:%f,Y:%f\n",tempXi,tempYi);
00764         }
00765         
00766 
00767         
00768         //4. Verify divided unified structure
00769         if (estDivided && calcCount > 0)
00770         {
00771                 unifyDividedStructure(&contoursCalc);
00772                 calcCount--;
00773         }   
00774         
00775         //5. Obtain statistics
00776         double lumenInt = getStatistics(contoursLumen[marAxisContours::LUMEN],aPoint[ 0 ],aPoint[ 1 ], imagedata);
00777         contoursLumen[marAxisContours::LUMEN]->setMaxIntensity(lumenInt);
00778 
00779         if (contoursCalc[0] != NULL)
00780         {
00781                 for (int i = 0; i < contoursCalc.size(); i++)
00782                 {
00783                         lumenCount++;
00784                         double maxInt = getCalcStatistics(contoursCalc[i],aPoint[ 0 ],aPoint[1],imagedata,i-1);
00785                         contoursCalc[i]->setMaxIntensity(maxInt);
00786                         contoursLumen.push_back(NULL);
00787                         contoursLumen[lumenCount] = contoursCalc[i];
00788                 }
00789         }
00790         
00791         
00792         *list = contoursLumen;
00793 
00794         contoursCalc.clear();
00795     contoursLumen.clear();
00796         marUtils* util = new marUtils();
00797         double avg = util->obtainAverage(average);
00798         //FILE *archivo;
00799         //archivo = fopen("./debug.txt","w");
00800         fprintf(archivo,"tamaño: %d umbra: %d",  (*list).size(),((marParameters *) getParameters())->getContourThresh());
00801         for (int k = 0; k < contoursLumen.size(); k++)
00802         {
00803                 double cgx, cgy;
00804 
00805                 (*list)[k]->getCG(&cgx,&cgy);
00806                 fprintf(archivo,"cx: %f cy:%f Señal: %f Type: %d\n", cgx, cgy, (*list)[k]->getMaxIntensity(), (*list)[k]->getType());
00807         }
00808 
00809         fprintf(archivo,"PROMEDIO %f - STD: %f\n",avg,util->obtainStandardDeviation(average,avg));
00810         fprintf(archivo,"%d\n",lumenContour.size());
00811         fclose(archivo);
00812         imagedata->Delete();
00813         
00814 }

Here is the call graph for this function:

Here is the caller graph for this function:

int marAxisCT::getMaximumGrad ( std::vector< marPoint * >  list,
int  iniPos,
int  limit,
double  threshold 
) [private]

Definition at line 817 of file marAxisCT.cpp.

Referenced by generatePoints().

00817                                                                                                   {
00818         
00819         double max = list[iniPos]->getGradient();
00820         int coordMax = iniPos;
00821         int cont = iniPos + 1;
00822 
00823         while (cont < limit && list[cont]->getGradient()>=threshold){
00824                 if (list[cont]->getGradient() > max){
00825                         max = list[cont]->getGradient();
00826                         coordMax = cont;
00827                 }
00828                 cont++;
00829         }
00830 
00831         return coordMax;
00832 } 

Here is the caller graph for this function:

int marAxisCT::getMinimumGrad ( std::vector< marPoint * >  list,
int  iniPos,
int  limit,
double  threshold 
) [private]

Definition at line 835 of file marAxisCT.cpp.

References min.

Referenced by generatePoints().

00835                                                                                                   {
00836         
00837         double min = list[iniPos]->getGradient();
00838         int coordMin = iniPos;
00839         int cont = iniPos + 1;
00840 
00841         while (cont < limit && fabs(list[cont]->getGradient())>=threshold){
00842                 if (list[cont]->getGradient() < min){
00843                         min = list[cont]->getGradient();
00844                         coordMin = cont;
00845                 }
00846                 cont++;
00847         }
00848 
00849         return coordMin;
00850 } 

Here is the caller graph for this function:

double marAxisCT::interpolate ( double  x,
double  y,
vtkImageData *  imagedata 
) [private]

Definition at line 853 of file marAxisCT.cpp.

Referenced by generatePoints(), getCalcStatistics(), and getStatistics().

00853                                                                          {
00854 
00855         double a,b,c,d;
00856         double intensity;
00857         int i,j;
00858 
00859         i = (int)floor(x);
00860         j = (int)floor(y);
00861 
00862         
00863         c = imagedata->GetScalarComponentAsDouble(i,j,0,0) + (double) imagedata->GetScalarComponentAsDouble(i+1,j+1,0,0)
00864                 - imagedata->GetScalarComponentAsDouble(i+1,j,0,0) - imagedata->GetScalarComponentAsDouble(i,j+1,0,0);
00865 
00866         b = imagedata->GetScalarComponentAsDouble(i,j+1,0,0) - c*i - imagedata->GetScalarComponentAsDouble(i,j,0,0);
00867 
00868         a = imagedata->GetScalarComponentAsDouble(i+1,j,0,0) - c*j - imagedata->GetScalarComponentAsDouble(i,j,0,0);
00869 
00870         d = imagedata->GetScalarComponentAsDouble(i,j,0,0) - a*i - b*j - c*i*j;
00871 
00872         intensity = a*x + b*y + c*x*y + d;
00873 
00874         return intensity;
00875 }

Here is the caller graph for this function:

void marAxisCT::generateVector ( int  dir,
int *  coordBase,
double  originX,
double  originY,
double *  x,
double *  y 
) [private]

Definition at line 878 of file marAxisCT.cpp.

Referenced by generatePoints(), getCalcStatistics(), getDiameter(), and getStatistics().

00878                                                                                                        {
00879 
00880         int dirs = 72;
00881         int angle = (dir * (360 / dirs));
00882 
00883         *x = 1 * cos(angle *(3.1415/180)) + (*x); 
00884         *y = 1 * sin(angle *(3.1415/180)) + (*y); 
00885 
00886         (*coordBase)++; 
00887 }

Here is the caller graph for this function:

bool marAxisCT::detectNeighbor ( marIsocontour contour,
int  dir,
int  type 
) [private]

Definition at line 890 of file marAxisCT.cpp.

References marIsocontour::getDir(), marIsocontour::getSize(), and marIsocontour::getType().

Referenced by generatePoints().

00890                                                                        {
00891         
00892         bool isNeighbor = false;
00893 
00894         if (contour == NULL){
00895                 isNeighbor = true; 
00896         }else{
00897                 for (int i = 0; i < contour->getSize(); i++) {
00898                         
00899                         if (((contour->getDir(i) == (dir - 1)) || (contour->getDir(i) == dir)) 
00900                                     && (contour->getType() == type)){ 
00901                                 isNeighbor = true; 
00902                         }       
00903                 }
00904         }
00905 
00906         return isNeighbor;
00907 }

Here is the call graph for this function:

Here is the caller graph for this function:

marIsocontour * marAxisCT::addPointToContour ( marIsocontour cont,
bool  inside,
int  type,
marPoint point 
) [private]

Definition at line 910 of file marAxisCT.cpp.

References marPoint::getDirection(), marIsocontour::getSize(), marPoint::getX(), marPoint::getY(), marIsocontour::insertPoint(), marIsocontour::setDir(), marIsocontour::setInside(), and marIsocontour::setType().

Referenced by generatePoints().

00910                                                                                                       {
00911 
00912         
00913 
00914         if (cont == NULL)
00915         {
00916                 cont = new marIsocontour();
00917                 cont->setType(type);
00918         }
00919         
00920         cont->insertPoint(point->getX(),point->getY());
00921         cont->setDir(cont->getSize() - 1,point->getDirection());
00922         cont->setInside(cont->getSize() - 1,inside);
00923         
00924         return cont;
00925         
00926 }

Here is the call graph for this function:

Here is the caller graph for this function:

void marAxisCT::unifyDividedStructure ( std::vector< marIsocontour * > *  contList  )  [private]

Definition at line 929 of file marAxisCT.cpp.

References marIsocontour::getDir(), marIsocontour::getInside(), marIsocontour::getPoint(), marIsocontour::getSize(), marIsocontour::insertPoint(), marIsocontour::setDir(), and marIsocontour::setInside().

Referenced by generatePoints().

00929                                                                          {
00930 
00931         marIsocontour* structOne = (*contList)[contList->size()-1];
00932         marIsocontour* structTwo = (*contList)[0];
00933         
00934 
00935         for (int i = 0; i < structOne->getSize(); i++)
00936         {
00937                 double x;
00938                 double y;
00939                 structOne->getPoint(i,&x,&y);
00940                 structTwo->insertPoint(x,y);
00941                 structTwo->setDir(structTwo->getSize() - 1,structOne->getDir(i));
00942                 structTwo->setInside(structTwo->getSize() - 1,structOne->getInside(i));
00943 
00944         }
00945 
00946         contList->pop_back();
00947 }

Here is the call graph for this function:

Here is the caller graph for this function:

double marAxisCT::getStatistics ( marIsocontour contour,
double  x,
double  y,
vtkImageData *  imagedata 
) [private]

Definition at line 950 of file marAxisCT.cpp.

References generateVector(), marIsocontour::getDir(), marIsocontour::getPoint(), marIsocontour::getSize(), and interpolate().

Referenced by generatePoints().

00950                                                                                                    {
00951 
00952         double max, auxX, auxY;
00953         int basis;
00954         max = interpolate(x,y,imagedata);
00955 
00956         for (int i = 0; i < contour->getSize(); i++)
00957         {
00958                 basis = 1;
00959                 auxX = x;
00960                 auxY = y;
00961                 double pointX;
00962                 double pointY;
00963 
00964                 contour->getPoint(i,&pointX,&pointY);
00965                 while (auxX != pointX || auxY != pointY)
00966                 {
00967                         double intensity = interpolate(auxX,auxY,imagedata);
00968                         if (max < intensity)
00969                         {
00970                                 max = intensity;
00971                         }
00972                         generateVector(contour->getDir(i),&basis,x,y,&auxX,&auxY);
00973 
00974                 }
00975         }
00976         
00977         return max;
00978 }

Here is the call graph for this function:

Here is the caller graph for this function:

double marAxisCT::getCalcStatistics ( marIsocontour contour,
double  x,
double  y,
vtkImageData *  imagedata,
int  i 
) [private]

Definition at line 982 of file marAxisCT.cpp.

References generateVector(), marIsocontour::getDir(), marIsocontour::getPoint(), marIsocontour::getSize(), and interpolate().

Referenced by generatePoints().

00982                                                                                                                 {
00983 
00984         
00985         double max, auxX,auxY;
00986         int basis;
00987         
00988         int i;
00989         FILE *archivo;
00990         char nomArchivo[30], temp[3];
00991 
00992         strcpy(nomArchivo,"./statistics");
00993 
00994 // EED 06/06/2007 linux
00995 //      itoa(dir,temp,10);
00996         sprintf(temp,"%d",dir);
00997 
00998         strcat(nomArchivo,temp);
00999         strcat(nomArchivo,".txt");
01000 
01001 
01002         archivo = fopen(nomArchivo,"w");
01003         i = 0; 
01004         max = 0;
01005         fprintf(archivo,"TAMAÑO %d\n",contour->getSize());
01006 
01007         while (i < contour->getSize()) 
01008         {
01009                 basis = 1;
01010                 double pointX, pointY;
01011                 contour->getPoint(i+1,&pointX,&pointY);
01012                 contour->getPoint(i,&auxX,&auxY);
01013                 fprintf(archivo,"final: %f %f inicial %f %f \n",pointX,pointY,auxX,auxY);       
01014                 
01015                 while (auxX != pointX || auxY != pointY)
01016                 {
01017                         double intensity = interpolate(auxX,auxY,imagedata);
01018                         if (max < intensity){
01019                                 max = intensity;
01020                         }
01021                         generateVector(contour->getDir(i),&basis,auxX,auxY,&auxX,&auxY);
01022                 }
01023                         
01024                 i +=2;
01025         }
01026         fclose(archivo);
01027         return max;
01028 }

Here is the call graph for this function:

Here is the caller graph for this function:

int marAxisCT::round ( double  num  )  [private]

Definition at line 1031 of file marAxisCT.cpp.

01031                               {
01032 
01033         float decimal;
01034         int resp;
01035         
01036         decimal = num - floor(num) * 1.0000;
01037 
01038         if (decimal >= 0.50000)
01039                 resp = (int)ceil(num);
01040         else
01041                 resp = (int)floor(num);
01042 
01043         return resp;
01044 
01045 }

int marAxisCT::getMaxIntensity ( int  point  )  [private]

Definition at line 1120 of file marAxisCT.cpp.

References marAxisContours::CALCIFICATION, getContour(), and marAxis::quantContours.

Referenced by generatePoints(), and updateCalcPercentage().

01121 {
01122         int pos = 1; 
01123         double intMax;
01124         if (quantContours[point]->getSize() > 2)
01125         {
01126                 intMax = quantContours[point]->getContour(0)->getSignal();
01127                 for (int i = 0; i < quantContours[point]->getSize(); i++)
01128                 {
01129                         if (quantContours[point]->getContour(i)->getSignal() > intMax && quantContours[point]->getContour(i)->getType() == marAxisContours::CALCIFICATION)
01130                         {
01131                                 intMax = quantContours[point]->getContour(i)->getSignal() ;
01132                                 pos = i;
01133                         }
01134                 }
01135         }
01136 
01137         return pos;
01138         
01139 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool marAxisCT::pointInPolygon ( marIsocontour c,
double  x,
double  y 
) [private]

Definition at line 1185 of file marAxisCT.cpp.

References marIsocontour::getPoint(), and marIsocontour::getSize().

Referenced by getDiameter(), histogram(), markUpLumen(), performAND(), performUnion(), and performXOR().

01185                                                                   {
01186         int      i, j=0;
01187         bool  oddNODES=false;
01188         int polySides = c->getSize();
01189         double *polyX, *polyY, tempX, tempY;
01190 
01191         polyX = (double *) malloc(polySides*sizeof(double));
01192         polyY = (double *) malloc(polySides*sizeof(double));
01193 
01194         for (i=0; i<polySides; i++) {
01195                 c->getPoint(i,&tempX,&tempY);          
01196                 polyX[i] = tempX;
01197                 polyY[i] = tempY;
01198         }
01199 
01200         for (i=0; i<polySides; i++) {
01201                 j++; 
01202                 if (j==polySides) 
01203                         j=0;
01204                 
01205                 if (polyY[i]<y && polyY[j]>=y
01206                         ||  polyY[j]<y && polyY[i]>=y) {
01207                         if (polyX[i]+(y-polyY[i])/(polyY[j]-polyY[i])*(polyX[j]-polyX[i])<x) {
01208                                 oddNODES=!oddNODES; 
01209                         }
01210                 }
01211         }
01212 
01213         free(polyX);
01214         free(polyY);
01215   return oddNODES; 
01216 
01217 }

Here is the call graph for this function:

Here is the caller graph for this function:

marIsocontour * marAxisCT::parsePolyDataToMarIsocontour ( marContourVO contourVO  )  [private]

Definition at line 1220 of file marAxisCT.cpp.

References marContourVO::get2DContour(), marContourVO::getIsocontourStripped(), marIsocontour::insertPoint(), and marContourVO::isReplaced().

Referenced by adjustContour(), adjustWall(), extractLumen(), generateFile(), getDiameter(), histogram(), markUpLumen(), performAND(), performUnion(), and performXOR().

01220                                                                              {
01221 
01222         vtkPolyData* polyDataCnt;
01223         vtkIdList* pointsId;
01224         double* pointPolyDataCnt;
01225         int numPointsPolyDataCnt, numTemp;
01226         marIsocontour *cont;
01227 
01228         if (contourVO->isReplaced())
01229         {
01230                 polyDataCnt = contourVO->get2DContour();
01231         }
01232         else
01233         {
01234                 polyDataCnt =    contourVO->getIsocontourStripped()->GetOutput();
01235         }
01236         
01237         numPointsPolyDataCnt = polyDataCnt->GetNumberOfPoints();
01238         pointsId = polyDataCnt->GetCell(0)->GetPointIds();
01239         numTemp = pointsId->GetNumberOfIds();
01240         
01241         cont = new marIsocontour();
01242         
01243         for (int i = 0; i < (numTemp -1); i++){
01244                 pointPolyDataCnt = polyDataCnt->GetPoint(pointsId->GetId(i));
01245                 cont->insertPoint(pointPolyDataCnt[0], pointPolyDataCnt[1]);
01246                 
01247         }
01248                 
01249         return cont;    
01250 }

Here is the call graph for this function:

Here is the caller graph for this function:

marIsocontour * marAxisCT::filterContour ( marIsocontour contExt,
marIsocontour contInt,
double  radio 
) [private]

Definition at line 1255 of file marAxisCT.cpp.

References marLine::getA(), marLine::getB(), marLine::getC(), marLine::getIntersect(), marIsocontour::getPoint(), marIsocontour::getSize(), and marIsocontour::insertPoint().

01255                                                                                                    {
01256   
01257         double tmp_eed;
01258         double x1,y1,x2,y2,xInt,yInt, xAux, yAux;
01259         std::vector<marLine*> lineas;   
01260         std::vector<double> dists;
01261         int count, countAux, ultima;
01262         bool hayInterseccion;
01263 
01264         marIsocontour* newCont = new marIsocontour();
01265 
01266         for (int i = 0; i < contExt->getSize(); i++){
01267                 contExt->getPoint(i,&x1,&y1);
01268                 contInt->getPoint(i,&x2,&y2);
01269                 lineas.push_back(new marLine(x1,y1,x2,y2));     
01270                 tmp_eed = sqrt(pow((x2-x1),2.0) + pow((y2-y1),2.0)); 
01271                 dists.push_back( tmp_eed );
01272         }
01273 
01274         count = 0;
01275         ultima = 0;
01276         while (count < lineas.size() - 1){
01277                 countAux = 0;
01278 
01279                 marLine* l1 = lineas[count];
01280         
01281                 hayInterseccion = false;
01282                 while (countAux < lineas.size()){
01283                         marLine *l2 = lineas[countAux];
01284 
01285                         l1->getIntersect(l2->getA(),l2->getB(),l2->getC(),&xInt,&yInt);
01286 
01287                         
01288                         if (xInt > 0 && yInt > 0){
01289                                 contExt->getPoint(countAux,&xAux,&yAux);
01290                                 if (dists[count] >= sqrt(pow((xInt-xAux),2.0) + pow((yInt-yAux),2.0))){
01291                                         contExt->getPoint(count,&x1,&y1);
01292                                         contInt->getPoint(count,&x2,&y2);
01293 
01294                                         //Distancia menor?
01295                                         if ((dists[count] > sqrt(pow((xInt-x1),2.0) + pow((yInt-y1),2.0))) && 
01296                                                 (dists[count] > sqrt(pow((xInt-x2),2.0) + pow((yInt-y2),2.0))))
01297                                         {
01298                                                 ultima = countAux;
01299                                                 hayInterseccion = true;
01300                                         
01301                                         } 
01302                                 
01303                                 }
01304                         }
01305                         countAux++;
01306                 }
01307 
01308         
01309                 if (!hayInterseccion){
01310                         contInt->getPoint(count,&x2,&y2);
01311                         newCont->insertPoint(x2,y2);
01312                 } 
01313                         count++;
01314                 
01315         }
01316 
01317         return newCont;
01318 }

Here is the call graph for this function:

double marAxisCT::obtainContourArea ( marIsocontour contour  )  [private]

Definition at line 1485 of file marAxisCT.cpp.

References marIsocontour::getPoint(), and marIsocontour::getSize().

Referenced by adjustContour(), adjustWall(), and extractLumen().

01486 {
01487 
01488         double area = 0.0;
01489         double x1,y1,x2,y2;
01490         
01491         for (int i = 0; i < contour->getSize();i++)
01492         {
01493                 contour->getPoint(i,&x1,&y1);
01494                 if (i < (contour->getSize() - 1)) 
01495                 {
01496                         contour->getPoint(i+1,&x2,&y2);
01497                 }
01498                 else 
01499                 {
01500                         contour->getPoint(0,&x2,&y2);
01501                 }
01502 
01503                 area += (x1 * y2);
01504                 area -= (y1 * x2);
01505         }
01506 
01507         area = area / 2;
01508 
01509         if (area < 0)
01510                 area = -area;
01511 
01512         return area;
01513 }

Here is the call graph for this function:

Here is the caller graph for this function:

void marAxisCT::adjustWall ( int  point,
kVolume *  vol 
) [private]

Definition at line 1516 of file marAxisCT.cpp.

References marObject::getParameters(), maxValue(), obtainContourArea(), parsePolyDataToMarIsocontour(), searchContour(), updateLumenPercentage(), and marAxisContours::WALL.

Referenced by create2Dcontours().

01517 {
01518         //int actualPercentage = ((marParameters *) getParameters())->getLumenPercentage();
01519         marIsocontour* cont;
01520         double actualArea, previousArea;
01521         std::vector <double > grad;
01522         marContourVO* wallCont = searchContour(marAxisContours::WALL,point);
01523 
01524         //Obtain first area
01525         ((marParameters *) getParameters())->setLumenPercentage(50);
01526         updateLumenPercentage(point,vol);
01527         cont = parsePolyDataToMarIsocontour(wallCont);
01528         previousArea = obtainContourArea(cont);
01529 
01530         for (int eval = 49; eval >= 0; eval--)
01531         {
01532                 ((marParameters *) getParameters())->setLumenPercentage(eval);
01533                 updateLumenPercentage(point,vol);
01534                 cont = parsePolyDataToMarIsocontour(wallCont);
01535                 actualArea = obtainContourArea(cont);
01536                 grad.push_back(fabs(actualArea - previousArea));
01537         }
01538 
01539         int newPercentage = 50 - maxValue(grad);
01540         ((marParameters *) getParameters())->setLumenPercentage(newPercentage);
01541         updateLumenPercentage(point,vol);
01542 
01543         
01544 
01545 }

Here is the call graph for this function:

Here is the caller graph for this function:

void marAxisCT::adjustCalcification ( int  point,
kVolume *  vol 
) [private]

Definition at line 1548 of file marAxisCT.cpp.

01549 {
01550 }

void marAxisCT::adjustContour ( int  point,
kVolume *  vol 
) [private]

Definition at line 1758 of file marAxisCT.cpp.

References create2Dcontours(), marContourVO::get2DContour(), marContourVO::getIsocontour(), markUpLumen(), maxSignal, obtainContourArea(), parsePolyDataToMarIsocontour(), marAxis::quantContours, searchContour(), marAxis::stop(), and marAxisContours::WALL.

Referenced by create2Dcontours().

01759 {
01760 
01761         double percentage = 0.05;
01762         double prevDifference = 0;
01763         if (quantContours[point + 1] == NULL)
01764         {
01765                 create2Dcontours(point + 1 ,vol);
01766         }
01767 
01768         //1. Obtain actual signal 
01769         double signal = maxSignal;
01770         marContourVO* wallCont = searchContour(marAxisContours::WALL,point);
01771 
01772         //2. Obtain previous contour
01773         marIsocontour* prev = parsePolyDataToMarIsocontour(searchContour(marAxisContours::WALL, point + 1));
01774         
01775         //3. Adjust actual contour
01776         double newValue = signal; 
01777         wallCont->getIsocontour()->SetValue(0,newValue);
01778         wallCont->getIsocontour()->Update();
01779         wallCont->get2DContour()->Update();
01780 
01781         //4. Obtain points
01782         marIsocontour* actual = parsePolyDataToMarIsocontour(wallCont);
01783 
01784         //5. Compare areas
01785         double prevA = obtainContourArea(prev);
01786         double actuA = obtainContourArea(actual);
01787 
01788         prevDifference = fabs(prevA - actuA);
01789 
01790 
01791         if (prevA - actuA > 0 && prevA - actuA < percentage*prevA) //CASO 1
01792         {
01793                 bool stop = false;
01794                 while (!stop && newValue > 0)
01795                 {
01796                         newValue--;
01797                         
01798                         wallCont->getIsocontour()->SetValue(0,newValue);
01799                         wallCont->getIsocontour()->Update();
01800                         wallCont->get2DContour()->Update();
01801 
01802                         actual = parsePolyDataToMarIsocontour(wallCont);
01803                         actuA = obtainContourArea(actual);
01804  
01805                         if (fabs(prevA - actuA) > percentage*prevA)
01806                         {
01807                                 newValue++;
01808                                 wallCont->getIsocontour()->SetValue(0,newValue);
01809                                 wallCont->getIsocontour()->Update();
01810                                 wallCont->get2DContour()->Update();
01811                                 stop = true;
01812                         }
01813                 }
01814         
01815         }
01816         else if (prevA - actuA < 0 && prevA - actuA > -percentage*prevA) //CASO 2
01817         {
01818 
01819                 bool stop = false;
01820                 while (!stop && newValue > 0)
01821                 {
01822                         newValue--;
01823                         
01824                         wallCont->getIsocontour()->SetValue(0,newValue);
01825                         wallCont->getIsocontour()->Update();
01826                         wallCont->get2DContour()->Update();
01827 
01828                         actual = parsePolyDataToMarIsocontour(wallCont);
01829                         actuA = obtainContourArea(actual);
01830  
01831                         if (prevA - actuA < -percentage*prevA)
01832                         {
01833                                 newValue++;
01834                                 wallCont->getIsocontour()->SetValue(0,newValue);
01835                                 wallCont->getIsocontour()->Update();
01836                                 wallCont->get2DContour()->Update();
01837                                 stop = true;
01838                         }
01839                 }
01840         }
01841         else if (prevA - actuA < 0 && prevA - actuA < -percentage*prevA) //CASO 3
01842         {
01843 
01844                 bool stop = false;
01845                 
01846                 while (!stop)
01847                 {
01848                         newValue++;
01849                         
01850                         wallCont->getIsocontour()->SetValue(0,newValue);
01851                         wallCont->getIsocontour()->Update();
01852                         wallCont->get2DContour()->Update();
01853 
01854                         actual = parsePolyDataToMarIsocontour(wallCont);
01855                         
01856                         actuA = obtainContourArea(actual);
01857                         if (prevA - actuA > -percentage*prevA)
01858                         {
01859                                 if (prevDifference < fabs(prevA - actuA))
01860                                 {
01861                                         newValue--;
01862                                         wallCont->getIsocontour()->SetValue(0,newValue);
01863                                         wallCont->getIsocontour()->Update();
01864                                         wallCont->get2DContour()->Update();
01865                                 }
01866                                 
01867                                 stop = true;
01868                                 
01869                         }
01870                         prevDifference = fabs(prevA - actuA);
01871                 }
01872         }
01873         else if (prevA - actuA > 0 && prevA - actuA > percentage*prevA) //CASO 4
01874         {
01875                 bool stop = false;
01876                 while (!stop && newValue > 0)
01877                 {
01878                         newValue--;
01879                         
01880                         wallCont->getIsocontour()->SetValue(0,newValue);
01881                         wallCont->getIsocontour()->Update();
01882                         wallCont->get2DContour()->Update();
01883 
01884                         actual = parsePolyDataToMarIsocontour(wallCont);
01885                         actuA = obtainContourArea(actual);
01886  
01887                         if (prevA - actuA < percentage*prevA)
01888                         {
01889                                 if (prevDifference < fabs(prevA - actuA))
01890                                 {
01891                                         newValue++;
01892                                         wallCont->getIsocontour()->SetValue(0,newValue);
01893                                         wallCont->getIsocontour()->Update();
01894                                         wallCont->get2DContour()->Update();
01895                                 }
01896                                 
01897                                 stop = true;
01898                                 
01899                         }
01900                         prevDifference = fabs(prevA - actuA);
01901                 }
01902         }
01903 
01904         
01905         maxSignal = newValue;
01906 
01907         this->markUpLumen(point,vol);
01908 }

Here is the call graph for this function:

Here is the caller graph for this function:

int marAxisCT::maxValue ( std::vector< double >  list  )  [private]

Definition at line 1553 of file marAxisCT.cpp.

Referenced by adjustWall().

01554 {
01555         int max = 0;
01556         double maxVal = list[0];
01557 
01558         for (int i = 0; i < list.size(); i++)
01559         {
01560                 if (list[i] > maxVal)
01561                 {
01562                         maxVal = list[i];
01563                         max = i;
01564                 }
01565         }
01566 
01567         return max;
01568 }

Here is the caller graph for this function:

int marAxisCT::getDiameter ( marContourVO contourVO,
double  x,
double  y,
int  limInfX,
int  limInfY,
int  limSupX,
int  limSupY 
) [private]

Definition at line 1572 of file marAxisCT.cpp.

References generateVector(), parsePolyDataToMarIsocontour(), pointInPolygon(), and marAxis::stop().

01573 {
01574         bool stop = false; 
01575         double originX = x;
01576         double originY = y;
01577 
01578         int coordBase = 1, diameterOne = 0, diameterTwo = 0;
01579         marIsocontour* cont = parsePolyDataToMarIsocontour(contourVO);
01580         generateVector(1,&coordBase,originX,originY,&x,&y);
01581 
01582         while ((x > (limInfX+1) && x < (limSupX-1)) && (y > (limInfY+1) && y < (limSupY-1)) && !stop)
01583         {
01584                 generateVector(0,&coordBase,originX,originY,&x,&y);
01585                 if (pointInPolygon(cont,x,y))
01586                 {
01587                         diameterOne++;
01588                 }
01589                 else
01590                 {
01591                         stop = true; 
01592                 }
01593         }
01594 
01595         stop = false; 
01596         x = originX;
01597         y = originY; 
01598         while ((x > (limInfX+1) && x < (limSupX-1)) && (y > (limInfY+1) && y < (limSupY-1)) && !stop)
01599         {
01600                 generateVector(35,&coordBase,originX,originY,&x,&y);
01601                 if (pointInPolygon(cont,x,y))
01602                 {
01603                         diameterOne++;
01604                 }
01605                 else
01606                 {
01607                         stop = true; 
01608                 }
01609         }
01610 
01611         stop = false; 
01612         x = originX;
01613         y = originY; 
01614         while ((x > (limInfX+1) && x < (limSupX-1)) && (y > (limInfY+1) && y < (limSupY-1)) && !stop)
01615         {
01616                 generateVector(17,&coordBase,originX,originY,&x,&y);
01617                 if (pointInPolygon(cont,x,y))
01618                 {
01619                         diameterTwo++;
01620                 }
01621                 else
01622                 {
01623                         stop = true; 
01624                 }
01625         }
01626 
01627         stop = false; 
01628         x = originX;
01629         y = originY; 
01630         while ((x > (limInfX+1) && x < (limSupX-1)) && (y > (limInfY+1) && y < (limSupY-1)) && !stop)
01631         {
01632                 generateVector(107,&coordBase,originX,originY,&x,&y);
01633                 if (pointInPolygon(cont,x,y))
01634                 {
01635                         diameterTwo++;
01636                 }
01637                 else
01638                 {
01639                         stop = true; 
01640                 }
01641         }
01642 
01643         delete cont;
01644 
01645         return (diameterOne + diameterTwo) / 2;
01646 }

Here is the call graph for this function:

int marAxisCT::searchData ( std::vector< double >  vec,
double  value 
) [private]

Definition at line 1728 of file marAxisCT.cpp.

Referenced by histogram().

01729 {
01730         int resp = -1;
01731         bool found = false;
01732 
01733         for (int i = 0; i< vec.size() && !found; i++)
01734         {
01735                 if (vec[i] == value)
01736                 {
01737                         resp = i;
01738                         found = true;
01739                 }
01740         }
01741 
01742         return resp;
01743 }

Here is the caller graph for this function:

void marAxisCT::extractLumen ( vtkImageData *  lumenImage,
marIsocontour lumenContour,
int  point 
) [private]

Definition at line 1940 of file marAxisCT.cpp.

References marAxisContours::addContour(), marAxisContours::ELUMEN, marContourVO::get2DContour(), marIsocontour::getCG(), marAxisContours::getContourType(), marContourVO::getIsocontour(), marContourVO::getIsocontourCpd(), marContourVO::getIsocontourCpd2(), marContourVO::getIsocontourDcf(), marContourVO::getIsocontourStripped(), marObject::getParameters(), marAxisContours::getSize(), marAxisContours::isReplaced(), obtainContourArea(), parsePolyDataToMarIsocontour(), marAxis::quantContours, marAxisContours::replaceContour(), searchContour(), marContourVO::set2DContour(), marContourVO::setIsocontour(), marContourVO::setIsocontourCpd(), marContourVO::setIsocontourCpd2(), marContourVO::setIsocontourDcf(), marContourVO::setIsocontourStripped(), marContourVO::setSignal(), marContourVO::setType(), marAxis::stop(), and marAxisContours::WALL.

Referenced by markUpLumen().

01941 {
01942 
01943         
01944         vtkImageCast* cast = vtkImageCast::New();
01945         cast->SetInput(lumenImage);
01946         cast->SetOutputScalarTypeToDouble();
01947         
01948         vtkImageGaussianSmooth* filter = vtkImageGaussianSmooth::New();
01949         filter->SetDimensionality(2);
01950         filter->SetInput(cast->GetOutput());
01951         filter->SetStandardDeviations((getParameters())->getStandardDeviation(),(getParameters())->getStandardDeviation());
01952         filter->SetRadiusFactors((getParameters())->getRadius(),(getParameters())->getRadius());
01953         filter->SetStandardDeviations(3,3);
01954         filter->SetRadiusFactors(3,3);
01955         
01956 
01957 
01958         marAxisContours* axisCont = quantContours[point];
01959 
01960         int pos = -1;
01961         
01962         for (int i = 0; i < axisCont->getSize()  && pos == -1; i++)
01963         {
01964                 if (axisCont->getContourType(i) == marAxisContours::ELUMEN)
01965                 {
01966                         pos = i;
01967                 }
01968         }
01969 
01970         bool stop = false;
01971         if (pos != -1)          //Verify that contour hasn't been replaced
01972         {
01973                 stop = true;
01974                 if (axisCont->isReplaced(pos))
01975                 {
01976                         stop = true;
01977                 }
01978         
01979         }
01980 
01981         if (!stop)
01982         {
01983                 marContourVO* contourVO = new marContourVO();
01984                 marIsocontour* iso = lumenContour;
01985                 
01986                 contourVO->setIsocontour(vtkContourFilter::New());
01987                 contourVO->getIsocontour()->SetInput( filter->GetOutput() );
01988                 contourVO->getIsocontour()->SetNumberOfContours( 1 );
01989                 contourVO->getIsocontour()->SetValue( 0, 128 ); 
01990                 contourVO->getIsocontour()->Update( );
01991                         
01992                 contourVO->setIsocontourCpd(vtkCleanPolyData::New());
01993                 contourVO->getIsocontourCpd()->SetInput( contourVO->getIsocontour()->GetOutput( ) );
01994                 contourVO->getIsocontourCpd()->ConvertLinesToPointsOff( );
01995                 contourVO->getIsocontourCpd()->Update( );
01996 
01997                 double cgx, cgy;
01998 
01999                 iso->getCG(&cgx,&cgy);
02000                         
02001                 contourVO->setIsocontourDcf(vtkPolyDataConnectivityFilter::New( ));
02002                 contourVO->getIsocontourDcf()->SetInput( contourVO->getIsocontourCpd()->GetOutput( ) );
02003                         
02004                 contourVO->getIsocontourDcf()->SetClosestPoint( cgx, cgy, 0 );
02005                 contourVO->getIsocontourDcf()->SetExtractionModeToClosestPointRegion( );
02006                 contourVO->getIsocontourDcf()->Update( );
02007                         
02008                 contourVO->setIsocontourCpd2(vtkCleanPolyData::New());
02009                 contourVO->getIsocontourCpd2()->SetInput( contourVO->getIsocontourDcf()->GetOutput( ) );
02010                 contourVO->getIsocontourCpd2()->Update();
02011 
02012                 contourVO->setIsocontourStripped(vtkStripper::New( ));
02013                 contourVO->getIsocontourStripped()->SetInput( contourVO->getIsocontourCpd2()->GetOutput() );
02014                 contourVO->getIsocontourStripped()->Update();
02015                 
02016                 contourVO->set2DContour(contourVO->getIsocontourStripped()->GetOutput());
02017                 contourVO->get2DContour()->Update();
02018                 contourVO->setSignal(255);
02019                 contourVO->setType(marAxisContours::ELUMEN); 
02020                 
02021                 
02022                 
02023                 marIsocontour* actual = parsePolyDataToMarIsocontour(contourVO);
02024                 marContourVO* aVO = searchContour(marAxisContours::WALL,point);
02025                 double wallArea = 0;
02026                 if (aVO != NULL)
02027                 {
02028                         wallArea = obtainContourArea(parsePolyDataToMarIsocontour(aVO));
02029                 }
02030         
02031                 double prevA = obtainContourArea(actual);
02032                 
02033                 int newValue = 128;
02034                 int finalValue = 128;
02035                 double actuA = 1;
02036                 while (newValue > 0 && actuA > 0)
02037                 {
02038                         
02039                         newValue--;
02040 
02041                         try
02042                         {
02043                                 contourVO->getIsocontour()->SetValue(0,newValue);
02044                                 contourVO->getIsocontour()->Update();
02045                                 contourVO->get2DContour()->Update();
02046                                 actual = parsePolyDataToMarIsocontour(contourVO);
02047                                 actuA = obtainContourArea(actual);
02048                                 if ((actuA /1000) < 1 && (prevA / 1000) > 1)
02049                                 {
02050                                         finalValue = newValue;
02051                                         prevA = actuA;
02052                                 }
02053                                 else if (actuA > prevA && (prevA / 1000) < 1 && actuA < 0.1*wallArea)
02054                                 {
02055                                         finalValue = newValue;
02056                                         prevA = actuA;
02057                                 }
02058                         }
02059                         catch (std::exception e)
02060                         {
02061                                 actuA = 0;
02062                         }
02063                         
02064                 }
02065 
02066                 contourVO->getIsocontour()->SetValue(0,finalValue);
02067                 contourVO->getIsocontour()->Update();
02068                 contourVO->get2DContour()->Update();
02069 
02070 
02071 
02072                 /*iso->getType()*/
02073 
02074                 if (pos != -1)
02075                 {
02076                         axisCont->replaceContour(contourVO,pos);
02077                 }
02078                 else
02079                 {
02080                         axisCont->addContour(contourVO);
02081                 }
02082                 //      axisCont->addContour(contourVO);
02083 
02084 
02085                 quantContours[point] = axisCont;
02086         }
02087 
02088         
02089 }

Here is the call graph for this function:

Here is the caller graph for this function:

std::string& marAxis::getDescription (  )  [inline, inherited]

Return description as a std::string

Definition at line 93 of file marAxis.h.

00093 { return( _description ); };

void marAxis::setDescription ( std::string &  d  )  [inline, inherited]

Set description as a std::string

Definition at line 98 of file marAxis.h.

Referenced by marExperiment::extractVascularTree().

00098 { _description = d; };

Here is the caller graph for this function:

void marAxis::addAxisPoint ( double *  p  )  [inherited]

Add a point to the axis

Warning:
no check is done

Definition at line 72 of file marAxis.cpp.

References marAxis::INDX_count, and marAxis::INDX_SIGNALVALUE.

Referenced by marExperiment::extractVascularTree().

00073 {
00074     double pt[ INDX_count ];
00075 
00076     memcpy( pt, p, sizeof( POINTAXE ) );
00077     pt[ INDX_SIGNALVALUE ] = 0;
00078     addControlPoint( pt, pt + 3 );
00079 }

Here is the caller graph for this function:

void marAxis::changeAxisResolution (  )  [inherited]

Definition at line 107 of file marAxis.cpp.

00108 {/*
00109    int i;
00110    int nOut = ( int )ceil(
00111    getParameters( )->
00112    getDoubleParam( marParameters::e_axis_discret_step )
00113    * ( double )( GetNumberOfPoints( ) )
00114    );
00115 
00116    i = GetNumberOfPoints( );
00117    double d = getParameters( )->
00118    getDoubleParam( marParameters::e_axis_discret_step );
00119 
00120    SetResolution( nOut );
00121    for( i = 0; i < _contours.size( ); i++ )
00122    delete _contours[ i ];
00123    _contours.clear( );
00124    for( i = 0; i < nOut; i++ )
00125    _contours.push_back( new marContour( getParameters( ) ) );
00126  */
00127 }

void marAxis::calculateSignal ( kVolume *  vol  )  [inherited]

PSIGNAL_USHORT <-> unsigned short *

Definition at line 130 of file marAxis.cpp.

References marAxis::_points, marAxis::_points_disc, marAxis::_signal, marParameters::e_mask_size, and marObject::getParameters().

Referenced by marExperiment::extractVascularTree(), and marExperiment::RegenerateSignal().

00131 {
00135     /* PSIGNAL_FLOAT PutSignalValueFloat(PSIGNAL_FLOAT signal, int pos, float value)
00136     {
00137       signal[pos] = value;
00138       return signal;
00139     }*/
00140   ushort maxlocal;
00141   double *p;
00142 
00143   double rayon;
00144   unsigned int i, mask_size = getParameters( )-> getIntParam( marParameters::e_mask_size );
00145 
00146   while( _signal.size( ) > 0 ) _signal.pop_back( );
00147   // Intensity signal
00148 
00149   PSIGNAL_USHORT signal = ( PSIGNAL_USHORT ) IdSigAlloc( _points.size( ), SIG_USHORT );
00150   for( i = 0; i < _points.size( ); i++ ) {
00151     p = _points[i];
00152     rayon = RayonLocal(
00153                       ( int ) ( p[ 0 ] ),
00154                       ( int ) ( p[ 1 ] ),
00155                       ( int ) ( p[ 2 ] ),
00156                       _points_disc, getNumberOfControlPoints( ));
00157 
00158     maxlocal = vol->GetMaxIntSphere2( p, rayon );
00159     PutSignalValue( signal, i, maxlocal );
00160   } // rof
00161 
00162   PSIGNAL_FLOAT mask_signal = ( PSIGNAL_FLOAT )IdSigAlloc( mask_size, SIG_FLOAT );
00163 
00164   for( i = 0; i < mask_size; i++ )
00165     PutSignalValueFloat( mask_signal, i, 1 );
00166 
00167   PSIGNAL_USHORT signalfilt = ( PSIGNAL_USHORT )IdSigAlloc( _points.size( ), SIG_USHORT );
00168   signalfilt = MonSigConvolve( signal, mask_signal, signalfilt, 1.0 / ( double )mask_size, 0 );
00169   for( i = 0; i < _points.size( ); i++ ){
00170     _signal.push_back( GetSignalValue( signalfilt, i ) );
00171   }
00172   IdSigFree( signal );
00173   IdSigFree( mask_signal );
00174   IdSigFree( signalfilt );
00175 }

Here is the call graph for this function:

Here is the caller graph for this function:

int marAxis::getActualQuant (  )  [inline, inherited]

Definition at line 109 of file marAxis.h.

Referenced by marInterfaceCT::getActualQuant(), wxQuantificationWidget::RefreshAxis(), marExperiment::RegenerateAxis(), and wxQuantificationWidget::showVariables().

00109 { return _actualQuant;                          }

Here is the caller graph for this function:

float marAxis::getSignal ( uint  slice  )  [inline, inherited]

Definition at line 111 of file marAxis.h.

Referenced by vtk3DSurfaceSTLWidget::ConvertMarAxisToPolyData(), marAxis::create2Dcontour(), marExperiment::extractVascularTree(), and wxEmptyPanelWidget_2::WriteSignals().

00111 { return( _signal[ slice ] );           };

Here is the caller graph for this function:

double* marAxis::getSplinePoint ( uint  i  )  [inline, inherited]

Definition at line 113 of file marAxis.h.

Referenced by wxQuantificationWidgetCT::CallBackOnLeftDClick(), wxQuantificationWidget::CallBackOnLeftDClick(), and vtk3DQuantSurfaceWidget::Set3DSliceActor().

00113 { return ( _points[ i ] );                      };

Here is the caller graph for this function:

int marAxis::getHealthySlice (  )  [inline, inherited]

Definition at line 115 of file marAxis.h.

Referenced by marInterfaceCT::getHealthySlice(), wxQuantificationWidget::GetHealthySlice(), wxQuantificationWidget::OnHealthySlice_CB(), vtk3DQuantSurfaceWidget::Set3DHealthySliceActor(), and wxQuantificationWidget::showVariables().

00115 { return( _healthySlice );                      };

Here is the caller graph for this function:

int marAxis::getHealthySliceStart (  )  [inline, inherited]

Definition at line 116 of file marAxis.h.

Referenced by wxQuantificationWidget::GetHealthySliceRange(), marInterfaceCT::getHealthySliceStart(), and wxQuantificationWidget::showVariables().

00116 { return( _healthySliceStart );         };

Here is the caller graph for this function:

int marAxis::getHealthySliceEnd (  )  [inline, inherited]

Definition at line 117 of file marAxis.h.

Referenced by marInterfaceCT::getHealthySliceEnd(), wxQuantificationWidget::GetHealthySliceRange(), and wxQuantificationWidget::showVariables().

00117 { return( _healthySliceEnd );           };

Here is the caller graph for this function:

void marAxis::setActualQuant ( int  act  )  [inline, inherited]

Definition at line 119 of file marAxis.h.

Referenced by wxQuantificationWidget::MoveSlider(), marExperiment::RecalculateAxis(), marExperiment::RegenerateAxis(), wxQuantificationWidget::ResetAxis(), marInterfaceCT::setActualQuant(), and wxQuantificationWidget::ShowMARACASData().

00119 { _actualQuant=act;                                     };

Here is the caller graph for this function:

void marAxis::setHealthySlice ( int  hsS,
int  hs,
int  hsE 
) [inherited]

Definition at line 1520 of file marAxis.cpp.

References marAxis::_healthySlice, marAxis::_healthySliceEnd, marAxis::_healthySliceStart, marAxis::_referenceArea, and marAxis::_referenceAverDiam.

Referenced by wxQuantificationWidget::ResetAxis(), marInterfaceCT::setHealthySlice(), and wxQuantificationWidget::SetHealthySlice().

01520                                                        { 
01521           _healthySliceStart    = hsS;
01522           _healthySlice                 = hs;   
01523           _healthySliceEnd              = hsE;
01524           _referenceArea=-1;
01525           _referenceAverDiam=-1;
01526   };

Here is the caller graph for this function:

void marAxis::setStartQuant ( int  sq  )  [inherited]

Definition at line 1528 of file marAxis.cpp.

References marAxis::_startQuant, and marAxis::_subAxisLenght.

Referenced by vtk3DQuantSurfaceWidget::Set3DStartRegionSliceActor().

01528                                    {
01529         _startQuant             =       sq;             
01530         _subAxisLenght  =       -1;
01531 };

Here is the caller graph for this function:

void marAxis::setFinishQuant ( int  fq  )  [inherited]

Definition at line 1533 of file marAxis.cpp.

References marAxis::_finishQuant, and marAxis::_subAxisLenght.

Referenced by vtk3DQuantSurfaceWidget::Set3DEndRegionSliceActor().

01533                                     { 
01534         _finishQuant    =       fq;             
01535         _subAxisLenght  =       -1;
01536 };

Here is the caller graph for this function:

int marAxis::getStartQuant (  )  [inline, inherited]

Definition at line 127 of file marAxis.h.

Referenced by marExperiment::getQuantStart(), and wxQuantificationWidget::showVariables().

00127 { return _startQuant;                           };

Here is the caller graph for this function:

int marAxis::getFinishQuant (  )  [inline, inherited]

Definition at line 128 of file marAxis.h.

Referenced by wxQuantificationWidget::showVariables().

00128 { return _finishQuant;                          };

Here is the caller graph for this function:

void marAxis::start (  )  [inherited]

Definition at line 178 of file marAxis.cpp.

00179 {
00180     /* TODO
00181        int swap, n = GetNumberOfPoints( );
00182 
00183        swap = GSL_MIN( _startQuant, _finishQuant );
00184        _finishQuant = GSL_MAX( _startQuant, _finishQuant );
00185        _startQuant = swap;
00186 
00187        _startQuant = ( _startQuant >= 0 )? _startQuant: 0;
00188        _finishQuant = ( _finishQuant >= n )? _finishQuant: n - 1;
00189        _actualQuant = _startQuant;
00190     */
00191 }

void marAxis::next (  )  [inline, inherited]

Definition at line 132 of file marAxis.h.

Referenced by generatePoints().

00132 { _actualQuant++; };

Here is the caller graph for this function:

void marAxis::stop (  )  [inline, inherited]

Definition at line 133 of file marAxis.h.

Referenced by adjustContour(), extractLumen(), and getDiameter().

00133 { _actualQuant = _finishQuant + 1; };

Here is the caller graph for this function:

bool marAxis::isFinished (  )  [inline, inherited]

Definition at line 134 of file marAxis.h.

00134 { return( _actualQuant >= _startQuant && _actualQuant <= _finishQuant ); }

void marAxis::doSpline (  )  [inherited]

Definition at line 200 of file marAxis.cpp.

References marAxis::_contours, marAxis::_healthySlice, marAxis::_points, marParameters::e_axis_discret_step, marParameters::getDoubleParam(), marObject::getParameters(), marAxis::INDX_count, marAxis::INDX_X, marAxis::INDX_Y, and marAxis::INDX_Z.

Referenced by marExperiment::extractVascularTree(), and marExperiment::RecalculateAxis().

00201 {
00202   unsigned int i;
00203   unsigned int nop, nip;
00204   float length=0, t;
00205   float p1[ 3 ], p2[ 3 ];
00206   double p[marAxis::INDX_count];
00207 
00208   vtkKochanekSpline* spX = vtkKochanekSpline::New( );
00209   vtkKochanekSpline* spY = vtkKochanekSpline::New( );
00210   vtkKochanekSpline* spZ = vtkKochanekSpline::New( );
00211 
00212   for( i = 0, length = 0.0; i < _controlPoints.size( ); i++ ) {
00213     getControlPoint(i, p, p+3);
00214     p2[ 0 ] = (float) p[marAxis::INDX_X];
00215     p2[ 1 ] = (float) p[marAxis::INDX_Y];
00216     p2[ 2 ] = (float) p[marAxis::INDX_Z];
00217     spX->AddPoint( (float) i, p2[ 0 ] );
00218     spY->AddPoint( (float) i, p2[ 1 ] );
00219     spZ->AddPoint( (float) i, p2[ 2 ] );
00220     if( i > 0 )
00221       length += (float) (sqrt( (p2[0]-p1[0])*(p2[0]-p1[0]) +
00222                                (p2[1]-p1[1])*(p2[1]-p1[1]) +
00223                                (p2[2]-p1[2])*(p2[2]-p1[2]) ) );
00224     p1[ 0 ] = p2[ 0 ]; p1[ 1 ] = p2[ 1 ]; p1[ 2 ] = p2[ 2 ];
00225   } // rof
00226 
00227   nop = ( unsigned int ) ( getParameters( )->getDoubleParam(
00228                                            marParameters::e_axis_discret_step ) * length );
00229   nip = _controlPoints.size( );
00230   _healthySlice = -1;
00231 
00232   while( _points.size( ) > 0 ) {
00233     delete _points[ _points.size( ) - 1 ];
00234     _points.pop_back( );
00235   } // fwhile
00236 
00237   while( _contours.size( ) > 0 ) {
00238     delete _contours[ _contours.size( ) - 1 ];
00239     _contours.pop_back( );
00240   } // fwhile
00241 
00242   for( i = 0; i < nop; i++ ) {
00243     t = (float) (( ( double ) nip - 1.0 ) / ( ( double ) nop - 1.0 ) * i);
00244     double* np = new double[ 3 ];
00245     np[ 0 ] =  0;
00246     np[ 1 ] =  0;
00247     np[ 2 ] =  0;
00248     np[ 0 ] = (double) (spX->Evaluate( t ));
00249     np[ 1 ] = (double) (spY->Evaluate( t ));
00250     np[ 2 ] = (double) (spZ->Evaluate( t ));
00251     _points.push_back( np );
00252     _contours.push_back( new marContour( i, getParameters( ) ) );
00253 
00254   } // rof
00255 
00256   spX->Delete( );
00257   spY->Delete( );
00258   spZ->Delete( );
00259 
00260 }

Here is the call graph for this function:

Here is the caller graph for this function:

void marAxis::cut ( int  slice,
bool  up 
) [inherited]

Definition at line 194 of file marAxis.cpp.

00195 { // TODO
00196 }

void marAxis::sliceVolumeAxis ( kVolume *  vol,
bool  forceCnt = true 
) [inherited]

Definition at line 265 of file marAxis.cpp.

00266 {
00267 /*
00268   int nCnts = ( int ) getNumberOfSplinePoints( );
00269   int sizeIma = getParameters( )->getSizeIma( );
00270   double dimIma = getParameters( )->getDimIma( );
00271   double voxSize = getParameters( )->getVoxelSize( );
00272 
00273   if( forceCnt )
00274     for( unsigned int i = 0; i < _contours.size( ); i++ )
00275       delete _contours[ i ];
00276     _contours.clear( );
00277 
00278     for( unsigned int i = 0; i < _slices.size( ); i++ ) {
00279       delete _slices[ i ];
00280       _3Dslices[ i ]->Delete( );
00281       _quantificationImages[ i ]->Delete( );
00282     }
00283 
00284   _slices.clear( );
00285   _3Dslices.clear( );
00286   _quantificationImages.clear( );
00287 
00288 
00289   // "Cutter" initialization
00290   vtkStructuredPoints* stPoints = vtkStructuredPoints::New( );
00291   // Perform "cut"
00292   double *p, *n;
00293   for( int k = 0; k < nCnts; k++ ) {
00294     //s = ( double )k / ( double )( nCnts - 1 );
00295     p = _points[k];
00296     n = getNormal( k );
00297     vtkPlaneSource* pSource = vtkPlaneSource::New( );
00298     pSource->SetOrigin( p[ 0 ], p[ 1 ], p[ 2 ] );
00299     pSource->SetPoint1( p[ 0 ] + dimIma - 1.0, p[ 1 ], p[ 2 ] );
00300     pSource->SetPoint2( p[ 0 ], p[ 1 ], p[ 2 ] + dimIma - 1.0 );
00301     pSource->SetResolution( sizeIma - 1, sizeIma - 1 );
00302     pSource->Update( );
00303     pSource->SetCenter( p[ 0 ], p[ 1 ], p[ 2 ] );
00304     pSource->SetNormal( n[ 0 ], n[ 1 ], n[ 2 ] );
00305     pSource->Update( );
00306 
00307     _3Dslices.push_back( vtkProbeFilter::New( ) );
00308     _3Dslices[ k ]->SetInput( ( vtkDataSet* )pSource->GetOutput( ) );
00309     _3Dslices[ k ]->SetSource( vol->castVtk( ) );
00310     _3Dslices[ k ]->Update( );
00311     pSource->Delete( );
00312 
00313     stPoints->GetPointData( )->
00314                 SetScalars( _3Dslices[ k ]->GetOutput( )->
00315                 GetPointData( )->GetScalars( ) );
00316     stPoints->SetDimensions( sizeIma, sizeIma, 1 );
00317     stPoints->SetScalarType( vol->castVtk( )->GetDataObjectType( ) );
00318     stPoints->Update( );
00319     if( forceCnt )
00320       {
00321                 marContour* tmp_marContour = new marContour( k, getParameters( ) ) ;
00322                 tmp_marContour->calculateVariables();
00323                 _contours.push_back( tmp_marContour );
00324         }
00325     _slices.push_back( new kVolume( kVolume::UCHAR, 1, 1, 1 ) );
00326 
00327     *( _slices[ k ] ) = ( vtkImageData* )stPoints;  //copy
00328     _quantificationImages.push_back( (_slices[ k ])->castVtk( ) );
00329   } // rof
00330 
00331   stPoints->Delete( );
00332 */
00333 }

double * marAxis::getNormal ( unsigned int  slice  )  [inherited]

Definition at line 83 of file marAxis.cpp.

References marAxis::_points.

Referenced by marAxis::create3Dcontour(), create3Dcontours(), marAxis::create3DSlice(), marAxis::createSlice(), and vtk3DQuantSurfaceWidget::Set3DSliceActor().

00083                                                {
00084 
00085     double* ret = new double[ 3 ];
00086 
00087     if ( slice == 0 ) {
00088       ret[0] = _points[ slice + 1 ][0] - _points[ slice ][0];
00089       ret[1] = _points[ slice + 1 ][1] - _points[ slice ][1];
00090       ret[2] = _points[ slice + 1 ][2] - _points[ slice ][2];
00091     }
00092     else if ( slice == _points.size( ) - 1 ) {
00093       ret[0] = _points[ slice - 1 ][0] - _points[ slice ][0];
00094       ret[1] = _points[ slice - 1 ][1] - _points[ slice ][1];
00095       ret[2] = _points[ slice - 1 ][2] - _points[ slice ][2];
00096     }
00097     else if ( slice > 0 && slice < _points.size( ) - 1 ) {
00098       ret[0] = _points[ slice - 1 ][0] - _points[ slice + 1 ][0];
00099       ret[1] = _points[ slice - 1 ][1] - _points[ slice + 1 ][1];
00100       ret[2] = _points[ slice - 1 ][2] - _points[ slice + 1 ][2];
00101     }
00102 
00103     return( ret );
00104 }

Here is the caller graph for this function:

int marAxis::getNumberOfContours (  )  [inherited]

Definition at line 338 of file marAxis.cpp.

References marAxis::_contours.

Referenced by marAxis::save().

00339 {
00340     return( _contours.size( ) );
00341 }

Here is the caller graph for this function:

int marAxis::getNumberOfSplinePoints (  )  [inherited]

Definition at line 344 of file marAxis.cpp.

References marAxis::_points.

Referenced by wxQuantificationWidgetCT::CallBackOnLeftDClick(), wxQuantificationWidget::CallBackOnLeftDClick(), createEmptyContours(), marAxis::createEmptyVectors(), and marExperiment::RecalculateAxis().

00345 {
00346     return( _points.size( ) );
00347 }

Here is the caller graph for this function:

bool marAxis::if3DcontourExist ( int  i  )  [inherited]

Definition at line 1172 of file marAxis.cpp.

References marAxis::_3Dcontour.

01173 {
01174         bool result=true;
01175         if (_3Dcontour[i]==NULL)
01176         {
01177                 result=false;
01178         } 
01179         return result;
01180 }

void marAxis::Save3Dcontour ( FILE *  ff,
int  i 
) [inherited]

Definition at line 1183 of file marAxis.cpp.

References marAxis::_3Dcontour.

Referenced by marAxis::SaveExisting3DContours().

01184 {
01185         int i,size;
01186         double point[3];
01187         if (_3Dcontour[id]!=NULL)
01188         {
01189 //Ramiro                fprintf(ff,"contour_id: %d \n", id);
01190                 size = _3Dcontour[id]->GetNumberOfPoints();
01191 //Ramiro                fprintf(ff,"numberOfPoints: %d \n", size);
01192             for ( i=0 ; i<size  ;i++ ){
01193                 _3Dcontour[id]->GetPoint( i , point );
01194                         fprintf(ff,"%f %f %f %d\n", point[0], point[1],point[2],id);
01195             }
01196         }
01197 }

Here is the caller graph for this function:

void marAxis::SaveExisting3DContours ( FILE *  ff  )  [inherited]

Definition at line 1199 of file marAxis.cpp.

References marAxis::_3Dcontour, and marAxis::Save3Dcontour().

Referenced by wxQuantificationWidget::OnSaveContours3D_BT().

01200 {
01201         if (ff!=NULL)
01202         {
01203                 // counting existing 3Dcontours
01204                 int acum=0;
01205                 int i,size=_3Dcontour.size();
01206                 for (i=0; i<size; i++)
01207                 {
01208                         if (_3Dcontour[i]!=NULL)
01209                         {
01210                                 acum++;
01211                         }
01212                 }
01213 //Ramiro                fprintf(ff, "NumberOf3DContours: %d \n", acum);
01214                 // saving existing 3Dcontours
01215                 for (i=0; i<size; i++)
01216                 {
01217                         Save3Dcontour(ff,i);
01218                 }               
01219         }
01220 }

Here is the call graph for this function:

Here is the caller graph for this function:

marContour * marAxis::getContour ( int  i,
kVolume *  vol 
) [inherited]

Definition at line 1159 of file marAxis.cpp.

References marAxis::_contours, and marAxis::createContour().

Referenced by marAxis::calculateReferenceAverDiam(), marAxis::create2DDiameterMax(), marAxis::create2DDiameterMin(), marAxis::create3Dcontour(), and marAxis::getAverageArea().

01160 {                                                               
01161         if (_contours[i]==NULL){ createContour(i, vol); }
01162         return _contours[i];
01163 } 

Here is the call graph for this function:

Here is the caller graph for this function:

kVolume * marAxis::getSlice ( int  i,
kVolume *  vol 
) [inherited]

Definition at line 1165 of file marAxis.cpp.

References marAxis::_slices, and marAxis::createSlice().

Referenced by marAxis::create2Dcontour(), create2Dcontours(), marAxis::createSliceImage(), generatePoints(), histogram(), markUpLumen(), performAND(), performUnion(), and performXOR().

01166 {
01167         if (_slices[i]==NULL){ createSlice( i , vol ); }
01168         return _slices[i];
01169 }

Here is the call graph for this function:

Here is the caller graph for this function:

vtkProbeFilter * marAxis::get3DSlice ( int  i,
kVolume *  vol 
) [inherited]

Definition at line 1223 of file marAxis.cpp.

References marAxis::_3Dslices, and marAxis::create3DSlice().

Referenced by marAxis::createSlice().

01223                                                       {                 // VISUALISATION-VTK 3D
01224         if (_3Dslices[i]==NULL){ create3DSlice(i,vol); }
01225         return _3Dslices[i];
01226 }

Here is the call graph for this function:

Here is the caller graph for this function:

vtkPoints * marAxis::get3Dcontour ( int  i,
kVolume *  vol 
) [inherited]

Definition at line 1228 of file marAxis.cpp.

References marAxis::_3Dcontour, and marAxis::create3Dcontour().

01228                                                    {                            // VISUALISATION-VTK 3D
01229         if (_3Dcontour[i]==NULL){ create3Dcontour(i, vol); }
01230         return _3Dcontour[i];
01231 }

Here is the call graph for this function:

vtkImageData * marAxis::getSliceImage ( int  i,
kVolume *  vol 
) [inherited]

Definition at line 1233 of file marAxis.cpp.

References marAxis::_quantificationImages, and marAxis::createSliceImage().

Referenced by generateFile().

01233                                                        {                        // VISUALISATION-VTK 2D
01234         if (_quantificationImages[i]==NULL){ createSliceImage(i,vol); }
01235         return _quantificationImages[i];
01236 }

Here is the call graph for this function:

Here is the caller graph for this function:

vtkPolyData * marAxis::get2Dcontour ( int  i,
kVolume *  vol 
) [inherited]

Definition at line 1238 of file marAxis.cpp.

References marAxis::_2Dcontours, and marAxis::create2Dcontour().

Referenced by marAxis::createContour().

01238                                                       {                 // VISUALISATION-VTK 2D
01239         if (_2Dcontours[i]==NULL){ create2Dcontour(i,vol); }
01240         return _2Dcontours[i];
01241 }

Here is the call graph for this function:

Here is the caller graph for this function:

vtkPoints * marAxis::get2DDiameterMin ( int  i,
kVolume *  vol 
) [inherited]

Definition at line 1243 of file marAxis.cpp.

References marAxis::_2DDiameterMin, and marAxis::create2DDiameterMin().

01243                                                         {               // VISUALISATION-VTK 2D
01244         if (_2DDiameterMin[i]==NULL){ create2DDiameterMin(i,vol); }
01245         return _2DDiameterMin[i];
01246 }

Here is the call graph for this function:

vtkPoints * marAxis::get2DDiameterMax ( int  i,
kVolume *  vol 
) [inherited]

Definition at line 1248 of file marAxis.cpp.

References marAxis::_2DDiameterMax, and marAxis::create2DDiameterMax().

01248                                                         {               // VISUALISATION-VTK 2D
01249         if (_2DDiameterMax[i]==NULL){ create2DDiameterMax(i,vol); }
01250         return _2DDiameterMax[i];
01251 }

Here is the call graph for this function:

void marAxis::replaceContour2D ( int  i,
int  size,
double *  vx,
double *  vy 
) [inherited]

Definition at line 642 of file marAxis.cpp.

References marAxis::_2Dcontours, marAxis::createContour(), and marAxis::EraseContour().

Referenced by marInterfaceCT::replaceContour2D(), and wxQuantificationWidget::SetManualContour_ReplaceContour().

00642                                                                   {
00643 
00644         EraseContour(i);
00645 
00646 
00647         vtkPoints *_pts = vtkPoints::New();
00648         _pts->SetNumberOfPoints(size);
00649         int j;
00650 
00651         for (j=0 ; j<size ; j++){
00652                 _pts->SetPoint(j,       vx[j]   , vy[j] , 0 );
00653         }
00654 //      _pts->SetPoint(0,       vx[0]   , vy[0] , 0 );
00655 
00656         vtkCellArray *lines = vtkCellArray::New();
00657         lines->InsertNextCell( size );
00658         for ( j=0 ; j<size+1 ; j++ ){
00659                 lines->InsertCellPoint(j % size );
00660         }
00661 
00662         vtkPolyData *_pd = vtkPolyData::New();
00663         _pd->SetPoints( _pts );
00664         _pd->SetLines( lines );
00665         lines->Delete();  //do not delete lines ??
00666         _pts->Delete();  
00667 
00668         _2Dcontours[i]=_pd;
00669         createContour(i,NULL);
00670 }

Here is the call graph for this function:

Here is the caller graph for this function:

void marAxis::EraseContour ( int  i  )  [inherited]

Definition at line 614 of file marAxis.cpp.

References marAxis::_2Dcontours, marAxis::_2DDiameterMax, marAxis::_2DDiameterMin, marAxis::_3Dcontour, and marAxis::_contours.

Referenced by marInterfaceCT::EraseContour(), marAxis::replaceContour2D(), and wxQuantificationWidget::SetManualContour_AddPoint_2DWorld().

00614                                {
00615         if (_3Dcontour[i]!=NULL){
00616                 _3Dcontour[i]->Delete();
00617                 _3Dcontour[i]=NULL;
00618         }
00619 
00620         if (_2DDiameterMax[i]!=NULL){
00621                 _2DDiameterMax[i]->Delete();
00622                 _2DDiameterMax[i]=NULL;
00623         }
00624 
00625         if (_2DDiameterMin[i]!=NULL){
00626                 _2DDiameterMin[i]->Delete();
00627                 _2DDiameterMin[i]=NULL;
00628         }
00629 
00630         if (_2Dcontours[i]!=NULL){
00631                 _2Dcontours[i]->Delete();
00632                 _2Dcontours[i]=NULL;
00633         }
00634 
00635         if (_contours[i]!=NULL){
00636                 delete _contours[i];
00637                 _contours[i]=NULL;
00638         }
00639 }

Here is the caller graph for this function:

void marAxis::createEmptyVectors (  )  [inherited]

Definition at line 1033 of file marAxis.cpp.

References marAxis::_2Dcontours, marAxis::_2DDiameterMax, marAxis::_2DDiameterMin, marAxis::_3Dcontour, marAxis::_3Dslices, marAxis::_contours, marAxis::_quantificationImages, marAxis::_slices, marAxis::clearAllVectors(), and marAxis::getNumberOfSplinePoints().

Referenced by marExperiment::RecalculateAxis(), and marExperiment::RegenerateAxis().

01034 {
01035         int nCnts = ( int ) getNumberOfSplinePoints( );
01036         clearAllVectors();
01037         int i;
01038 //      int xxxx=getNumberOfContours();
01039         for (i=0;i<nCnts;i++){
01040                 _contours.push_back( NULL );
01041                 _slices.push_back( NULL );
01042                 _3Dslices.push_back( NULL );
01043                 _3Dcontour.push_back( NULL );
01044                 _quantificationImages.push_back( NULL );
01045                 _2Dcontours.push_back( NULL );
01046                 _2DDiameterMin.push_back( NULL );
01047                 _2DDiameterMax.push_back( NULL );
01048         }
01049 }

Here is the call graph for this function:

Here is the caller graph for this function:

void marAxis::clearAllVectors (  )  [inherited]

Definition at line 1051 of file marAxis.cpp.

References marAxis::_2Dcontours, marAxis::_2DDiameterMax, marAxis::_2DDiameterMin, marAxis::_3Dcontour, marAxis::_3Dslices, marAxis::_contours, marAxis::_quantificationImages, and marAxis::_slices.

Referenced by marAxis::createEmptyVectors(), and marAxis::Delete().

01052 {
01053         unsigned int i;
01054         
01055         for (i=0;i<_contours.size();i++){
01056                 if (_contours[i]!=NULL) {                                       //  DATA-MODEL-2D
01057                         delete _contours[i];
01058                         _contours[i]=NULL;
01059                 }
01060         }
01061         _contours.clear();
01062 
01063         for (i=0;i<_slices.size();i++){                                 //  DATA-MODEL-Voxel XxYx1
01064                 if (_slices[i]!=NULL) {                         
01065                         delete _slices[i];
01066                         _slices[i]=NULL;
01067                 }
01068         }
01069         _slices.clear();
01070 
01071 
01072         for (i=0;i<_3Dslices.size();i++){                                       //  VISUALISATION_VTK 3D
01073                 if (_3Dslices[i]!=NULL) {
01074                         _3Dslices[i]->Delete();
01075                         _3Dslices[i]=NULL;
01076                 }
01077         }
01078         _3Dslices.clear();
01079 
01080         for (i=0;i<_3Dcontour.size();i++){                              //  VISUALISATION_VTK 3D
01081                 if (_3Dcontour[i]!=NULL) {                              
01082                         _3Dcontour[i]->Delete();
01083                         _3Dcontour[i]=NULL;
01084                 }
01085         }
01086         _3Dcontour.clear();
01087 
01088         for (i=0;i<_quantificationImages.size();i++){   //  VISUALISATION_VTK 2D
01089                 if (_quantificationImages[i]!=NULL) {                           
01090 //                      _quantificationImages[i]->Delete();
01091 //                      _quantificationImages[i]=NULL;
01092                 }
01093         }
01094         _quantificationImages.clear();
01095 
01096         for (i=0;i<_2Dcontours.size();i++){                             //  VISUALISATION_VTK 2D
01097                 if (_2Dcontours[i]!=NULL) {                             
01098 // EED ???  This object was allready erased bye the VTK pipeline
01099 //                      _2Dcontours[i]->Delete();
01100                         _2Dcontours[i]=NULL;
01101                 }
01102         }
01103         _2Dcontours.clear();
01104 
01105         for (i=0;i<_2DDiameterMin.size();i++){                  //  VISUALISATION_VTK 2D
01106                 if (_2DDiameterMin[i]!=NULL) {                          
01107                         _2DDiameterMin[i]->Delete() ;
01108                         _2DDiameterMin[i]=NULL;
01109                 }
01110         }
01111         _2DDiameterMin.clear();
01112 
01113         for (i=0;i<_2DDiameterMax.size();i++){                  //  VISUALISATION_VTK 2D
01114                 if (_2DDiameterMax[i]!=NULL) {                          
01115                         _2DDiameterMax[i]->Delete();
01116                         _2DDiameterMax[i]=NULL;
01117                 }
01118         }
01119         _2DDiameterMax.clear();
01120 
01121 }

Here is the caller graph for this function:

void marAxis::eraseContourVectorsContent (  )  [inherited]

Definition at line 1123 of file marAxis.cpp.

References marAxis::_2Dcontours, marAxis::_2DDiameterMax, marAxis::_2DDiameterMin, marAxis::_3Dcontour, and marAxis::_contours.

Referenced by marExperiment::ClearContours(), and marExperiment::RegenerateSignal().

01124 {
01125         unsigned int i;
01126         for (i=0;i<_contours.size();i++){
01127                 if (_contours[i]!=NULL) {                                       //  DATA-MODEL-2D
01128                         delete _contours[i];
01129                         _contours[i]=NULL;
01130                 }
01131         }
01132         for (i=0;i<_2Dcontours.size();i++){                             //  VISUALISATION_VTK 2D
01133                 if (_2Dcontours[i]!=NULL) {                             
01134                         _2Dcontours[i]->Delete();
01135                         _2Dcontours[i]=NULL;
01136                 }
01137         }
01138         for (i=0;i<_2DDiameterMin.size();i++){                          //  VISUALISATION_VTK 2D
01139                 if (_2DDiameterMin[i]!=NULL) {                          
01140                         _2DDiameterMin[i]->Delete();
01141                         _2DDiameterMin[i]=NULL;
01142                 }
01143         }
01144         for (i=0;i<_2DDiameterMax.size();i++){                          //  VISUALISATION_VTK 2D
01145                 if (_2DDiameterMax[i]!=NULL) {                          
01146                         _2DDiameterMax[i]->Delete();
01147                         _2DDiameterMax[i]=NULL;
01148                 }
01149         }
01150         for (i=0;i<_3Dcontour.size();i++){                              //  VISUALISATION_VTK 3D
01151                 if (_3Dcontour[i]!=NULL) {                              
01152                         _3Dcontour[i]->Delete();
01153                         _3Dcontour[i]=NULL;
01154                 }
01155         }
01156 }

Here is the caller graph for this function:

void marAxis::set_points_disc ( PPPOINTAXE  p  )  [inline, inherited]

Definition at line 182 of file marAxis.h.

Referenced by marExperiment::extractVascularTree().

00182 { _points_disc = p; };

Here is the caller graph for this function:

double marAxis::getTotalLength (  )  [inherited]

Definition at line 1280 of file marAxis.cpp.

References marAxis::_totalAxisLenght, and marAxis::calculateTotalAxisLenght().

01280                               {
01281         if (_totalAxisLenght==-1){
01282                 calculateTotalAxisLenght();
01283         }
01284         return _totalAxisLenght;
01285 }

Here is the call graph for this function:

double marAxis::getSubAxisLength (  )  [inherited]

Definition at line 1292 of file marAxis.cpp.

References marAxis::_subAxisLenght, and marAxis::calculateSubAxisLength().

01292                                 {
01293         if (_subAxisLenght==-1){
01294                 calculateSubAxisLength();
01295         }
01296         return _subAxisLenght;
01297 }

Here is the call graph for this function:

double marAxis::getReferenceArea ( kVolume *  vol  )  [inherited]

Definition at line 1317 of file marAxis.cpp.

References marAxis::_referenceArea, and marAxis::calculateReferenceArea().

01317                                             {
01318         if (_referenceArea==-1){
01319                 calculateReferenceArea(vol);
01320         }
01321         return _referenceArea;
01322 }

Here is the call graph for this function:

double marAxis::getReferenceAverDiam ( kVolume *  vol  )  [inherited]

Definition at line 1335 of file marAxis.cpp.

References marAxis::_referenceAverDiam, and marAxis::calculateReferenceAverDiam().

01335                                                 {
01336         if (_referenceAverDiam==-1){
01337                 calculateReferenceAverDiam(vol);
01338         }
01339         return _referenceAverDiam;
01340 }

Here is the call graph for this function:

double marAxis::getAverageArea ( int  pIni,
int  pEnd,
kVolume *  vol 
) [inherited]

Definition at line 1299 of file marAxis.cpp.

References marAxis::_points, and marAxis::getContour().

Referenced by marAxis::calculateReferenceArea().

01299                                                               {
01300         marContour      *marcontourHealthy;
01301         int                     ihealthySlice,itemp;
01302         double          acumArea        =       0;
01303         for (ihealthySlice = pIni ; ihealthySlice <= pEnd ; ihealthySlice++ ){
01304                 itemp=ihealthySlice;
01305                 if (itemp<0)                            { itemp=0;                                      }
01306                 if (itemp>=_points.size( ))     { itemp=_points.size( )-1;      }
01307                 marcontourHealthy = getContour( itemp , vol );
01308                 acumArea = acumArea + marcontourHealthy->getArea();
01309         }
01310         return acumArea / (pEnd - pIni + 1);
01311 }

Here is the call graph for this function:

Here is the caller graph for this function:

void marAxis::reset (  )  [virtual, inherited]

General methods

Implements marObject.

Definition at line 1343 of file marAxis.cpp.

References marAxis::_actualQuant, marAxis::_description, marAxis::_finishQuant, marAxis::_healthySlice, marAxis::_referenceArea, marAxis::_referenceAverDiam, marAxis::_startQuant, marAxis::_subAxisLenght, and marAxis::Delete().

Referenced by marAxis::load(), and marAxis::marAxis().

01344 {
01345 //EED Borrame
01346 //    unsigned int i;
01347     kCurve::reset( );
01348 
01349     _description                = "";
01350     _healthySlice               = -1;
01351     _startQuant                 = -1;
01352     _finishQuant                = -1;
01353     _actualQuant                = -1;
01354 
01355         _subAxisLenght          = -1;
01356         _referenceArea          = -1;
01357         _referenceAverDiam      = -1;
01358 
01359         Delete( );
01360 
01361 // EED Borrame  
01362 /*
01363     for( i = 0; i < _contours.size( ); i++ )
01364       delete _contours[ i ];
01365     _contours.clear( );
01366     for( i = 0; i < _slices.size( ); i++ )
01367         delete _slices[ i ];
01368     _slices.clear( );
01369 */
01370 }

Here is the call graph for this function:

Here is the caller graph for this function:

void marAxis::copyFrom ( const marObject from  )  [virtual, inherited]

Implements marObject.

Definition at line 1373 of file marAxis.cpp.

01374 { // TODO
01375 }

bool marAxis::save ( std::ofstream &  os  )  [virtual, inherited]

Persistence methods

Implements marObject.

Definition at line 1378 of file marAxis.cpp.

References marAxis::_contours, marAxis::_description, marAxis::getNumberOfContours(), and marAxis::INDX_count.

01379 {
01380     double p[ INDX_count ];
01381     unsigned int i;
01382 
01383     i = _description.length( );
01384     os.write( ( const char* )&i, sizeof( int ) );
01385     os.write( ( char* )_description.c_str( ), i * sizeof( char ) );
01386 
01387     i = getNumberOfControlPoints( );
01388     os.write( ( const char* )&i, sizeof( int ) );
01389     for( i = 0; i < getNumberOfControlPoints( ); i++ ) {
01390 
01391         memcpy( p, _controlPoints[ i ], 3 * sizeof( double ) );
01392         memcpy( p + 3, _controlState[ i ],
01393                 ( INDX_count - 3 ) * sizeof( double ) );
01394         os.write( ( const char* )p, INDX_count * sizeof( double ) );
01395 
01396     } // rof
01397     i = getNumberOfContours( );
01398     os.write( ( const char* )&i, sizeof( int ) );
01399     for( i = 0; i < getNumberOfContours( ); i++ )
01400       _contours[ i ]->save( os );
01401 
01402     return( true );
01403 }

Here is the call graph for this function:

bool marObject::save ( std::string &  nw  )  [inherited]

Persistence methods

Definition at line 51 of file marObject.cpp.

References marObject::save().

00052 {
00053     std::ofstream os( nw.c_str( ) );
00054 
00055     if( os ) {
00056 
00057         save( os );
00058         os.close( );
00059         return( true );
00060 
00061     } // fi
00062 
00063     return( false );
00064 }

Here is the call graph for this function:

bool marAxis::load ( std::ifstream &  is  )  [virtual, inherited]

Implements marObject.

Definition at line 1406 of file marAxis.cpp.

References marAxis::_contours, marAxis::_description, marObject::getParameters(), marAxis::INDX_count, and marAxis::reset().

Referenced by marExperiment::load().

01407 {
01408     double p[ INDX_count ];
01409     int i, n;
01410 
01411     reset( );
01412 
01413     is.read( ( char* )&n, sizeof( int ) );
01414     _description.resize( n );
01415     is.read( ( char* )_description.c_str( ), n * sizeof( char ) );
01416 
01417     is.read( ( char* )&n, sizeof( int ) );
01418     for( i = 0; i < n; i++ ) {
01419 
01420         is.read( ( char* )p, INDX_count * sizeof( double ) );
01421         addControlPoint( p, p + 3 );
01422 
01423     } // rof
01424     is.read( ( char* )&n, sizeof( int ) );
01425     for( i = 0; i < n; i++ ) {
01426 
01427       _contours.push_back( new marContour( 0, getParameters( ) ) );
01428       _contours[ i ]->load( is );
01429 
01430     } // rof
01431     return( true );
01432 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool marObject::load ( std::string &  nr  )  [inherited]

Definition at line 67 of file marObject.cpp.

References marObject::load().

00068 {
00069     std::ifstream is( nr.c_str( ) );
00070 
00071     if( is ) {
00072 
00073         load( is );
00074         is.close( );
00075         return( true );
00076 
00077     } // fi
00078 
00079     return( false );
00080 }

Here is the call graph for this function:

vtkPolyData * marAxis::Draw (  )  [inherited]

Definition at line 1434 of file marAxis.cpp.

References marAxis::_allData, and marAxis::_points.

Referenced by wxSurfaceWidget::AddAxisActors(), wxQuantificationWidgetCT::AddAxisActors(), wxQuantificationWidget::AddAxisActors(), wxEmptyPanelWidget_2::PaintVascularTree_MH_JFC(), vtk3DSurfaceSTLWidget::ShowMARACASDataAndAxe(), vtk3DQuantSurfaceWidget::ShowMARACASDataAndAxe(), and vtk3DQuantSurfaceWidget::ShowMARACASDataAndAxeCT().

01435 {
01436   unsigned int i, j;
01437   double *p;
01438 
01439   vtkPoints* allPoints = vtkPoints::New( );
01440   vtkCellArray* allTopology = vtkCellArray::New( );
01441 
01442   allTopology->InsertNextCell( _points.size( ) );
01443   for( i = 0, j=0; i < _points.size( ); i++, j++ ) {
01444     p = _points[i];
01445     allPoints->InsertNextPoint( p[ 0 ],  p[ 1 ], p[ 2 ] );
01446     allTopology->InsertCellPoint( j );
01447   } // rof
01448 
01449   _allData = vtkPolyData::New( );
01450   _allData->SetPoints( allPoints );
01451   _allData->SetLines( allTopology );
01452   allPoints->Delete();
01453   allTopology->Delete();
01454 
01455   return ( _allData );
01456 }

Here is the caller graph for this function:

vtkPolyData * marAxis::GetAxisData (  )  [inherited]

Definition at line 1458 of file marAxis.cpp.

References marAxis::_allData, marAxis::INDX_count, marAxis::INDX_RAYON, marAxis::INDX_X, marAxis::INDX_Y, and marAxis::INDX_Z.

Referenced by TreeExtraction_MH_JFC::Execute(), wxSTLWidget_02::ExtractTree2_JF(), and TreeExtraction_MH_JFC::FindVit().

01459 {
01460         unsigned int i;
01461         double point[ 3 ];
01462         double radio;
01463         double p[marAxis::INDX_count];
01464 
01465 
01466         vtkPoints                       *allPoints              = vtkPoints::New( );
01467         vtkCellArray            *allTopology    = vtkCellArray::New( );
01468         vtkDoubleArray          *allRadios              = vtkDoubleArray::New( );
01469         allRadios->SetName("radio");
01470 
01471         for( i = 0; i < _controlPoints.size( ); i++ ) {
01472                 getControlPoint(i, p, p+3);
01473                 point[ 0 ]      =  p[marAxis::INDX_X];
01474                 point[ 1 ]      =  p[marAxis::INDX_Y];
01475                 point[ 2 ]      =  p[marAxis::INDX_Z];
01476                 radio           =  p[marAxis::INDX_RAYON]*2.0;
01477                 allPoints    -> InsertPoint( i, point[ 0 ] ,  point[ 1 ] , point[ 2 ]  );  //para saber exactamante el indice que se le asigno
01478 
01479                 allRadios       -> InsertValue(i,radio);
01480  
01481     if(i>0){
01482        allTopology->InsertNextCell(2);
01483        allTopology->InsertCellPoint(i);
01484        allTopology->InsertCellPoint(i-1);
01485       }
01486 
01487         } // rof
01488 
01489         _allData = vtkPolyData::New( );
01490         _allData        -> SetPoints( allPoints );
01491         _allData        -> SetLines( allTopology );
01492         _allData        -> GetPointData()->SetScalars(allRadios);
01493 
01494         
01495         return ( _allData );
01496 }

Here is the caller graph for this function:

void marAxis::Delete (  )  [inherited]

Definition at line 1498 of file marAxis.cpp.

References marAxis::_allData, marAxis::_points, marAxis::_signal, and marAxis::clearAllVectors().

Referenced by marAxis::create2Dcontour(), and marAxis::reset().

01498                      {
01499         clearAllVectors();
01500 
01501         int i;
01502         for (i=0;i<_points.size();i++){         
01503                 if (_points[i]!=NULL) {                         
01504                         delete _points[i];
01505                         _points[i]=NULL;
01506                 }
01507         }
01508         _points.clear();
01509         _signal.clear();
01510 
01511 
01512         if(_allData) {
01513                 _allData->Delete();
01514                 _allData = NULL;
01515         }
01516 
01517 //  reset();
01518 }

Here is the call graph for this function:

Here is the caller graph for this function:

double* marAxis::getPoints ( int  i  )  [inline, inherited]

Definition at line 205 of file marAxis.h.

Referenced by create3Dcontours(), generatePoints(), and wxQuantificationWidgetCT::MoveSlider().

00205 { return _points[i]; }; 

Here is the caller graph for this function:

void marAxis::AddPointToList ( double  x,
double  y,
double  z,
int  signal 
) [inherited]

Definition at line 1539 of file marAxis.cpp.

References marAxis::_points, and marAxis::_signal.

Referenced by wxMaracas_ManualTree_MPRDlg::ExportPoints().

01540 {
01541         double *p;
01542         p=(double *)malloc(sizeof(double)*3);
01543         p[0]=x;
01544         p[1]=y;
01545         p[2]=z;
01546         _points.push_back( p );
01547         _signal.push_back( signal );
01548 }

Here is the caller graph for this function:

void marObject::setParameters ( marParameters p  )  [inherited]

Parameters assignation methods.

You can assign a marParameters object by reference (setParameters) or by value (copyParameters). Besides, if you want to make your actual reference to be by value, call makeACopyParameters.

Definition at line 34 of file marObject.cpp.

References marObject::_parameters, and marObject::_parametersCopied.

00035 {
00036     if( _parametersCopied && _parameters != NULL ) delete _parameters;
00037     _parameters = p;
00038     _parametersCopied = false;
00039 }

void marObject::copyParameters ( marParameters p  )  [inherited]

Definition at line 42 of file marObject.cpp.

References marObject::_parameters, and marObject::_parametersCopied.

00043 {
00044     if( _parametersCopied && _parameters != NULL ) delete _parameters;
00045     _parameters = new marParameters( );
00046     *_parameters = *p;
00047     _parametersCopied = true;
00048 }

void marObject::makeACopyParameters (  )  [inline, inherited]

Definition at line 48 of file marObject.h.

00049     {
00050             copyParameters( _parameters );
00051     }

marParameters* marObject::getParameters (  )  [inline, inherited]

Parameters analizers.

Definition at line 55 of file marObject.h.

Referenced by adjustWall(), marAxis::calculateSignal(), marAxis::create2Dcontour(), marAxis::create2DDiameterMax(), marAxis::create2DDiameterMin(), create2DDiametersMax(), create2DDiametersMin(), marAxis::create3DSlice(), marAxis::createContour(), createContours(), marAxis::createSlice(), marAxis::doSpline(), extractLumen(), marExperiment::extractVascularTree(), generatePoints(), marDynData::getActualVoxel(), histogram(), marExperiment::initExperiment(), marExperiment::load(), marAxis::load(), marRAW2Files::loadActualSerie(), marRAW2AsciiFiles::loadActualSerie(), marRAWFiles::loadActualSerie(), marDynData::loadData(), marSimpleDicom::loadVolumeDXMM(), wxEmptyPanelWidget_2::OnBtnExtractTree_MH_JFC(), wxSurfaceWidget::OnManualAxis(), vtk3DQuantSurfaceWidget::Set3DSliceActor(), vtk3DSurfaceWidget::SetInitialPoint(), setStartIndex(), marExperimentCT::updateCalcPercentage(), updateCalcPercentage(), marExperimentCT::updateDiscontinuityThreshold(), marExperimentCT::updateLumenPercentage(), and updateLumenPercentage().

00055 { return( _parameters ); };

Here is the caller graph for this function:

bool marObject::parametersOwned (  )  [inline, inherited]

Definition at line 56 of file marObject.h.

00056 { return( _parametersCopied ); };


Member Data Documentation

double marAxisCT::avgValue [private]

Definition at line 109 of file marAxisCT.h.

double marAxisCT::stdValue [private]

Definition at line 110 of file marAxisCT.h.

int marAxisCT::startIndex [private]

Definition at line 111 of file marAxisCT.h.

Referenced by create2Dcontours(), getStartIndex(), and setStartIndex().

double marAxisCT::maxSignal [private]

Definition at line 112 of file marAxisCT.h.

Referenced by adjustContour(), markUpLumen(), and setStartIndex().

std::vector<marAxisContours* > marAxis::quantContours [protected, inherited]

Definition at line 262 of file marAxis.h.

Referenced by adjustContour(), cleanContours(), create2Dcontours(), create2DDiametersMax(), create2DDiametersMin(), create3Dcontours(), createContours(), createEmptyContours(), createSignals(), eraseContours(), eraseContoursPartial(), extractLumen(), generateFile(), get2Dcontour(), get2DDiameterMax(), get2DDiameterMin(), get3Dcontour(), getContour(), getContourType(), getMaxIntensity(), getNumberOfContours(), getSignal(), markUpLumen(), performAND(), performUnion(), performXOR(), replaceContour2D(), searchContour(), setStartIndex(), updateCalcPercentage(), and updateLumenPercentage().

std::vector<marPoint *> marAxis::vesselPoints [protected, inherited]

Definition at line 263 of file marAxis.h.

Referenced by eraseContours(), getPoint(), getPointSize(), and markUpLumen().

std::vector<marIsocontour *> marAxis::lumenContour [protected, inherited]

Definition at line 264 of file marAxis.h.

Referenced by createEmptyContours(), eraseContours(), eraseContoursPartial(), generatePoints(), and markUpLumen().

bool marAxis::calibration [protected, inherited]

Definition at line 265 of file marAxis.h.

Referenced by create2Dcontours(), getCalibration(), marAxis::marAxis(), and setCalibration().


The documentation for this class was generated from the following files:
Generated on Wed Jul 29 16:35:59 2009 for creaMaracasVisu_lib by  doxygen 1.5.3