Skip to content

Commit

Permalink
Merge pull request #278 from PauloCarvalhoRJ/Upgrade_to_VTK9.1
Browse files Browse the repository at this point in the history
Upgrade to vtk9.1
  • Loading branch information
PauloCarvalhoRJ authored Apr 6, 2022
2 parents 26c1662 + 03e4f52 commit 161aaca
Show file tree
Hide file tree
Showing 26 changed files with 201 additions and 137 deletions.
8 changes: 4 additions & 4 deletions GammaRay.pro
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ isEmpty(_QWT_LIB){
}
INCLUDEPATH += $$_QWT_INCLUDE
LIBPATH += $$_QWT_LIB
LIBS += -lqwt
LIBS += -lqwt-qt5
#==============================================================

#========== The VTK include and lib paths and libraries==================
Expand Down Expand Up @@ -744,7 +744,6 @@ LIBS += -lvtkGUISupportQt$$_VTK_VERSION_SUFFIX \
-lvtkImagingGeneral$$_VTK_VERSION_SUFFIX \
-lvtkRenderingVolume$$_VTK_VERSION_SUFFIX \
-lvtkFiltersStatistics$$_VTK_VERSION_SUFFIX \
-lvtkalglib$$_VTK_VERSION_SUFFIX \
-lvtkImagingStencil$$_VTK_VERSION_SUFFIX \
-lvtkImagingHybrid$$_VTK_VERSION_SUFFIX \
-lvtkRenderingContext2D$$_VTK_VERSION_SUFFIX \
Expand Down Expand Up @@ -778,7 +777,8 @@ LIBS += -lITKCommon$$_ITK_VERSION_SUFFIX \
-litkvnl$$_ITK_VERSION_SUFFIX \
-litkvnl_algo$$_ITK_VERSION_SUFFIX \
-lITKIOPNG$$_ITK_VERSION_SUFFIX \
-lITKTransform$$_ITK_VERSION_SUFFIX
-lITKTransform$$_ITK_VERSION_SUFFIX \
-lITKSmoothing$$_ITK_VERSION_SUFFIX

#=============================================================================

