marTclInterface.h File Reference

#include "../kernel/marInterface.h"
#include <kgfo/volstat.hxx>
#include <tcl.h>
#include <tk.h>
#include <wx/list.h>
#include <wx/string.h>
#include <vtkCellArray.h>
#include <vtkCellLocator.h>
#include <vtkImageData.h>
#include <vtkMath.h>
#include <vtkPoints.h>
#include <vtkPolyData.h>
#include <vtkTclUtil.h>
Include dependency graph for marTclInterface.h:

Go to the source code of this file.

Functions

void freeAllMaracasInterfaces_dll ()
wxStringList params_dll ()
void setParams_dll (wxStringList &raParams)
bool saveParams_dll (std::string &fName)
bool loadParams_dll (std::string &fName)
void SetROIStep_dll (double vWidth)
double GetActualVoxelSize_dll ()
wxStringList studies_dll ()
wxStringList studyData_dll (std::string &study)
wxStringList series_dll (std::string &study)
wxStringList serieData_dll (std::string &study, std::string &serie)
void SubtractSeries_dll (std::string &sl, std::string &sr, std::string &ss, std::string &description)
bool LoadImages_dll ()
void CastVolume_dummy ()
void LoadTkImage_dummy (uchar **image, int w, int h, std::string &tkName, Tcl_Interp *interp)
void LoadTkImages_dll (wxStringList &tkNames, Tcl_Interp *interp)
int GetNumberOfImages_dll ()
wxStringList GetImagesNumbers_dll ()
double GetImageIntensity_dll (int x, int y, int z)
ushortGetProfilFromTotalVolume_dll (int xO, int yO, int zO, int xF, int yF, int zF)
void GetAreaValuesFromTotalVolume_dll (int xO, int yO, int zO, int xF, int yF, int zF, int *min, int *max, int *avg, int *sd, int *size)
bool SaveExperiment_dll (std::string &fName)
bool LoadExperiment_dll (std::string &fName)
void InitExperiment_dll (int *voi)
void SetStartPoint_dll (int x, int y, int z)
void ExtractAxes_dll ()
int GetNumberOfAxes_dll ()
vtkPolyData * GetAllAxes_dll ()
vtkPolyData * GetActualAxis_dll ()
int GetActualAxisNumberOfPoints_dll ()
double * GetActualAxisPoint_dll (int i)
vtkImageData * GetActualAxisSlice_dll (int i)
void PrepareQuantification_dll (int i)
double GetAxisLength_dll ()
void GetImageRange_dll (int *min, int *max)
vtkImageData * GetVTKVolume_dll ()
int IntersectWithLine_dll (vtkCellLocator *iCellLocator, double x1, double y1, double z1, double x2, double y2, double z2, double tol, double *xI, double *yI, double *zI)
void TclPerpendiculars_dll (double xN, double yN, double zN, double angle, double *xP1, double *yP1, double *zP1, double *xP2, double *yP2, double *zP2)

Variables

static marInterface MyMaracasData
static kVolume * _ucharVol = NULL

Function Documentation

void CastVolume_dummy (  ) 

Definition at line 124 of file marTclInterface.h.

References marInterface::_dicom, _ucharVol, and marFilesBase::getVolume().

Referenced by LoadTkImages_dll().

