Files
glocalize/gLocalize.h
T
Giovanni Fattori f18e57ff0e Working version of gLocalize software installed at the CNAO.
This extends the embedded function in gOTS code with:
- manual volume masking
- visualization tools
- no memory issues.
2014-10-13 15:41:02 +02:00

215 lines
4.9 KiB
C++
Executable File

#ifndef _GLOCALIZE_H_
#define _GLOCALIZE_H_
#include <QObject.h>
#include <vtkImageData.h>
#include <QThread>
#include <vtkActor.h>
#include <vtkAlgorithm.h>
#include <vtkCellPicker.h>
#include <vtkDataSet.h>
#include <vtkExtractEdges.h>
#include <vtkImageData.h>
#include <vtkIterativeClosestPointTransform.h>
#include <vtkImageMarchingCubes.h>
#include <vtkImageData.h>
#include <vtkImageThreshold.h>
#include <vtkImagePlaneWidget.h>
#include <vtkLandmarkTransform.h>
#include <vtkMarchingCubes.h>
#include <vtkPolyDataAlgorithm.h>
#include <vtkPolyData.h>
#include <vtkPolyDataMapper.h>
#include <vtkPolyDataNormals.h>
#include <vtkPolyDataConnectivityFilter.h>
#include <vtkPolyDataCollection.h>
#include <vtkPoints.h>
#include <vtkProperty.h>
#include <vtkSource.h>
#include <vtkSmartPointer.h>
#include <vtkPolyData.h>
#include <vtkPolyDataConnectivityFilter.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkPolyDataMapper.h>
#include <vtkSphereSource.h>
#include <vtkWindowedSincPolyDataFilter.h>
//#include "gSkullRemoval.h"
#include <qstring.h>
#include <qlist.h>
#include <QMetaType>
#include <QProgressBar>
#include <gdcmGlobal.h>
#include <iostream>
//#include "gTRiPtools_b.h"
#include <vtkCamera.h>
//#include "resampler.h"
#include <vtkMetaImageReader.h>
#include <vtkGDCMPolyDataReader.h>
#include <vtkHomogeneousTransform.h>
#include <gdcmReader.h>
#include <gdcmAttribute.h>
#include <gdcmStringFilter.h>
#include <vtkMatrix4x4.h>
#include <gdcmDict.h>
#include <gdcmDirectory.h>
#include <vtkImageChangeInformation.h>
#include <vtkImageData.h>
#include <vtkImageReslice.h>
#include <vtkVolumeProperty.h>
#include <vtkColorTransferFunction.h>
#include <vtkPiecewiseFunction.h>
#include <vtkVolume.h>
#include <vtkSmartVolumeMapper.h>
#include <vtkSmartPointer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkAxesActor.h>
#include <vtkImageData.h>
#include <vtkPolyDataMapper.h>
#include <vtkProperty.h>
#include <vtkAppendPolyData.h>
#include <vtkSurfaceReconstructionFilter.h>
#include <vtkContourFilter.h>
#include <vtkCaptionActor2D.h>
#include <vtkTextProperty.h>
#include <vtkAbstractTransform.h>
#include <ostream>
#include <vtkTransform.h>
#include <vtkPolyData.h>
#include <vtkTransformPolyDataFilter.h>
#include <vtkImageData.h>
#include <vtkImageFlip.h>
#include <vtkImageChangeInformation.h>
#include <vtkSmartPointer.h>
#include <vtkStringArray.h>
#include <vtkCellData.h>
#include <vtkPointData.h>
#include <vtkGDCMImageReader.h>
#include <vtkGDCMPolyDataReader.h>
#include <gdcmDirectory.h>
#include <gdcmIPPSorter.h>
#include <gdcmSystem.h>
#include <vtkMatrixToLinearTransform.h>
// #include <qstring.h>
#include <vtkCellArray.h>
#include <vtkLine.h>
#include <vtkGDCMThreadedImageReader.h>
#include <vtkTransformFilter.h>
#include <vtkSelectEnclosedPoints.h>
#include <vtkPolygon.h>
#include <string>
#include <vtkImageWriter.h>
#include <gdcmUIDs.h>
#include <vector>
#define ORDER_BIGENDIAN 0
#define ORDER_LITTLEENDIAN 1
#define ORDER_UNKNOWN 2
// Some Macros to make the code more readable
//
//#ifndef SWAP_TMP_INT
// #define SWAP_TMP_INT
// #define EVAL_INDEX(X,Y,L) (reference[ (Y)*(L) +(X)])
// int swap_tmp_int;
// #define INT_SWAP(X,Y) swap_tmp_int=X; X=Y; Y=swap_tmp_int;
//#endif
//
//
#define N_ITERAZ_ICP 100
typedef struct {
public:
double x;
double y;
double z;
}point;
typedef struct {
public:
int sorting;
int surfn;
double lenght;
int ntriangle;
int npoint;
double bounds[6];
double center[3];
double volume;
int ismarker;
point centroid;
double centroid_median [3];
point fitting ;
double confronto_lati;
double hausdorff;
}surf;
class gLocalize : public QObject{
Q_OBJECT
public:
gLocalize();
public slots:
void localize(vtkImageData* vol,
int march_tresh,
double thrDown_D,
double thrUp_D,
double thr_HAUSD,
double thr_S,
QList <bool> selectedFilters);
void callAbort(){
cout<< "Aborted" <<endl;
abortSignal=true;
};
signals:
void localizationEnd(QList<surf>);
void localizationProgress(int);
void localizationAborted();
private:
double hausdorff(vtkPolyDataConnectivityFilter* filter, surf tempsurf);
int get_byteorder();
double lati(double p[6]);
point centroid(QList< point > punti);
volatile bool abortSignal;
/**
* Functions for Qlist sorting
*/
bool lenghtLessThan(const surf &d1, const surf &d2){ return d1.lenght > d2.lenght; };
bool tringleLessThan(const surf &d1, const surf &d2){ return d1.ntriangle > d2.ntriangle; };
bool zLessThan(const surf &d1, const surf &d2){ return d1.center[2] < d2.center[2]; };
bool confronto_latiLessThan(const surf &d1, const surf &d2){return d1.confronto_lati<d2.confronto_lati;};
};
#endif