Expand Down Expand Up @@ -824,7 +824,7 @@ win32 {
# The application version
# Don't forget to update the Util::importSettingsFromPreviousVersion() method to
# enable the import of registry/user settings of previous versions.
VERSION = 6.14
VERSION = 6.16

# Define a preprocessor macro so we can get the application version in application code.
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ If you enjoyed this project, you might also enjoy GeostatsPy: https://github.com
Python script to convert Eclipse grids to Paraview-compatible VTU format: https://github.com/BinWang0213/PyGRDECL

VERSION HISTORY:<br>
&nbsp;&nbsp;&nbsp;Version 6.16 - Upgrade of VTK to 9.1 and other years-old dependencies; some fixes.<br>
&nbsp;&nbsp;&nbsp;Version 6.14 - Several improvements mainly involving the 3D Viewer and dataset processing.<br>
&nbsp;&nbsp;&nbsp;Version 6.12 - Several new methods to work with grids. Several fixes and enhancements.<br>
&nbsp;&nbsp;&nbsp;Version 6.9 - Export geologic grids as Eclipse grids, multiple other new features, enhancements and fixes.<br>
Expand Down
1 change: 1 addition & 0 deletions dialogs/dynamicfaciesrelationshipdiagramdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <QScrollBar>
#include <QClipboard>
#include <QInputDialog>
#include <QFile>

DynamicFaciesRelationshipDiagramDialog::DynamicFaciesRelationshipDiagramDialog(
std::vector<Attribute *> &categoricalAttributes,
Expand Down
1 change: 1 addition & 0 deletions dialogs/krigingdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include <QInputDialog>
#include <QMessageBox>
#include <QFile>
#include <cmath>

KrigingDialog::KrigingDialog(QWidget *parent) :
Expand Down
2 changes: 1 addition & 1 deletion dialogs/mcrfsimdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ void MCRFSimDialog::onRun()
Application::instance()->logError( " Last error:" + markovSim.getLastError() );
} else {
int realNum = 1;
for( const spectral::arrayPtr& simValues : markovSim.getRealizations() ){
for( spectral::arrayPtr simValues : markovSim.getRealizations() ){
markovSim.m_cgSim->append( m_commonSimulationParameters->getBaseNameForRealizationVariables() + QString::number(realNum),
*simValues,
markovSim.m_pdf->getCategoryDefinition() );
Expand Down
Binary file modified docs/GammaRayManual.docx
Binary file not shown.
Binary file modified docs/figures.pptx
Binary file not shown.
35 changes: 22 additions & 13 deletions imagejockey/gabor/gaborfilterdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ VTK_MODULE_INIT(vtkRenderingFreeType)
#include "imagejockey/paraviewscalarbar/vtkParaViewScalarBar.h"
#include "util.h"
#include <QProgressDialog>
#include <QVTKOpenGLWidget.h>
#include <QVTKOpenGLNativeWidget.h>
#include <QMessageBox>
#include <vtkAxesActor.h>
#include <vtkOrientationMarkerWidget.h>
Expand Down Expand Up @@ -64,23 +64,23 @@ GaborFilterDialog::GaborFilterDialog(IJAbstractCartesianGrid *inputGrid,
}

///-------------------setup the 3D viewer-------------------
_vtkwidget = new QVTKOpenGLWidget();
_vtkwidget = new QVTKOpenGLNativeWidget();

_renderer = vtkSmartPointer<vtkRenderer>::New();

// enable antialiasing
_renderer->SetUseFXAA( true );

_vtkwidget->SetRenderWindow(vtkGenericOpenGLRenderWindow::New());
_vtkwidget->GetRenderWindow()->AddRenderer(_renderer);
_vtkwidget->setRenderWindow(vtkGenericOpenGLRenderWindow::New());
_vtkwidget->renderWindow()->AddRenderer(_renderer);
_vtkwidget->setFocusPolicy(Qt::StrongFocus);

//----------------------adding the orientation axes-------------------------
vtkSmartPointer<vtkAxesActor> axes = vtkSmartPointer<vtkAxesActor>::New();
_vtkAxesWidget = vtkSmartPointer<vtkOrientationMarkerWidget>::New();
_vtkAxesWidget->SetOutlineColor(0.9300, 0.5700, 0.1300);
_vtkAxesWidget->SetOrientationMarker(axes);
_vtkAxesWidget->SetInteractor(_vtkwidget->GetRenderWindow()->GetInteractor());
_vtkAxesWidget->SetInteractor(_vtkwidget->renderWindow()->GetInteractor());
_vtkAxesWidget->SetViewport(0.0, 0.0, 0.2, 0.2);
_vtkAxesWidget->SetEnabled(1);
_vtkAxesWidget->InteractiveOn();
Expand Down Expand Up @@ -155,7 +155,8 @@ void GaborFilterDialog::updateDisplay()
double featureSizeFinal = ( featureSizeXFinal + featureSizeYFinal ) / 2;
//get the feature size step size (intial size is greater because initial frequency is lower)
double dFeatureSize = ( featureSizeInitial - featureSizeFinal ) / ( s1 - s0 ) ;

//get the z coordinate of the origin of the spectrogram
double spectrogramOriginZ = featureSizeFinal - 0.5 * dFeatureSize;

/////--------------------code to render the spectrogram cube-----------------------
vtkSmartPointer<vtkActor> spectrogramActor = vtkSmartPointer<vtkActor>::New();
Expand All @@ -182,7 +183,7 @@ void GaborFilterDialog::updateDisplay()
dFeatureSize);
spectrogramGridAsCellCentered->SetOrigin ( m_inputGrid->getOriginX() - m_inputGrid->getCellSizeI()/2,
m_inputGrid->getOriginY() - m_inputGrid->getCellSizeJ()/2,
featureSizeFinal - 0.5 * dFeatureSize );
spectrogramOriginZ );
spectrogramGridAsCellCentered->SetExtent( extent[0], extent[1]+1,
extent[2], extent[3]+1,
extent[4], extent[5]+1 );
Expand Down Expand Up @@ -218,7 +219,8 @@ void GaborFilterDialog::updateDisplay()
vtkSmartPointer<vtkThreshold> threshold = vtkSmartPointer<vtkThreshold>::New();
{
threshold->SetInputData( spectrogramGridAsCellCentered );
threshold->ThresholdByUpper(1); // Criterion is cells whose scalars are greater or equal to threshold.
threshold->SetUpperThreshold(1); // Criterion is cells whose scalars are greater or equal to threshold.
threshold->SetThresholdFunction( vtkThreshold::THRESHOLD_UPPER );
threshold->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS, "Visibility");
threshold->Update();
}
Expand Down Expand Up @@ -249,7 +251,7 @@ void GaborFilterDialog::updateDisplay()
_scalarBar->SetTitle("amplitude");
//scalarBar->SetNumberOfLabels( 4 );
_scalarBar->SetRenderer( _renderer );
_scalarBar->SetInteractor( _vtkwidget->GetRenderWindow()->GetInteractor() );
_scalarBar->SetInteractor( _vtkwidget->renderWindow()->GetInteractor() );

// Create a text style for the cube axes
vtkSmartPointer<vtkTextProperty> tprop = vtkSmartPointer<vtkTextProperty>::New();
Expand Down Expand Up @@ -282,11 +284,18 @@ void GaborFilterDialog::updateDisplay()
spectral::arrayPtr gridData( m_inputGrid->createSpectralArray( m_inputVariableIndex ) );
ImageJockeyUtils::makeVTKImageDataFromSpectralArray( out, *gridData );

//put the input grid a bit far from the spectrogram cube
//put the input grid a bit below from the spectrogram cube
double* origin = out->GetOrigin();
origin[2] -= 10.0;
origin[0] = m_inputGrid->getOriginX();
origin[1] = m_inputGrid->getOriginY();
origin[2] = spectrogramOriginZ - 10.0;
out->SetOrigin( origin );

//render the input grid with the correct cell sizes
out->SetSpacing ( m_inputGrid->getCellSizeI(),
m_inputGrid->getCellSizeJ(),
m_inputGrid->getCellSizeK());

//Create a color table
vtkSmartPointer<vtkLookupTable> lut = vtkSmartPointer<vtkLookupTable>::New();
{
Expand Down Expand Up @@ -330,7 +339,7 @@ void GaborFilterDialog::updateDisplay()
_renderer->AddActor( gridActor );
_currentActors.push_back( gridActor );
_renderer->ResetCamera();
_vtkwidget->GetRenderWindow()->Render();
_vtkwidget->renderWindow()->Render();
}

void GaborFilterDialog::onScan()
Expand Down Expand Up @@ -408,7 +417,7 @@ void GaborFilterDialog::onFreqAzSelectionsUpdated(const GaborFrequencyAzimuthSel

void GaborFilterDialog::onUserEditedAFrequency(QString freqValue)
{
Q_UNUSED( freqValue );
Q_UNUSED( freqValue )
//get the user-entered topological frequencies
// the frequencies are topological (that is, inverse of cell counts)
// because the Gabor transform involves convolutions, which are cell-centered
Expand Down
4 changes: 2 additions & 2 deletions imagejockey/gabor/gaborfilterdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class GaborFilterDialog;

class IJAbstractCartesianGrid;
class IJQuick3DViewer;
class QVTKOpenGLWidget;
class QVTKOpenGLNativeWidget;
class vtkRenderer;
class vtkOrientationMarkerWidget;
class vtkPolyData;
Expand Down Expand Up @@ -50,7 +50,7 @@ class GaborFilterDialog : public QDialog

////////-----members used for 3D display-------------------
// the Qt widget containing a VTK viewport
QVTKOpenGLWidget *_vtkwidget;
QVTKOpenGLNativeWidget *_vtkwidget;
// the VTK renderer (add VTK actors to it to build the scene).
vtkSmartPointer<vtkRenderer> _renderer;
// this must be class variable, otherwise a crash ensues due to smart pointer going
Expand Down
10 changes: 6 additions & 4 deletions imagejockey/imagejockeygridplot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include <qwt_plot_renderer.h>
#include <qwt_plot_canvas.h>
#include <qwt_plot_curve.h>
#include <qwt_matrix_raster_data.h>
#include <QPen>
#include <cmath>

#include <qapplication.h>
Expand Down Expand Up @@ -41,8 +43,8 @@ class SpectrogramZoomer: public QwtPlotZoomer
}
};

///////////////////////////////////////////RASTER DATA ADAPTER: QwtRasterData <-> CartesianGrid ///////////////////////
class SpectrogramData: public QwtRasterData{
///////////////////////////////////////////RASTER DATA ADAPTER: QwtMatrixRasterData <-> CartesianGrid ///////////////////////
class SpectrogramData: public QwtMatrixRasterData{
public:
SpectrogramData() : m_var( nullptr ), m_cg( nullptr ), m_decibelRefValue(100.0) {
//set some default values before the user chooses a grid
Expand Down Expand Up @@ -105,8 +107,8 @@ class SpectrogramData: public QwtRasterData{
double m_decibelRefValue;
};

///////////////////////////////////////////RASTER DATA ADAPTER: QwtRasterData <-> SVDFactor ///////////////////////
class FactorData: public QwtRasterData{
///////////////////////////////////////////RASTER DATA ADAPTER: QwtMatrixRasterData <-> SVDFactor ///////////////////////
class FactorData: public QwtMatrixRasterData{
public:
FactorData() : m_factor( nullptr ), m_colorScaleForSVDFactor( ColorScaleForSVDFactor::LINEAR ) {
//set some default values before the user chooses a factor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void vtkBoundingRectContextDevice2D::DrawMathTextString(float* point, const vtkS
{
if (!this->DelegateDevice)
{
vtkWarningMacro(<< "No DelegateDevice defined") return;
vtkWarningMacro(<< "No DelegateDevice defined"); return;
}

// Not sure if this will work for math text
Expand Down
Loading

0 comments on commit 161aaca

Please sign in to comment.