00125 {
00126         if( _ucharVol ) delete _ucharVol;
00127         _ucharVol = new kVolume( *( MyMaracasData._dicom->getVolume( ) ) );
00128 
00129         _ucharVol->convertScale( kVolume::UCHAR, 0, 255 );
00130 
00131 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ExtractAxes_dll (  ) 

Definition at line 286 of file marTclInterface.h.

References marInterface::_experiment, and marExperiment::extractVascularTree().

00287 {
00288     MyMaracasData._experiment->extractVascularTree( );
00289 }

Here is the call graph for this function:

void freeAllMaracasInterfaces_dll (  ) 

Definition at line 23 of file marTclInterface.h.

References _ucharVol, and marInterface::reset().

00024 {
00025         MyMaracasData.reset( );
00026         if( _ucharVol ) delete _ucharVol;
00027         _ucharVol = NULL;
00028 }

Here is the call graph for this function:

vtkPolyData* GetActualAxis_dll (  ) 

Definition at line 335 of file marTclInterface.h.

References marInterface::_experiment, marExperiment::getAxis(), marExperiment::getDynData(), marDynData::getVolume(), and marAxis::INDX_count.

00336 {
00337     int i, j, h;
00338     double p[ marAxis::INDX_count ];
00339     marAxis* tmp;
00340 
00341     vtkPoints* points = vtkPoints::New( );
00342     vtkCellArray* topology = vtkCellArray::New( );
00343 
00344     j = 0;
00345     h = MyMaracasData._experiment->getDynData( )->getVolume( )->getYdim( );
00346     tmp = MyMaracasData._experiment->getAxis( );
00347     topology->InsertNextCell( tmp->getNumberOfControlPoints( ) );
00348     for( i = 0; i < tmp->getNumberOfControlPoints( ); i++ ) {
00349 
00350                 tmp->getControlPoint( i, p, p + 3 );
00351                 topology->InsertCellPoint( j++ );
00352                 points->InsertNextPoint( p[ 0 ], h - 1 - p[ 1 ], p[ 2 ] );
00353 
00354     } // rof
00355 
00356     vtkPolyData* data = vtkPolyData::New( );
00357     data->SetPoints( points );
00358     data->SetLines( topology );
00359     
00360     points->Delete();
00361     topology->Delete();
00362 
00363     return( data );
00364 }

Here is the call graph for this function:

int GetActualAxisNumberOfPoints_dll (  ) 

Definition at line 367 of file marTclInterface.h.

References marInterface::_experiment, and marExperiment::getAxis().

00368 {
00369     return( MyMaracasData._experiment->getAxis( )->getNumberOfControlPoints( ) );
00370 
00371 }

Here is the call graph for this function:

double* GetActualAxisPoint_dll ( int  i  ) 

Definition at line 374 of file marTclInterface.h.

References marInterface::_experiment, marExperiment::getAxis(), and marAxis::INDX_count.

00375 {
00376     double* ret = new double[ marAxis::INDX_count + 1 ];
00377 
00378     ret[ 0 ] = marAxis::INDX_count;
00379     MyMaracasData._experiment->getAxis( )->getControlPoint( i, ret + 1, ret + 4 );
00380     return( ret );
00381 }

Here is the call graph for this function:

vtkImageData* GetActualAxisSlice_dll ( int  i  ) 

Definition at line 384 of file marTclInterface.h.

00385 {
00386         //    return( MyMaracasData._experiment->GetSliceImage( i ) );
00387         return( NULL );
00388 
00389 }

double GetActualVoxelSize_dll (  ) 

Definition at line 66 of file marTclInterface.h.

References marInterface::_parameters, and marParameters::getVoxelSize().

00066                                  {
00067 
00068     return( MyMaracasData._parameters->getVoxelSize( ) );
00069 
00070 }

Here is the call graph for this function:

vtkPolyData* GetAllAxes_dll (  ) 

Definition at line 298 of file marTclInterface.h.

References marInterface::_experiment, marExperiment::getAxis(), marExperiment::getNumberOfAxes(), and marAxis::INDX_count.

00299 {
00300     int i, n, j;
00301     double p[ marAxis::INDX_count ];
00302     marAxis* tmp;
00303 
00304     vtkPoints* allPoints = vtkPoints::New( );
00305     vtkCellArray* allTopology = vtkCellArray::New( );
00306 
00307     j = 0;
00308     for( n = 0; n < MyMaracasData._experiment->getNumberOfAxes( ); n++ ) {
00309 
00310         tmp = MyMaracasData._experiment->getAxis( );
00311         allTopology->InsertNextCell( tmp->getNumberOfControlPoints( ) );
00312         for( i = 0; i < tmp->getNumberOfControlPoints( ); i++ ) {
00313 
00314             tmp->getControlPoint( i, p, p + 3 );
00315             allPoints->InsertNextPoint( p[ 0 ], p[ 1 ], p[ 2 ] );
00316             allTopology->InsertCellPoint( j );
00317                         j++;
00318 
00319         } // rof
00320 
00321     } // rof
00322 
00323     vtkPolyData* allData = vtkPolyData::New( );
00324     allData->SetPoints( allPoints );
00325     allData->SetLines( allTopology );
00326     
00327     allPoints->Delete();
00328     allTopology->Delete();
00329 
00330     return( allData );
00331 
00332 }

Here is the call graph for this function:

void GetAreaValuesFromTotalVolume_dll ( int  xO,
int  yO,
int  zO,
int  xF,
int  yF,
int  zF,
int *  min,
int *  max,
int *  avg,
int *  sd,
int *  size 
)

Definition at line 237 of file marTclInterface.h.

References marInterface::_dicom, and marFilesBase::getVolume().

00241 {
00242         kVolumeStat* stats = new kVolumeStat( MyMaracasData._dicom->getVolume( ) );
00243 
00244         stats->stats( xO, yO, zO, xF, yF, zF );
00245 
00246     *min = ( int )stats->getMin( );
00247     *max = ( int )stats->getMax( );
00248     *avg = ( int )stats->getAvg( );
00249     *sd = ( int )stats->getSD( );
00250     *size = stats->getSize( );
00251 
00252 }

Here is the call graph for this function:

double GetAxisLength_dll (  ) 

Definition at line 401 of file marTclInterface.h.

References marInterface::_experiment, and marExperiment::getAxis().

00402 {
00403     return( MyMaracasData._experiment->getAxis( )->length( ) );
00404 
00405 }

Here is the call graph for this function:

double GetImageIntensity_dll ( int  x,
int  y,
int  z 
)

Definition at line 206 of file marTclInterface.h.

References marInterface::_dicom, and marFilesBase::getVolume().

00207 {
00208     return( MyMaracasData._dicom->getVolume( )->getPixel( x, y, z ) );
00209 
00210 }

Here is the call graph for this function:

void GetImageRange_dll ( int *  min,
int *  max 
)

Definition at line 408 of file marTclInterface.h.

References marInterface::_experiment, marExperiment::getDynData(), and marDynData::getVolume().

00409 {
00410     double m, M;
00411 
00412     MyMaracasData._experiment->getDynData( )->getVolume( )->getMinMax( m, M );
00413     *min = ( int )m;
00414     *max = ( int )M;
00415 
00416 }

Here is the call graph for this function:

wxStringList GetImagesNumbers_dll (  ) 

Definition at line 199 of file marTclInterface.h.

References marInterface::_dicom.

00200 {
00201     return( MyMaracasData._dicom->getImageNumbers( ) );
00202 
00203 }

int GetNumberOfAxes_dll (  ) 

Definition at line 292 of file marTclInterface.h.

References marInterface::_experiment, and marExperiment::getNumberOfAxes().

00293 {
00294     return( MyMaracasData._experiment->getNumberOfAxes( ) );
00295 }

Here is the call graph for this function:

int GetNumberOfImages_dll (  ) 

Definition at line 192 of file marTclInterface.h.

References marInterface::_dicom, and marFilesBase::getVolume().

00193 {
00194     return( MyMaracasData._dicom->getVolume( )->getZdim( ) );
00195 
00196 }

Here is the call graph for this function:

ushort* GetProfilFromTotalVolume_dll ( int  xO,
int  yO,
int  zO,
int  xF,
int  yF,
int  zF 
)

Definition at line 213 of file marTclInterface.h.

References marInterface::_dicom.

00215 {
00216     int i;
00217         kVolumeStat* stats = new kVolumeStat( MyMaracasData._dicom->
00218                                                                                   getVolume( ) );
00219 
00220         stats->profile( xO, yO, zO, xF, yF, zF );
00221 
00222     ushort* r = new ushort[ stats->getSize( ) + 6 ];
00223 
00224     r[ 0 ] = stats->getSize( ) + 6;
00225     r[ 1 ] = ( ushort )stats->getMin( );
00226     r[ 2 ] = ( ushort )stats->getMax( );
00227     r[ 3 ] = ( ushort )stats->getAvg( );
00228     r[ 4 ] = ( ushort )stats->getSD( );
00229     r[ 5 ] = ( ushort )stats->getSize( );
00230     for( i = 0; i < stats->getSize( ); i++ )
00231                 r[ i + 6 ] = ( ushort )( stats->getValues( ) )[ i ];
00232     return( r );
00233 
00234 }

vtkImageData* GetVTKVolume_dll (  ) 

Definition at line 419 of file marTclInterface.h.

References marInterface::_experiment, marExperiment::getDynData(), and marDynData::getVolume().

00420 {
00421     return( MyMaracasData._experiment->getDynData( )->getVolume( )->castVtk( ) );
00422 
00423 }

Here is the call graph for this function:

void InitExperiment_dll ( int *  voi  ) 

Definition at line 269 of file marTclInterface.h.

References marInterface::_dicom, marInterface::_experiment, marFilesBase::freeVolume(), marExperiment::initExperiment(), and marExperiment::setVOI().

00270 {
00271     MyMaracasData._experiment->setVOI( voi );
00272     MyMaracasData._experiment->initExperiment( MyMaracasData._dicom->
00273                                                                                            getVolume( ) );
00274         //if( _ucharVol ) delete _ucharVol;
00275         //_ucharVol = NULL;
00276         MyMaracasData._dicom->freeVolume( );
00277 }

Here is the call graph for this function:

int IntersectWithLine_dll ( vtkCellLocator *  iCellLocator,
double  x1,
double  y1,
double  z1,
double  x2,
double  y2,
double  z2,
double  tol,
double *  xI,
double *  yI,
double *  zI 
)

Definition at line 426 of file marTclInterface.h.

00432 {
00433     float a0[ 3 ], a1[ 3 ], x[ 3 ], t, pcoords[ 3 ];
00434     int subId; 
00435 
00436     int returnVal;
00437  
00438     iCellLocator->Update( );
00439 
00440     a0[ 0 ] = x1; a0[ 1 ] = y1; a0[ 2 ] = z1;
00441     a1[ 0 ] = x2; a1[ 1 ] = y2; a1[ 2 ] = z2;
00442 
00443     returnVal = iCellLocator->IntersectWithLine( a0, a1, tol, t, x, pcoords, subId );
00444     ( *xI ) = x[ 0 ]; ( *yI ) = x[ 1 ]; ( *zI ) = x[ 2 ];
00445 
00446     return( returnVal );
00447 }

bool LoadExperiment_dll ( std::string &  fName  ) 

Definition at line 262 of file marTclInterface.h.

References marInterface::loadExperiment().

00263 {
00264     return( MyMaracasData.loadExperiment( fName ) );
00265 
00266 }

Here is the call graph for this function:

bool LoadImages_dll (  ) 

Definition at line 116 of file marTclInterface.h.

References marInterface::_dicom, and marFilesBase::loadActualSerie().

00117 {
00118     MyMaracasData._dicom->loadActualSerie( );
00119     return( true );
00120 
00121 }

Here is the call graph for this function:

bool loadParams_dll ( std::string &  fName  ) 

Definition at line 52 of file marTclInterface.h.

References marInterface::loadParameters().

00053 {
00054     return( MyMaracasData.loadParameters( std::string( fName ) ) );
00055 
00056 }

Here is the call graph for this function:

void LoadTkImage_dummy ( uchar **  image,
int  w,
int  h,
std::string &  tkName,
Tcl_Interp *  interp 
)

Definition at line 134 of file marTclInterface.h.

Referenced by LoadTkImages_dll().

00136 {
00137     Tk_PhotoHandle hnd;
00138     Tk_PhotoImageBlock bl;
00139 
00140     hnd = Tk_FindPhoto( interp, ( char* )tkName.c_str( ) );
00141     if( hnd != NULL ) {
00142 
00143         // Image size
00144         bl.width  = w;
00145         bl.height = h;
00146 
00147         // One pixel is represented with one unsigned short value
00148         bl.pixelSize = sizeof( uchar );
00149 
00150         // We're working on intensity images i.e. no RGB
00151         bl.offset[ 0 ] = 0;
00152         bl.offset[ 1 ] = 0;
00153         bl.offset[ 2 ] = 0;
00154         bl.offset[ 3 ] = 0;
00155 
00156         // To go to next in vertical value
00157         bl.pitch = bl.pixelSize * bl.width;
00158 
00159         // Menory block
00160         bl.pixelPtr = ( uchar* )image[ 0 ];
00161 
00162         // Ok, lets do it!
00163         Tk_PhotoPutBlock( hnd, &bl, 0, 0, bl.width, bl.height );
00164 
00165     } // fi
00166 
00167 }

Here is the caller graph for this function:

void LoadTkImages_dll ( wxStringList &  tkNames,
Tcl_Interp *  interp 
)

Definition at line 170 of file marTclInterface.h.

References marInterface::_dicom, _ucharVol, CastVolume_dummy(), marFilesBase::getVolume(), and LoadTkImage_dummy().

00171 {
00172     int k, w, h, d;
00173         std::string tmp;
00174 
00175     w = MyMaracasData._dicom->getVolume( )->getXdim( );
00176     h = MyMaracasData._dicom->getVolume( )->getYdim( );
00177     d = MyMaracasData._dicom->getVolume( )->getZdim( );
00178 
00179     CastVolume_dummy( );
00180         uchar*** vol = ( uchar*** )( _ucharVol->getData3D( ) );
00181     for( k = 0; k < d; k++ ) {
00182 
00183                 tmp = tkNames[ k ];
00184         LoadTkImage_dummy( vol[ k ],
00185                                                    w, h, tmp, interp );
00186 
00187     } // rof
00188 
00189 }

Here is the call graph for this function:

wxStringList params_dll (  ) 

Definition at line 31 of file marTclInterface.h.

References marInterface::_parameters, and marParameters::getRelationalArray().

00032 {
00033     return( MyMaracasData._parameters->getRelationalArray( ) );
00034 
00035 }

Here is the call graph for this function:

void PrepareQuantification_dll ( int  i  ) 

Definition at line 392 of file marTclInterface.h.

00393 {
00394         /*
00395           MyMaracasData._experiment->SetAxis( i );
00396           MyMaracasData._experiment->PrepareQuantification( );
00397         */
00398 }

bool SaveExperiment_dll ( std::string &  fName  ) 

Definition at line 255 of file marTclInterface.h.

References marInterface::saveExperiment().

00256 {
00257     return( MyMaracasData.saveExperiment( fName ) );
00258 
00259 }

Here is the call graph for this function:

bool saveParams_dll ( std::string &  fName  ) 

Definition at line 45 of file marTclInterface.h.

References marInterface::saveParameters().

00046 {
00047     return( MyMaracasData.saveParameters( std::string( fName ) ) );
00048 
00049 }

Here is the call graph for this function:

wxStringList serieData_dll ( std::string &  study,
std::string &  serie 
)

Definition at line 95 of file marTclInterface.h.

References marInterface::_dicom.

00096 {
00097     MyMaracasData._dicom->setActualStudy( study );
00098     MyMaracasData._dicom->setActualSerie( serie );
00099     return( MyMaracasData._dicom->getRelationalArraySerieData( ) );
00100 
00101 }

wxStringList series_dll ( std::string &  study  ) 

Definition at line 87 of file marTclInterface.h.

References marInterface::_dicom.

00088 {
00089     MyMaracasData._dicom->setActualStudy( study );
00090     return( MyMaracasData._dicom->getSeries( ) );
00091 
00092 }

void setParams_dll ( wxStringList &  raParams  ) 

Definition at line 38 of file marTclInterface.h.

References marInterface::_parameters, and marParameters::setRelationalArray().

00039 {
00040     MyMaracasData._parameters->setRelationalArray( raParams );
00041 
00042 }

Here is the call graph for this function:

void SetROIStep_dll ( double  vWidth  ) 

Definition at line 59 of file marTclInterface.h.

References marInterface::_parameters, and marParameters::setROIStep().

00060 {
00061     MyMaracasData._parameters->setROIStep( vWidth );
00062 
00063 }

Here is the call graph for this function:

void SetStartPoint_dll ( int  x,
int  y,
int  z 
)

Definition at line 280 of file marTclInterface.h.

References marInterface::_experiment, and marExperiment::setStartPoint().

00281 {
00282     MyMaracasData._experiment->setStartPoint( x, y, z );
00283 }

Here is the call graph for this function:

wxStringList studies_dll (  ) 

Definition at line 73 of file marTclInterface.h.

References marInterface::_dicom.

00074 {
00075     return( MyMaracasData._dicom->getStudies( ) );
00076 }

wxStringList studyData_dll ( std::string &  study  ) 

Definition at line 79 of file marTclInterface.h.

References marInterface::_dicom.

00080 {
00081     MyMaracasData._dicom->setActualStudy( study );
00082     return( MyMaracasData._dicom->getRelationalArrayStudyData( ) );
00083 
00084 }

void SubtractSeries_dll ( std::string &  sl,
std::string &  sr,
std::string &  ss,
std::string &  description 
)

Definition at line 104 of file marTclInterface.h.

00105 {/*
00106    marDicom::SubtractSeries(
00107    MyMaracasData._parameters,
00108    MyMaracasData._dicom->getActualStudy( ),
00109    sl, sr,
00110    ss, description
00111    );
00112  */
00113 }

void TclPerpendiculars_dll ( double  xN,
double  yN,
double  zN,
double  angle,
double *  xP1,
double *  yP1,
double *  zP1,
double *  xP2,
double *  yP2,
double *  zP2 
)

Definition at line 450 of file marTclInterface.h.

00455 {
00456     double x[ 3 ], y[ 3 ], z[ 3 ];
00457     vtkMath* math;
00458 
00459     x[ 0 ] = xN; x[ 1 ] = yN; x[ 2 ] = zN;
00460     math = vtkMath::New( );
00461     math->Perpendiculars( x, y, z,angle );
00462     ( *xP1 ) = y[ 0 ]; ( *yP1 ) = y[ 1 ]; ( *zP1 ) = y[ 2 ];
00463     ( *xP2 ) = z[ 0 ]; ( *yP2 ) = z[ 1 ]; ( *zP2 ) = z[ 2 ];
00464     math->Delete( );
00465 }


Variable Documentation

kVolume* _ucharVol = NULL [static]

Definition at line 19 of file marTclInterface.h.


Generated on 18 Mar 2010 for creaMaracasVisu_lib by  doxygen 1.6.1