18 #include "milxQtModel.h" 21 #include <QInputDialog> 22 #include <QColorDialog> 27 #include <vtkGraphicsFactory.h> 28 #include <vtkCamera.h> 30 #include <vtkDoubleArray.h> 31 #include <vtkDataSetMapper.h> 32 #include <vtkIdFilter.h> 33 #include <vtkSelectVisiblePoints.h> 35 #include <vtkGlyph3D.h> 36 #include <vtkOrientedGlyphContourRepresentation.h> 37 #include <vtkPolygonalSurfacePointPlacer.h> 38 #include <vtkPolygonalSurfaceContourLineInterpolator.h> 40 #include <vtkTextProperty.h> 41 #include <vtkCoordinate.h> 42 #include <vtkImageQuantizeRGBToIndex.h> 43 #include <vtkImageToPolyDataFilter.h> 44 #include <vtkImageData.h> 45 #include <vtkImageFlip.h> 47 #include <vtkStreamTracer.h> 48 #include <vtkLogLookupTable.h> 51 #include "milxColourMap.h" 53 #include "milxQtFile.h" 228 normalsModel->SetTransform(newTransform);
230 centroidModel->SetTransform(newTransform);
232 outlineModel->SetTransform(newTransform);
283 #if VTK_MAJOR_VERSION <=5 308 vtkPoints *centroidPoint = vtkPoints::New();
310 centroidModel->SetPoints(centroidPoint);
311 centroidModel->generatePointModel(2.0, 1.0, 0.0, 0.0);
327 coordinate currentCentroid =
centroid();
335 coordinate currentCentroid =
centroid();
363 vtkSmartPointer<vtkPolyDataMapper> delaunayMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
364 #if VTK_MAJOR_VERSION <=5 392 vtkSmartPointer<vtkDataSetMapper> delaunayMapper = vtkSmartPointer<vtkDataSetMapper>::New();
393 #if VTK_MAJOR_VERSION <=5 418 modelActor->GetProperty()->SetRepresentationToWireframe();
469 modelActor->GetProperty()->SetRepresentationToPoints();
481 double scaling = ( (bounds[1]-bounds[0]) + (bounds[3]-bounds[2]) + (bounds[5]-bounds[4]) )/150;
504 distance = QInputDialog::getDouble(
this, tr(
"Please Provide the sample distance"),
505 tr(
"Distance:"), 0.1, 0.0, 2147483647, 7, &ok);
527 bool useNormals =
false;
528 vtkSmartPointer<vtkFloatArray> vectorArray;
534 printInfo(
"Generating Vector Field from Scalars (with normals).");
544 printInfo(
"Generating Vector Field from Vectors.");
548 if(newScale == 0.0 && vectorArray)
550 coordinate meanDirection(0.0);
553 coordinate vectorData(vectorArray->GetTuple3(j));
555 meanDirection += vectorData;
558 printDebug(
"Mean Vector: " + QString::number(meanDirection[0]) +
", " + QString::number(meanDirection[1]) +
", " + QString::number(meanDirection[2]) +
", ");
559 printDebug(
"Mean Vector L2 Norm: " + QString::number(meanDirection.two_norm()));
562 double newScaling = 1.0/meanDirection.two_norm();
563 newScaling = QInputDialog::getDouble(
this, tr(
"Please enter scaling for the vector field"),
564 tr(
"Scaling:"), newScaling, -2147483647, 2147483647, 7, &ok1);
569 newScale = newScaling;
570 printInfo(
"Vectors will be scaled by " + QString::number(newScale) +
" for display.");
588 printError(
"No tensors found in polydata. Exiting.");
595 vnl_matrix<double> meanDirection(3, 3, 0.0);
598 vnl_matrix<double> vectorData(
GetTensors()->GetTuple9(j), 3 ,3);
600 meanDirection += vectorData;
603 printDebug(
"Mean Vector L2 Norm: " + QString::number(meanDirection.frobenius_norm()));
606 double newScaling = 1.0/meanDirection.frobenius_norm();
607 newScaling = QInputDialog::getDouble(
this, tr(
"Please enter scaling for the vector field"),
608 tr(
"Scaling:"), newScaling, -2147483647, 2147483647, 7, &ok1);
613 newScale = newScaling;
614 printInfo(
"Vectors will be scaled by " + QString::number(newScale) +
" for display.");
632 printError(
"No points found in polydata. Exiting.");
639 timestep = QInputDialog::getDouble(
this, tr(
"Please Provide the timestep"),
640 tr(
"Timestep:"), 0.1, 0.0, 100.0, 5, &ok);
649 vectorFieldData->GetBounds(bounds);
651 const double maxProp = bounds[1]-bounds[0];
652 const double maxSteps = maxProp/timestep;
658 vtkSmartPointer<vtkStreamTracer> streamLines = vtkSmartPointer<vtkStreamTracer>::New();
659 #if VTK_MAJOR_VERSION <= 5 660 streamLines->SetInput(vectorFieldData);
663 streamLines->SetInputData(vectorFieldData);
667 streamLines->SetMaximumPropagation(maxProp);
668 streamLines->SetMaximumNumberOfSteps(maxSteps);
669 streamLines->SetInitialIntegrationStep(timestep);
671 streamLines->SetIntegrationDirectionToBoth();
672 streamLines->SetIntegratorTypeToRungeKutta4();
678 streamLines->Update();
708 modelActor->GetProperty()->SetRepresentationToSurface();
719 printInfo(
"Generating Normals for the model");
730 modelMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
731 modelActor = vtkSmartPointer<vtkLODActor>::New();
740 #if VTK_MAJOR_VERSION <=5 744 #endif // VTK_MAJOR_VERSION 751 vtkSmartPointer<vtkLookupTable> tmpLookupTable = vtkLookupTable::SafeDownCast(
lookupTable);
753 tmpLookupTable->SetTableRange(
model.
Result()->GetScalarRange());
754 tmpLookupTable->Build();
767 enableSpecularDisplay(
true);
789 vtkSmartPointer<vtkIdFilter> ids = vtkSmartPointer<vtkIdFilter>::New();
790 #if VTK_MAJOR_VERSION <=5 794 #endif // VTK_MAJOR_VERSION 797 vtkSmartPointer<vtkSelectVisiblePoints> visPts = vtkSmartPointer<vtkSelectVisiblePoints>::New();
798 visPts->SetInputConnection( ids->GetOutputPort() );
801 vtkSmartPointer<vtkLabeledDataMapper> labeller = vtkSmartPointer<vtkLabeledDataMapper>::New();
802 labeller->SetInputConnection( visPts->GetOutputPort() );
804 labeller->SetLabelModeToLabelFieldData();
830 bool ok1 =
false, ok2 =
false;
832 if(contourNumber < 0)
838 value = QInputDialog::getDouble(
this, tr(
"Please enter label/iso surface value"),
839 tr(
"Value:"), 0.5, -2147483647, 2147483647, 7, &ok2);
847 vtkSmartPointer<vtkImageFlip> imageReorient = vtkSmartPointer<vtkImageFlip>::New();
848 #if VTK_MAJOR_VERSION <=5 849 imageReorient->SetInput(img);
851 imageReorient->SetInputData(img);
852 #endif // VTK_MAJOR_VERSION 853 imageReorient->SetFilteredAxis(1);
854 imageReorient->FlipAboutOriginOn();
856 imageReorient->Update();
872 vtkSmartPointer<vtkImageFlip> imageReorient = vtkSmartPointer<vtkImageFlip>::New();
873 #if VTK_MAJOR_VERSION <=5 874 imageReorient->SetInput(img);
876 imageReorient->SetInputData(img);
878 imageReorient->SetFilteredAxis(1);
879 imageReorient->FlipAboutOriginOn();
880 imageReorient->Update();
886 vtkSmartPointer<vtkImageToPolyDataFilter> imgToModel = vtkSmartPointer<vtkImageToPolyDataFilter>::New();
888 #if VTK_MAJOR_VERSION <=5 889 imgToModel->SetInput(imageReorient->GetOutput());
891 imgToModel->SetInputData(imageReorient->GetOutput());
892 #endif // VTK_MAJOR_VERSION 895 imgToModel->SetOutputStyleToPolygonalize();
897 imgToModel->DecimationOn();
901 imgToModel->Update();
918 if(numberOfClusters <= 0)
920 numberOfClusters = QInputDialog::getInt(
this, tr(
"Please Provide the number of clusters to use"),
921 tr(
"Clusters:"), 2, 0, 2147483647, 1, &ok);
943 if(quantiseFactor <= 0)
945 quantiseFactor = QInputDialog::getDouble(
this, tr(
"Please Provide the Quantise Factor"),
946 tr(
"Factor:"), 0.25, 0.0, 2147483647, 5, &ok);
1020 doAct->setText(QApplication::translate(
"Model",
"&Redo Last Processing", 0, QApplication::UnicodeUTF8));
1025 doAct->setText(QApplication::translate(
"Model",
"&Undo Last Processing", 0, QApplication::UnicodeUTF8));
1064 factor = QInputDialog::getDouble(
this, tr(
"Please Provide the reduction factor"),
1065 tr(
"Factor:"), 0.5, 0.0, 1.0, 3, &ok);
1070 if( factor > 0.0 && ok )
1075 printInfo(
"--- Decimating with using DecimatePro");
1097 factor = QInputDialog::getDouble(
this, tr(
"Please Provide the target reduction factor"),
1098 tr(
"Target Factor:"), 0.5, 0.0, 1.0, 3, &ok);
1103 if( factor > 0.0 && ok )
1108 printInfo(
"--- Decimating with using Quadric Decimation");
1129 printInfo(
"--- Decimating with using Quadric Clustering Decimation");
1146 if(newName.isEmpty())
1148 QSettings settings(
"Shekhar Chandra",
"milxQt");
1149 QString path = settings.value(
"recentPath").toString();
1150 newName = QInputDialog::getText(
this, tr(
"New Name for Scalars"),
1151 tr(
"New name:"), QLineEdit::Normal,
1155 if(newName.isEmpty())
1158 model.
Result()->GetPointData()->GetScalars()->SetName(newName.toStdString().c_str());
1161 scale->SetTitle(newName.toStdString().c_str());
1173 if(upValue == 0.0 && lowValue == 0.0)
1178 lowValue = QInputDialog::getDouble(
this, tr(
"Lower level of band to keep"),
1179 tr(
"Lower Value (inclusive):"), range[0], -2147483647, 2147483647, 12, &ok);
1180 upValue = QInputDialog::getDouble(
this, tr(
"Upper level of band to keep (inclusive)"),
1181 tr(
"Upper Value (inclusive):"), range[1], -2147483647, 2147483647, 12, &ok);
1190 printInfo(
"Thresholding Scalars and clipping mesh");
1205 if(upValue == 0.0 && lowValue == 0.0 && outsideVal == 0.0)
1210 lowValue = QInputDialog::getDouble(
this, tr(
"Lower level of band to keep"),
1211 tr(
"Lower Value (inclusive):"), range[0], -2147483647, 2147483647, 12, &ok);
1212 upValue = QInputDialog::getDouble(
this, tr(
"Upper level of band to keep (inclusive)"),
1213 tr(
"Upper Value (inclusive):"), range[1], -2147483647, 2147483647, 12, &ok);
1214 outsideVal = QInputDialog::getDouble(
this, tr(
"Value to give scalars outside the range"),
1215 tr(
"Outside Value:"), 0.0, -2147483647, 2147483647, 12, &ok);
1237 if(upValue == 0.0 && lowValue == 0.0)
1242 lowValue = QInputDialog::getDouble(
this, tr(
"Lower level of band to keep"),
1243 tr(
"Lower Value (inclusive):"), range[0], -2147483647, 2147483647, 12, &ok);
1244 upValue = QInputDialog::getDouble(
this, tr(
"Upper level of band to keep"),
1245 tr(
"Upper Value (inclusive):"), range[1], -2147483647, 2147483647, 12, &ok);
1246 insideVal = QInputDialog::getDouble(
this, tr(
"Value to give scalars inside the range"),
1247 tr(
"Inside Value:"), 1.0, -2147483647, 2147483647, 12, &ok);
1248 outsideVal = QInputDialog::getDouble(
this, tr(
"Value to give scalars outside the range"),
1249 tr(
"Outside Value:"), 0.0, -2147483647, 2147483647, 12, &ok);
1257 printInfo(
"Binary Thresholding Scalars");
1269 if(filename.isEmpty())
1271 QSettings settings(
"Shekhar Chandra",
"milxQt");
1272 QString path = settings.value(
"recentPath").toString();
1273 QFileDialog *fileOpener =
new QFileDialog(
this);
1274 filename = fileOpener->getOpenFileName(
this,
1275 tr(
"Select File to Open"),
1277 tr(openModelExts.c_str()) );
1280 if(filename.isEmpty())
1283 QPointer<milxQtModel> otherModel =
new milxQtModel;
1284 QPointer<milxQtFile> reader =
new milxQtFile;
1285 bool success = reader->
openModel(filename, otherModel);
1287 printInfo(
"Matching model information: ");
1288 otherModel->modelInfo();
1308 printInfo(
"Computing Gradient of Scalar Field");
1325 iterations = QInputDialog::getInt(
this, tr(
"Please Provide the number of Iterations"),
1326 tr(
"Iterations:"), 50, 0, 10000, 1, &ok);
1331 if(ok && iterations > 0)
1336 printInfo(
"Smoothed for " + QString::number(iterations) +
" iterations.");
1351 iterations = QInputDialog::getInt(
this, tr(
"Please Provide the number of Iterations"),
1352 tr(
"Iterations:"), 15, 0, 10000, 1, &ok);
1357 if(ok && iterations > 0)
1361 printInfo(
"Smoothed for " + QString::number(iterations) +
" iterations with a pass band of 0.1");
1376 printInfo(
"Mean Curvature marked as scalars on mesh");
1387 if(filename.isEmpty())
1389 QSettings settings(
"Shekhar Chandra",
"milxQt");
1390 QString path = settings.value(
"recentPath").toString();
1391 QFileDialog *fileOpener =
new QFileDialog(
this);
1392 filename = fileOpener->getOpenFileName(
this,
1393 tr(
"Select File to Open"),
1395 tr(
"ITK Transform Files (*.txt *.tfm);;VTK Transform Files (*.trsf)") );
1398 msgBox.setText(
"Invert Transform");
1399 msgBox.setInformativeText(
"Do you want to invert the transform?");
1400 msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
1401 msgBox.setDefaultButton(QMessageBox::Yes);
1402 int ret = msgBox.exec();
1404 if(ret == QMessageBox::Yes)
1408 if(filename.isEmpty())
1411 vtkSmartPointer<vtkTransform> transformer = vtkSmartPointer<vtkTransform>::New();
1412 vtkMatrix4x4* matrix;
1414 if(filename.contains(
".trsf", Qt::CaseInsensitive))
1419 transformer->SetMatrix(matrix);
1422 transformer->Inverse();
1445 bool fileProvided =
false;
1446 int ret = QMessageBox::No;
1447 if(filename.isEmpty())
1449 QSettings settings(
"Shekhar Chandra",
"milxQt");
1450 QString path = settings.value(
"recentPath").toString();
1451 QFileDialog *fileOpener =
new QFileDialog(
this);
1452 filename = fileOpener->getOpenFileName(
this,
1453 tr(
"Select File to Open"),
1455 tr(openModelExts.c_str()) );
1457 msgBox.setText(
"Append Scalars into Model");
1458 msgBox.setInformativeText(
"Do you want to add scalars into model?");
1459 msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
1460 msgBox.setDefaultButton(QMessageBox::Yes);
1461 ret = msgBox.exec();
1464 fileProvided =
true;
1466 if(filename.isEmpty())
1469 QPointer<milxQtModel> otherModel =
new milxQtModel;
1470 QPointer<milxQtFile> reader =
new milxQtFile;
1471 bool success = reader->
openModel(filename, otherModel);
1475 printError(
"Failed reading model. Stopping.");
1481 printError(
"Models must have the same number of points! Stopping.");
1485 if(!otherModel->GetScalars())
1487 printError(
"Model " + filename +
" does not have scalars");
1493 if(otherModel->GetNumberOfArrays() > 1 && !fileProvided)
1495 QDialog *arrayPossibilities =
new QDialog(
this);
1496 QComboBox *integerValues =
new QComboBox(
this);
1497 QPushButton *okButton =
new QPushButton(
this);
1498 okButton->setText(
"Ok");
1499 QLabel *lblMessage =
new QLabel(
this);
1500 lblMessage->setText(
"Choose Scalars from possibilities.");
1501 QFormLayout *formLayout =
new QFormLayout(
this);
1502 formLayout->addRow(lblMessage);
1503 formLayout->addRow(tr(
"&Select Scalars: "), integerValues);
1504 formLayout->addRow(okButton);
1505 arrayPossibilities->setLayout(formLayout);
1507 connect(okButton, SIGNAL(clicked(
bool)), arrayPossibilities, SLOT(accept()));
1510 for(
int j = 0; j < otherModel->GetOutput()->GetPointData()->GetNumberOfArrays(); j ++)
1511 integerValues->addItem(otherModel->GetOutput()->GetPointData()->GetArray(j)->GetName());
1513 arrayPossibilities->exec();
1515 index = integerValues->currentIndex();
1517 else if(otherModel->GetNumberOfArrays() > 1 && fileProvided)
1521 for(
int j = 0; j < otherModel->GetOutput()->GetPointData()->GetNumberOfArrays(); j ++)
1522 AddArray(otherModel->GetOutput()->GetPointData()->GetArray(j));
1525 if(ret == QMessageBox::Yes)
1527 AddArray(otherModel->GetOutput()->GetPointData()->GetArray(index));
1528 SetActiveScalars(otherModel->GetOutput()->GetPointData()->GetArray(index)->GetName());
1532 printInfo(
"Loaded Scalars from " + filename);
1549 printInfo(
"There are " + QString::number(
model.
Result()->GetPointData()->GetNumberOfArrays()) +
" arrays:");
1550 for(
int j = 0; j <
model.
Result()->GetPointData()->GetNumberOfArrays(); j ++)
1552 + QString::number(
model.
Result()->GetPointData()->GetArray(j)->GetNumberOfComponents())
1553 +
" component(s))");
1561 printInfo(
"Initial model information: ");
1564 if(filename.isEmpty())
1566 QSettings settings(
"Shekhar Chandra",
"milxQt");
1567 QString path = settings.value(
"recentPath").toString();
1568 QFileDialog *fileOpener =
new QFileDialog(
this);
1569 filename = fileOpener->getOpenFileName(
this,
1570 tr(
"Select File to Open"),
1572 tr(openModelExts.c_str()) );
1575 msgBox.setText(
"Rescale");
1576 msgBox.setInformativeText(
"Do you want to match the scale also?");
1577 msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
1578 msgBox.setDefaultButton(QMessageBox::Yes);
1579 int ret = msgBox.exec();
1581 if(ret == QMessageBox::No)
1585 if(filename.isEmpty())
1588 QPointer<milxQtModel> otherModel =
new milxQtModel;
1589 QPointer<milxQtFile> reader =
new milxQtFile;
1590 bool success = reader->
openModel(filename, otherModel);
1592 printInfo(
"Matching model information: ");
1593 otherModel->modelInfo();
1598 coordinate otherCentroid = otherModel->centroid();
1599 coordinate newCentroid = otherCentroid -
centroid();
1601 double otherCentroidSize = otherModel->centroidSize(
true);
1602 double scaling = otherCentroidSize/currentCentroidSize;
1605 printInfo(
"Scale of Current model: " + QString::number(currentCentroidSize));
1606 printInfo(
"Scale of Other model: " + QString::number(otherCentroidSize));
1607 printInfo(
"Scale to be applied: " + QString::number(scaling));
1608 printInfo(
"Scale (with factor) to be applied: " + QString::number(factor*scaling));
1611 vtkSmartPointer<vtkTransform> transformer = vtkSmartPointer<vtkTransform>::New();
1612 transformer->Translate(newCentroid[0], newCentroid[1], newCentroid[2]);
1614 transformer->Scale(factor*scaling, factor*scaling, factor*scaling);
1629 if(filename.isEmpty())
1631 QSettings settings(
"Shekhar Chandra",
"milxQt");
1632 QString path = settings.value(
"recentPath").toString();
1633 QFileDialog *fileOpener =
new QFileDialog(
this);
1634 filename = fileOpener->getOpenFileName(
this,
1635 tr(
"Select File to Open"),
1637 tr(openModelExts.c_str()) );
1640 msgBox.setText(
"Similarity Transform");
1641 msgBox.setInformativeText(
"Do you want to use similarity matching? Rigid Body will be used otherwise.");
1642 msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
1643 msgBox.setDefaultButton(QMessageBox::No);
1644 int ret = msgBox.exec();
1646 if(ret == QMessageBox::Yes)
1650 if(filename.isEmpty())
1653 QPointer<milxQtModel> otherModel =
new milxQtModel;
1654 QPointer<milxQtFile> reader =
new milxQtFile;
1655 bool success = reader->
openModel(filename, otherModel);
1662 printInfo(
"Registering Meshes using ICP.");
1675 if(filename.isEmpty())
1677 QSettings settings(
"Shekhar Chandra",
"milxQt");
1678 QString path = settings.value(
"recentPath").toString();
1679 QFileDialog *fileOpener =
new QFileDialog(
this);
1680 filename = fileOpener->getOpenFileName(
this,
1681 tr(
"Select File to Open"),
1683 tr(openModelExts.c_str()) );
1686 msgBox.setText(
"Similarity Transform");
1687 msgBox.setInformativeText(
"Do you want to use similarity matching? Rigid Body will be used otherwise.");
1688 msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
1689 msgBox.setDefaultButton(QMessageBox::No);
1690 int ret = msgBox.exec();
1692 if(ret == QMessageBox::Yes)
1696 if(filename.isEmpty())
1699 QPointer<milxQtModel> otherModel =
new milxQtModel;
1700 QPointer<milxQtFile> reader =
new milxQtFile;
1701 bool success = reader->
openModel(filename, otherModel);
1706 if(otherModel->GetNumberOfPoints() !=
model.
Result()->GetNumberOfPoints())
1708 printError(
"Meshes must have same number of points to use this registration method.");
1714 printInfo(
"Registering Meshes using Landmark Transform.");
1727 printInfo(
"Extracting Texture of Model as an Image.");
1730 vtkSmartPointer<vtkImageData> tex =
modelActor->GetTexture()->GetInput();
1754 printInfo(
"Contour Surface Mode enabled.\nLeft Click to place points, Right click to place end point.");
1755 printInfo(
"Delete key to delete point, Shift+Delete key to reset.");
1757 vtkSmartPointer<vtkOrientedGlyphContourRepresentation> rep = vtkOrientedGlyphContourRepresentation::SafeDownCast(
milxQtRenderWindow::contourWidget->GetRepresentation() );
1758 rep->GetLinesProperty()->SetColor(1, 0.2, 0);
1759 rep->GetLinesProperty()->SetLineWidth(3.0);
1761 vtkSmartPointer<vtkPolygonalSurfacePointPlacer> pointPlacer = vtkSmartPointer<vtkPolygonalSurfacePointPlacer>::New();
1767 rep->SetPointPlacer(pointPlacer);
1769 vtkSmartPointer<vtkPolygonalSurfaceContourLineInterpolator> interpolator = vtkSmartPointer<vtkPolygonalSurfaceContourLineInterpolator>::New();
1770 interpolator->GetPolys()->AddItem(
model.
Result());
1771 rep->SetLineInterpolator(interpolator);
1794 printInfo(
"Contouring not enabled. Stopping.");
1799 vtkSmartPointer<vtkPolyData> contourMesh = rep->GetContourRepresentationAsPolyData();
1810 printInfo(
"Contouring not enabled. Stopping.");
1815 bool ok1 =
false, ok2 =
false;
1817 stddev = QInputDialog::getDouble(
this, tr(
"Please enter the standard deviation of the Gaussian"), tr(
"Standard Dev.:"), 3.0, 0.0, 1000.0, 3, &ok1);
1819 clampValue = QInputDialog::getDouble(
this, tr(
"Please enter the clamp (lowest allowed) value"), tr(
"Clamp Value:"), 1e-6, 0, 1.0, 10, &ok2);
1840 if(red < 0 || green < 0 || blue < 0)
1842 QPointer<QColorDialog> newColours =
new QColorDialog(
this);
1844 QColor newColour = newColours->getColor(QColor(defaultChannelValue, defaultChannelValue, defaultChannelValue),
1845 this,
"Choose New Colour", QColorDialog::ShowAlphaChannel);
1847 if(newColour.isValid())
1849 printInfo(
"Colour selected was: " + QString::number(newColour.redF()) +
", " + QString::number(newColour.greenF()) +
", " + QString::number(newColour.blueF()));
1877 opacity = QInputDialog::getDouble(
this, tr(
"Please enter the new opacity"),
1878 tr(
"Opacity:"), opacity, 0.0, 1.0, 3, &ok);
1893 modelActor->GetProperty()->SetInterpolationToPhong();
1895 modelActor->GetProperty()->SetInterpolationToFlat();
1897 QString shadingStr =
modelActor->GetProperty()->GetInterpolationAsString();
1898 printInfo(
"Using " + shadingStr +
" Shading");
1908 modelActor->GetProperty()->SetSpecularColor(0, 0, 0);
1910 modelActor->GetProperty()->SetSpecularPower(0.01);
1917 modelActor->GetProperty()->SetSpecularColor(1, 1, 1);
1918 modelActor->GetProperty()->SetSpecular(0.25);
1919 modelActor->GetProperty()->SetSpecularPower(10);
1937 vtkSmartPointer<vtkFloatArray> normalData2 = vtkFloatArray::SafeDownCast(
model.
Result()->GetPointData()->GetNormals());
1941 printInfo(
"No normals found. Generating point normals.");
1943 normalData2 = vtkFloatArray::SafeDownCast(
model.
Result()->GetPointData()->GetNormals());
1946 printInfo(
"There are " + QString::number(normalData2->GetNumberOfComponents()) +
" components in the current model (double Point Normals)");
1950 normalsModel->SetPoints(
model.
Result()->GetPoints());
1951 normalsModel->SetVectors(normalData2);
1952 normalsModel->generateVectorField();
1969 if(!xAxis && !yAxis && !zAxis)
1971 QMessageBox msgBoxX, msgBoxY, msgBoxZ;
1972 msgBoxX.setText(
"The model will be rotated");
1973 msgBoxX.setInformativeText(
"Do you want to flip the x-axis?");
1974 msgBoxX.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
1975 msgBoxX.setDefaultButton(QMessageBox::No);
1976 msgBoxY.setText(
"The model will be rotated");
1977 msgBoxY.setInformativeText(
"Do you want to flip the y-axis?");
1978 msgBoxY.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
1979 msgBoxY.setDefaultButton(QMessageBox::Yes);
1980 msgBoxZ.setText(
"The model will be rotated");
1981 msgBoxZ.setInformativeText(
"Do you want to flip the z-axis?");
1982 msgBoxZ.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
1983 msgBoxZ.setDefaultButton(QMessageBox::No);
1984 int retX = msgBoxX.exec();
1985 int retY = msgBoxY.exec();
1986 int retZ = msgBoxZ.exec();
1989 angle = QInputDialog::getDouble(
this, tr(
"Enter angle to rotate by"),
1990 tr(
"Angle:"), 90, -2147483647, 2147483647, 5, &ok1);
1992 if(retX == QMessageBox::Yes)
1994 if(retY == QMessageBox::Yes)
1996 if(retZ == QMessageBox::Yes)
2002 printInfo(
"Rotating Model along chosen axes from the model centroid.");
2014 if(!xAxis && !yAxis && !zAxis)
2016 QMessageBox msgBoxX, msgBoxY, msgBoxZ;
2017 msgBoxX.setText(
"The model will be flipped");
2018 msgBoxX.setInformativeText(
"Do you want to flip the x-axis?");
2019 msgBoxX.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
2020 msgBoxX.setDefaultButton(QMessageBox::No);
2021 msgBoxY.setText(
"The model will be flipped");
2022 msgBoxY.setInformativeText(
"Do you want to flip the y-axis?");
2023 msgBoxY.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
2024 msgBoxY.setDefaultButton(QMessageBox::Yes);
2025 msgBoxZ.setText(
"The model will be flipped");
2026 msgBoxZ.setInformativeText(
"Do you want to flip the z-axis?");
2027 msgBoxZ.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
2028 msgBoxZ.setDefaultButton(QMessageBox::No);
2029 int retX = msgBoxX.exec();
2030 int retY = msgBoxY.exec();
2031 int retZ = msgBoxZ.exec();
2033 if(retX == QMessageBox::Yes)
2035 if(retY == QMessageBox::Yes)
2037 if(retZ == QMessageBox::Yes)
2041 printInfo(
"Flipping/Reflecting Model along chosen axes.");
2054 scale->GetLabelTextProperty()->SetColor(0, 0, 0);
2055 scale->GetTitleTextProperty()->SetColor(0, 0, 0);
2066 scale->GetLabelTextProperty()->SetColor(1.0, 1.0, 1.0);
2067 scale->GetTitleTextProperty()->SetColor(1.0, 1.0, 1.0);
2080 outlineMesh = vtkSmartPointer<vtkOutlineFilter>::New();
2082 #if VTK_MAJOR_VERSION <=5 2086 #endif // VTK_MAJOR_VERSION 2088 #if VTK_MAJOR_VERSION <=5 2098 outlineModel->generateModel();
2142 #if (VTK_MAJOR_VERSION > 5 || (VTK_MAJOR_VERSION == 5 && VTK_MINOR_VERSION > 6)) 2147 printWarning(
"A scaling has been applied to the z-axis. Upgrade your VTK version to at least 5.8.x or above.");
2184 vtkSmartPointer<vtkActorCollection> collection =
renderer->GetActors();
2186 const size_t n = collection->GetNumberOfItems();
2187 printDebug(
"Detected "+QString::number(n)+
" overlays");
2189 collection->InitTraversal();
2190 for(
size_t j = 0; j < n; j ++)
2192 vtkSmartPointer<vtkActor> actor = collection->GetNextItem();
2213 msgBox.setText(
"An auto adjusted bar is about to be created");
2214 msgBox.setInformativeText(
"Would you like to customise the bar?");
2215 msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
2216 msgBox.setDefaultButton(QMessageBox::No);
2218 int ret = QMessageBox::No;
2220 ret = msgBox.exec();
2222 const float barWidth = 0.1, barHeight = 0.7;
2224 vtkSmartPointer<vtkLogLookupTable> logLookupTable;
2228 logLookupTable = vtkSmartPointer<vtkLogLookupTable>::New();
2229 logLookupTable->DeepCopy(vtkLookupTable::SafeDownCast(
lookupTable));
2232 if(ret == QMessageBox::Yes && !quiet)
2234 bool ok1 =
false, ok2 =
false, ok3 =
false, ok4 =
false;
2236 minRange = QInputDialog::getDouble(
this, tr(
"Enter Table Range of new Lookup Table"),
2237 tr(
"Minimum:"), 0, -2147483647, 2147483647, 5, &ok1);
2238 maxRange = QInputDialog::getDouble(
this, tr(
"Enter Table Range of new Lookup Table"),
2239 tr(
"Maximum:"), 1, -2147483647, 2147483647, 5, &ok2);
2240 noOfLabels = QInputDialog::getInt(
this, tr(
"How many labels to show"),
2241 tr(
"Labels:"), noOfLabels, 0, 99, 1, &ok3);
2242 title = QInputDialog::getText(
this, tr(
"Title of Bar"),
2243 tr(
"Title:"), QLineEdit::Normal,
2246 if(!ok1 || !ok2 || !ok3 || !ok4)
2250 scale->SetLookupTable(logLookupTable);
2253 scale->SetNumberOfLabels(noOfLabels);
2255 modelMapper->SetScalarRange( minRange, maxRange );
2256 customScalarBar =
true;
2258 else if(quiet && minRange != maxRange)
2260 printInfo(
"Using custom scalar range for scalars.");
2262 scale->SetLookupTable(logLookupTable);
2265 scale->SetNumberOfLabels(noOfLabels);
2267 modelMapper->SetScalarRange( minRange, maxRange );
2268 customScalarBar =
true;
2274 scale->SetLookupTable(logLookupTable);
2277 scale->SetNumberOfLabels(3);
2278 customScalarBar =
false;
2281 scale->SetTitle(title.toStdString().c_str());
2282 scale->GetLabelTextProperty()->SetFontFamilyToArial();
2283 scale->GetLabelTextProperty()->SetFontSize(8);
2284 scale->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport();
2285 scale->GetPositionCoordinate()->SetValue(.2,.05);
2286 scale->SetWidth( barWidth );
2287 scale->SetHeight( barHeight );
2288 scale->SetPosition( 0.99 - barWidth, 0.1 );
2289 scale->SetLabelFormat(
"%-#6.3f");
2290 scale->GetTitleTextProperty()->SetFontFamilyToArial();
2291 scale->GetTitleTextProperty()->SetFontSize(8);
2292 scale->GetLabelTextProperty()->SetJustificationToCentered();
2296 scale->GetLabelTextProperty()->SetColor(0, 0, 0);
2297 scale->GetTitleTextProperty()->SetColor(0, 0, 0);
2301 scalarBar->SetInteractor(QVTKWidget::GetInteractor());
2311 if(
model.
Result()->GetPointData()->GetScalars() == NULL)
2318 if(
scaleAct->isChecked() || forceDisplay)
2328 if(filename.isEmpty())
2330 QSettings settings(
"Shekhar Chandra",
"milxQt");
2331 QString path = settings.value(
"recentPath").toString();
2332 QFileDialog *fileOpener =
new QFileDialog(
this);
2333 filename = fileOpener->getSaveFileName(
this,
2334 tr(
"Select File to Save"),
2336 tr(
"CSV Files (*.txt *.csv)") );
2339 if(filename.isEmpty())
2342 QPointer<milxQtFile> scalarsWriter =
new milxQtFile;
2434 if(
model.
Result()->GetPointData()->GetArray(arrayName.toStdString().c_str())->GetNumberOfComponents() == 1)
2436 printInfo(
"Loaded Array " + arrayName +
" as scalars");
2437 model.
Result()->GetPointData()->SetActiveAttribute( arrayName.toStdString().c_str(), vtkDataSetAttributes::SCALARS );
2439 else if(
model.
Result()->GetPointData()->GetArray(arrayName.toStdString().c_str())->GetNumberOfComponents() == 3)
2441 printInfo(
"Loaded Array " + arrayName +
" as vectors");
2442 model.
Result()->GetPointData()->SetActiveAttribute( arrayName.toStdString().c_str(), vtkDataSetAttributes::VECTORS );
2443 printInfo(
"Use 'Generate Vector Field' to see the vectors.");
2446 printInfo(
"Cannot Load Array " + arrayName +
". Too many components.");
2454 double range[2] = {0, 1.0};
2459 if(
GetScalars()->GetNumberOfComponents() > 1)
2460 printInfo(
"Found multi-component scalars. Not using colour map and using colours directly.");
2467 if(zeroRGBA[3] == 0.0)
2468 lookupTable->SetTableValue(0, zeroRGBA[0], zeroRGBA[1], zeroRGBA[2], 1.0);
2471 modelMapper->SetScalarRange( range[0], range[1] );
2485 menu->addSeparator()->setText(tr(
"Extensions"));
2488 menu->addAction(currAct);
2490 menu->addSeparator();
2495 menu->addSeparator();
2498 menu->addAction(currAct);
2502 menu->addMenu(currMenu);
2522 vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::SafeDownCast(obj);
2524 QString message =
"";
2530 if (
dataPicker->Pick(iren->GetEventPosition()[0],
2531 iren->GetEventPosition()[1],
2536 vtkIdType nVolIdx =
dataPicker->GetPointId();
2540 double *coords =
model.
Result()->GetPoint(nVolIdx);
2544 double *scalar =
model.
Result()->GetPointData()->GetScalars()->GetTuple(nVolIdx);
2546 if(
model.
Result()->GetPointData()->GetScalars()->GetNumberOfComponents() == 3)
2547 message =
"Point " + QString::number(nVolIdx) +
": (" + QString::number(coords[0]) +
", " + QString::number(coords[1]) +
", " + QString::number(coords[2]) +
") = " 2548 +
"[" + QString::number(scalar[0]) +
", " + QString::number(scalar[1]) +
", " + QString::number(scalar[2]) +
"]";
2549 else if(
model.
Result()->GetPointData()->GetScalars()->GetNumberOfComponents() == 2)
2550 message =
"Point " + QString::number(nVolIdx) +
": (" + QString::number(coords[0]) +
", " + QString::number(coords[1]) +
", " + QString::number(coords[2]) +
") = " 2551 +
"[" + QString::number(scalar[0]) +
", " + QString::number(scalar[1]) +
"]";
2553 message =
"Point " + QString::number(nVolIdx) +
": (" + QString::number(coords[0]) +
", " + QString::number(coords[1]) +
", " + QString::number(coords[2]) +
") = " 2554 + QString::number(scalar[0]);
2558 message =
"Point " + QString::number(nVolIdx) +
": (" + QString::number(coords[0]) +
", " + QString::number(coords[1]) +
", " + QString::number(coords[2]) +
")";
2570 createCustomConnections(copyMenu->actions());
2584 customScalarBar =
false;
2598 generateMenu->setTitle(QApplication::translate(
"Model",
"Generate", 0, QApplication::UnicodeUTF8));
2600 genModelAct->setText(QApplication::translate(
"Model",
"Model", 0, QApplication::UnicodeUTF8));
2603 genVerticesAct->setText(QApplication::translate(
"Model",
"Vertices (Vertex Glyphs)", 0, QApplication::UnicodeUTF8));
2606 genNormalsAct->setText(QApplication::translate(
"Model",
"Normals", 0, QApplication::UnicodeUTF8));
2609 genVectorsAct->setText(QApplication::translate(
"Model",
"Vector Field", 0, QApplication::UnicodeUTF8));
2612 genTensorsAct->setText(QApplication::translate(
"Model",
"Tensor Field", 0, QApplication::UnicodeUTF8));
2615 genHedgehogAct->setText(QApplication::translate(
"Model",
"Hedgehog Field", 0, QApplication::UnicodeUTF8));
2618 genDelaunayAct->setText(QApplication::translate(
"Model",
"Delaunay Graph", 0, QApplication::UnicodeUTF8));
2621 genDelaunayTri2DAct->setText(QApplication::translate(
"Model",
"Delaunay 2D Triangulation", 0, QApplication::UnicodeUTF8));
2624 genDelaunayTriAct->setText(QApplication::translate(
"Model",
"Delaunay Triangulation", 0, QApplication::UnicodeUTF8));
2629 genPointModelAct->setText(QApplication::translate(
"Model",
"Point Model", 0, QApplication::UnicodeUTF8));
2632 genLabelsAct->setText(QApplication::translate(
"Model",
"Vertex Labels", 0, QApplication::UnicodeUTF8));
2635 genPointIDsAct->setText(QApplication::translate(
"Model",
"Point ID Scalars", 0, QApplication::UnicodeUTF8));
2638 genSamplesAct->setText(QApplication::translate(
"Model",
"Sampled Points", 0, QApplication::UnicodeUTF8));
2641 genKmeansAct->setText(QApplication::translate(
"Model",
"K-Means Point Clustering", 0, QApplication::UnicodeUTF8));
2644 genQuantiseAct->setText(QApplication::translate(
"Model",
"Snap/Quantise Points to a Grid", 0, QApplication::UnicodeUTF8));
2647 genCapBoundaries->setText(QApplication::translate(
"Model",
"Cap the Boundaries of Model", 0, QApplication::UnicodeUTF8));
2650 genRegionLabels->setText(QApplication::translate(
"Model",
"Label Unconnected Regions", 0, QApplication::UnicodeUTF8));
2653 genElevation->setText(QApplication::translate(
"Model",
"Elevation", 0, QApplication::UnicodeUTF8));
2656 genReebGraph->setText(QApplication::translate(
"Model",
"Reeb Graph", 0, QApplication::UnicodeUTF8));
2662 operateMenu->setTitle(QApplication::translate(
"Model",
"Operations", 0, QApplication::UnicodeUTF8));
2664 cleanAct->setText(QApplication::translate(
"Model",
"&Clean Mesh", 0, QApplication::UnicodeUTF8));
2665 cleanAct->setShortcut(tr(
"Alt+c"));
2666 triAct =
new QAction(
this);
2667 triAct->setText(QApplication::translate(
"Model",
"&Triangulate", 0, QApplication::UnicodeUTF8));
2668 triAct->setShortcut(tr(
"Alt+t"));
2670 decimateAct->setText(QApplication::translate(
"Model",
"&Decimate Mesh", 0, QApplication::UnicodeUTF8));
2673 quadricDecimateAct->setText(QApplication::translate(
"Model",
"&Quadric Decimate Mesh", 0, QApplication::UnicodeUTF8));
2676 clusterDecimateAct->setText(QApplication::translate(
"Model",
"&Quadric Cluster Decimate Mesh", 0, QApplication::UnicodeUTF8));
2679 smoothAct->setText(QApplication::translate(
"Model",
"Smooth/&Fair (Laplacian) Mesh", 0, QApplication::UnicodeUTF8));
2682 smoothSincAct->setText(QApplication::translate(
"Model",
"Smooth/&Fair (Windowed Sinc) Mesh", 0, QApplication::UnicodeUTF8));
2685 curvatureAct->setText(QApplication::translate(
"Model",
"Mean Curvature", 0, QApplication::UnicodeUTF8));
2690 transformMenu->setTitle(QApplication::translate(
"Model",
"Transforms", 0, QApplication::UnicodeUTF8));
2692 transformAct->setText(QApplication::translate(
"Model",
"Transform (via File) from ...", 0, QApplication::UnicodeUTF8));
2695 matchAct->setText(QApplication::translate(
"Model",
"&Match Info to ...", 0, QApplication::UnicodeUTF8));
2696 matchAct->setShortcut(tr(
"Alt+a"));
2698 registerAct->setText(QApplication::translate(
"Model",
"&Register (via ICP) to ...", 0, QApplication::UnicodeUTF8));
2701 registerLandmarkAct->setText(QApplication::translate(
"Model",
"&Register (via Landmarks) to ...", 0, QApplication::UnicodeUTF8));
2704 voxeliseAct->setText(QApplication::translate(
"Model",
"&Voxelise Model", 0, QApplication::UnicodeUTF8));
2709 scalarMenu->setTitle(QApplication::translate(
"Model",
"Scalar Operations", 0, QApplication::UnicodeUTF8));
2711 renameScalarsAct->setText(QApplication::translate(
"Model",
"Rename Scalars", 0, QApplication::UnicodeUTF8));
2714 thresholdAct->setText(QApplication::translate(
"Model",
"Clip Mesh based on Scalar Threshold", 0, QApplication::UnicodeUTF8));
2717 thresholdScalarsAct->setText(QApplication::translate(
"Model",
"Threshold Scalar Values", 0, QApplication::UnicodeUTF8));
2720 thresholdScalarsBinaryAct->setText(QApplication::translate(
"Model",
"Binary Threshold Scalar Values", 0, QApplication::UnicodeUTF8));
2723 maskScalarsAct->setText(QApplication::translate(
"Model",
"Mask Scalar Values", 0, QApplication::UnicodeUTF8));
2726 gradientAct->setText(QApplication::translate(
"Model",
"Scalar Gradient Field", 0, QApplication::UnicodeUTF8));
2729 removeScalarsAct->setText(QApplication::translate(
"Model",
"&Remove All Scalars", 0, QApplication::UnicodeUTF8));
2732 scalarsAct->setText(QApplication::translate(
"Model",
"&Load Scalars from ...", 0, QApplication::UnicodeUTF8));
2735 outScalarsAct->setText(QApplication::translate(
"Model",
"&Output Scalars as CSV File", 0, QApplication::UnicodeUTF8));
2747 doAct =
new QAction(
this);
2748 doAct->setText(QApplication::translate(
"Model",
"&Undo Last Processing", 0, QApplication::UnicodeUTF8));
2749 doAct->setShortcut(tr(
"Alt+u"));
2751 infoAct->setText(QApplication::translate(
"Model",
"&Model Information", 0, QApplication::UnicodeUTF8));
2752 infoAct->setShortcut(tr(
"Alt+m"));
2754 textureAct->setText(QApplication::translate(
"Model",
"&Extract Texture", 0, QApplication::UnicodeUTF8));
2757 flipAct->setText(QApplication::translate(
"Model",
"Flip Model", 0, QApplication::UnicodeUTF8));
2758 flipAct->setShortcut(tr(
"Ctrl+Alt+f"));
2760 rotateAct->setText(QApplication::translate(
"Model",
"Rotate Model", 0, QApplication::UnicodeUTF8));
2761 rotateAct->setShortcut(tr(
"Ctrl+Alt+r"));
2765 pointsAct->setText(QApplication::translate(
"Model",
"&Points", 0, QApplication::UnicodeUTF8));
2769 wireframeAct->setText(QApplication::translate(
"Model",
"&Wireframe", 0, QApplication::UnicodeUTF8));
2773 surfaceAct->setText(QApplication::translate(
"Model",
"&Surface", 0, QApplication::UnicodeUTF8));
2782 colourAct->setText(QApplication::translate(
"Model",
"Change Mesh &Colour/Transparency", 0, QApplication::UnicodeUTF8));
2785 interpAct->setText(QApplication::translate(
"Model",
"Best (Phong) Shading", 0, QApplication::UnicodeUTF8));
2790 specularAct->setText(QApplication::translate(
"Model",
"Specular Lighting", 0, QApplication::UnicodeUTF8));
2796 normalsAct->setText(QApplication::translate(
"Model",
"Show Normals", 0, QApplication::UnicodeUTF8));
2801 centroidAct->setText(QApplication::translate(
"Model",
"Show Centroid", 0, QApplication::UnicodeUTF8));
2806 outlineAct->setText(QApplication::translate(
"Model",
"Show Outline Box", 0, QApplication::UnicodeUTF8));
2811 cubeAxesAct->setText(QApplication::translate(
"Model",
"Show Cube (Plot) Axes", 0, QApplication::UnicodeUTF8));
2816 overlaysAct->setText(QApplication::translate(
"Model",
"Remove Overlays/Actors", 0, QApplication::UnicodeUTF8));
2821 selectPointsAct->setText(QApplication::translate(
"Model",
"Select Points within Contour", 0, QApplication::UnicodeUTF8));
2823 weightAct->setText(QApplication::translate(
"Model",
"Gaussian Weights from Contour", 0, QApplication::UnicodeUTF8));
2850 connect(
cleanAct, SIGNAL(triggered()),
this, SLOT(
clean()));
2877 connect(
flipAct, SIGNAL(triggered()),
this, SLOT(
flip()));
2906 doAct->setToolTip(
"Undo/Redo last processing computed.");
2907 doAct->setStatusTip(
"Undo/Redo last processing computed.");
2908 cleanAct->setToolTip(
"Clean the mesh removing and merging duplicate points");
2909 cleanAct->setStatusTip(
"Clean the mesh removing and merging duplicate points");
2910 triAct->setToolTip(
"Triangulate the mesh. Often a prerequisite to many algorithms");
2911 triAct->setStatusTip(
"Triangulate the mesh. Often a prerequisite to many algorithms");
2912 decimateAct->setToolTip(
"Reduce the number of polygon and vertices of the mesh by factor");
2913 decimateAct->setStatusTip(
"Reduce the number of polygon and vertices of the mesh by factor");
2914 smoothAct->setToolTip(
"Denoise the mesh using the standard Laplacian smoothing algorithm");
2915 smoothAct->setStatusTip(
"Denoise the mesh using the standard Laplacian smoothing algorithm");
2916 smoothSincAct->setToolTip(
"Denoise the mesh using the windowed sinc smoothing algorithm");
2917 smoothSincAct->setStatusTip(
"Denoise the mesh using the windowed sinc smoothing algorithm");
2918 transformAct->setToolTip(
"Affine transform the model using a ITK transform file");
2919 transformAct->setStatusTip(
"Affine transform the model using a ITK transform file");
2920 infoAct->setToolTip(
"Show the centroid, centroid size and covariance matrix of the model");
2921 infoAct->setStatusTip(
"Show the centroid, centroid size and covariance matrix of the model");
2922 matchAct->setToolTip(
"Match the information (centroid and scale) of another model to this model");
2923 matchAct->setStatusTip(
"Match the information (centroid and scale) of another model to this model");
2924 registerAct->setToolTip(
"Register or align this model to another model using Iterative Closest Point algorithm");
2925 registerAct->setStatusTip(
"Register or align this model to another model using Iterative Closest Point algorithm");
2926 voxeliseAct->setToolTip(
"Convert the surface to an image volume by voxelising it.");
2927 voxeliseAct->setStatusTip(
"Convert the surface to an image volume by voxelising it.");
2928 colourAct->setToolTip(
"Change the mesh colour and transparency (colour is only applicable for meshes with no scalars)");
2929 colourAct->setStatusTip(
"Change the mesh colour and transparency (colour is only applicable for meshes with no scalars)");
2930 interpAct->setToolTip(
"Change the interpolation of the mesh");
2931 interpAct->setStatusTip(
"Change the interpolation of the mesh");
2932 specularAct->setToolTip(
"Change the lighting to be shiny or not");
2933 specularAct->setStatusTip(
"Change the lighting to be shiny or not");
2934 scaleAct->setToolTip(
"Show a colour bar of the mesh scalars");
2935 scaleAct->setStatusTip(
"Show a colour bar of the mesh scalars");
2948 contextMenu->setTitle(QApplication::translate(
"MainWindow",
"Modelling", 0, QApplication::UnicodeUTF8));
2962 contextMenu->addSeparator()->setText(tr(
"Options"));
2969 contextMenu->addSeparator()->setText(tr(
"Display"));
3078 arrayMenu->setTitle(QApplication::translate(
"Model",
"&Load Array as Scalars/Vectors", 0, QApplication::UnicodeUTF8));
3080 for(
int j = 0; j <
model.
Result()->GetPointData()->GetNumberOfArrays(); j ++)
3082 QAction *act =
new QAction(
this);
3083 act->setText(QApplication::translate(
"Model",
model.
Result()->GetPointData()->GetArrayName(j), 0, QApplication::UnicodeUTF8));
3089 if(
model.
Result()->GetPointData()->GetNumberOfArrays() == 0)
QAction * scaleAct
Action for the scale bar of the display.
void printWarning(QString msg)
Warning message wrapper for console.
QAction * infoAct
Action for showing the model info.
QMenu * generationMenu()
Return the generate menu with the milxQtModel class ordering. This is for the benefit of derived clas...
static Type Centroid(const vnl_vector< Type > &data)
Compute the centroid (or the mean) of a data vector.
void toggleInterpolation(bool quiet=false)
Toggles the interpolation of the mesh between Phong and Gouraud. Default is Gouraud.
int defaultView
Default view for data (default is axial)
void DelaunayTriangulation()
Compute the Delaunay 3D triangluation of the points in the mesh.
bool logScale
Using custom scalar bar?
void GenerateVertexScalars()
Generate vertex scalars for display from point data. This colours the mesh by point ids...
void undoProcessing()
Undo/Redo the processing last done. Only applies to processing such as clean() etc.
void printError(QString msg)
Error message wrapper for console.
void GenerateCappedBoundaries()
Generate capped boundaries for open meshes. This closes off open ends of a mesh.
void Update()
Updates the model to be the most current.
void generateDelaunay2DTriangulation()
Generates the Delaunay 2D Triangulation (resulting in triangulated cells) for the model...
void AddArray(vtkSmartPointer< vtkDataArray > array)
Appends an array to the model.
virtual void createMenu(QMenu *menu)
Create the menu for the data in this object. Used for context menu and file menus.
float colourRed
Saved colour, used for refresh etc.
virtual void viewToZXPlane()
Change view to zx-plane.
vtkSmartPointer< vtkLODActor > delaunayActor
Delaunay triangulator actor.
milxQtModel(QWidget *theParent=0, bool contextSystem=true)
The standard constructor.
void RemoveActor(vtkSmartPointer< vtkProp > actor)
Remove the VTK actor from this window.
QAction * gradientAct
Action for calculating gradient of the scalars of a model.
void changeOpacity(float opacity=-1)
Changes the opacity/transparency of the model. You should use the changeColour() member and set its a...
QAction * genKmeansAct
Action for calculating k-means clustering of points in a model.
double centroidSize(bool average=false)
Computes and returns the centroid size of the model currently held which can be used for rescaling...
QAction * normalsAct
Action for showing the normals of a model.
QAction * outlineAct
show outline action
QActionGroup * arrayGroup
Grouping for check boxes.
QAction * voxeliseAct
Action for voxelising surface.
void GenerateHedgehog(const double newScale=0.0)
Generate a line field for vectors present (as an array) in the mesh at given scaling.
QAction * saveViewFileAct
Save camera view to file.
void generateLabels()
Generates the model vertices with labels. It requires that data has been set or assigned already...
QMenu * viewMenu
Context Menu.
void generateRegionLabels()
Generates scalars for unconnected regions of the mesh.
void surfaceToImage(vtkSmartPointer< vtkPolyData >)
Emit signal to compute surface to image process.
bool openModel(const QString filename, vtkPolyData *data)
Opens a model file, which can be a VTK XML, Legacy VTK PolyData File (i.e. either a *...
void generateIsoSurface(vtkSmartPointer< vtkImageData > img, int contourNumber=-1, double value=0.0)
Generates a iso surface or contour from image data, i.e. the result of Marching Cubes algorithm at va...
void generateDelaunayGraph(float red=defaultColour, float green=defaultColour, float blue=defaultColour)
Generates the Delaunay 3D graph for the dataset. Arguments provided are for the colours of the edges ...
static vtkMatrix4x4 * OpenVTKTransform(std::string filename)
Opens a VTK transform file and converts it to a VTK transform matrix.
int currentView
Current view for data.
void contextMenuEvent(QContextMenuEvent *event)
The context menu setup member.
void RemoveScalars()
Removes all the scalars from the current model. Same as ClearScalars()
vtkSmartPointer< vtkActor2D > modelLabelsActor
Label Actor.
QAction * maskScalarsAct
Action for masking scalar values on model.
void generateDelaunayTriangulation(float red=defaultColour, float green=defaultColour, float blue=defaultColour)
Generates the Delaunay 3D Triangulation (resulting in tetrahdral cells) for the dataset. Arguments provided are for the colours of the cells of the model.
void GenerateVertices()
Generate (only) vertices for display from point data. Good for when only points in mesh...
void setName(const QString filename)
Set the name of the data.
QList< QAction * > extActionsToAdd
Extension actions to add.
void createConnections()
Create the connections for context menu etc.
QAction * overlaysAct
removes actors/overlays action
QAction * weightAct
produce Gaussian weights from contour
QAction * textureAct
Action for extracting texture.
void generateCappedBoundaries()
Generates capped boundaries for meshes with boundaries (such as large holes or voids).
vtkSmartPointer< vtkLODActor > modelActor
Model actor.
void Flip(const bool xAxis, const bool yAxis, const bool zAxis)
Flip the mesh along the selected axes.
void loadScalars(QString filename="")
Loads the scalars from another model, where both models must have the same number of points...
QAction * smoothSincAct
Action for smooth model.
QAction * pointsAct
Show points.
void GenerateTensorField(const double newScale=0.0)
Generate tensor field for tensors present (as an array) in the mesh at given scaling.
QAction * genVectorsAct
Action for generating vector fields.
vnl_matrix< double > modelCovarianceMatrix
Covariance matrix of the model.
vtkSmartPointer< vtkPolyDataMapper > modelMapper
Model mapper.
vtkSmartPointer< vtkContourWidget > contourWidget
contour interaction
vtkSmartPointer< vtkRenderer > renderer
Renderer for the data.
A general math object for computing common operations such a centroids etc.
void AddActor(vtkSmartPointer< vtkProp > actor)
Add a VTK actor to this window.
void generateSurface(float red=defaultColour, float green=defaultColour, float blue=defaultColour)
Generates a surface display of the model, i.e. points at each point for the dataset. Arguments provided are for the colours of the points.
This class represents the MILX Qt Render Window Display object using QVTK.
void cubeAxesDisplay(double *range=NULL)
Toggles the cube (plot) axes display.
void GenerateRegions()
Generate connected regions for the mesh labelled by scalar values.
QAction * scalarsAct
Action for loading scalars from another model.
QActionGroup * scalarsGroup
Grouping for scalars.
coordinate modelCentroid
Centroid coordinate of the model.
void Mask(vtkSmartPointer< vtkPolyData > maskMesh)
Mask the scalars on the mesh based on values of maskMesh being >= 1.
void generateVertices(float red=defaultColour, float green=defaultColour, float blue=defaultColour)
Generates the vertices for the dataset. Arguments provided are for the colours of the vertices...
QAction * genDelaunayTri2DAct
Action for generating Delaunay triangulation.
QAction * genLabelsAct
Action for generating labels.
vtkSmartPointer< vtkLookupTable > lookupTable
Lookup table for the shapes/images, base class is used to allow references to different look up table...
vtkSmartPointer< vtkDataArray > GetTensors()
Returns the tensors (3x3 matrix per vertex) of the model currently held.
void decimate(double factor=0.0)
Reduce the polygon count (decimate) the model. Factor to reduce by is acquired by input a dialog...
vtkSmartPointer< vtkPoints > GetPoints()
Returns the points of the model currently held.
void enableCubeAxes(double *range=NULL, double *bounds=NULL)
Display cube (plot) axes of data.
QAction * viewZY
Change view to zy-plane (Coronal)
void disableOutline()
Disables the outline box display.
QAction * genReebGraph
Action for Reeb graphs of mesh.
QAction * surfaceAct
Show surface.
bool loaded
Loaded Image from file?
void SetPolys(vtkSmartPointer< vtkCellArray > modelPolys)
Assign polygons to the model via the array given.
void generatePointIDsScalars()
Generates scalars for the vertices in the model based on their point IDs. It requires that model has ...
void generateStreamLines(vtkSmartPointer< vtkImageData > seeds, float timestep=0.0)
Generates stream lines i.e. integrates a vector field starting at seed points.
void registerICP(QString filename="", bool similarity=false)
Register or align current mesh to another mesh using Iterative Closest Point algorithm, whose filename is provided. If not provided, then Open File dialog will apear.
QAction * genTensorsAct
Action for generating vector fields.
QMenu * contextMenu
Context Menu.
virtual void contour()
Draw contour interactively.
void SetGraph(vtkSmartPointer< vtkMutableUndirectedGraph > graph)
Converts a graph to polydata/mesh ready for display.
This class represents the MILX Qt File I/O object using VTK/ITK/Qt.
void createActions()
Create the actions for context menu etc.
milxQtModel & operator=(const milxQtModel &operand)
Assignment operator for models. Only copies the data as given by GetOutput() of operand. EXPERIMENTAL.
void GenerateSampledPoints(const double distance)
Generate sampled points (only points) for the mesh at given spacing on triangles. ...
void SetVectors(vtkSmartPointer< vtkDataArray > modelVectors)
Sets the vectors for the model to be generated. Must pass a vtkFloatArray objects, which is easy to use.
void removeScalars()
Removes all the scalars from the model.
void RemoveScalars()
Removes the scalars of the model.
void generateKMeansClustering(int numberOfClusters=0)
Generates K-means clustering of the points in the model with the number of clusters provided...
QAction * smoothAct
Action for smooth model.
bool transformed
Transformed?
coordinate & centroid()
Computes and returns the centroid of the model currently held.
QAction * removeScalarsAct
Action for removing scalars from model.
virtual void viewToZYPlane()
Change view to zy-plane.
void DelaunayGraph3D()
Compute the Delaunay 3D graph of the points in the mesh.
void AddInput(vtkSmartPointer< vtkPolyData > mesh)
Assigns and coninually appends meshes provided to the class, preparing for display. Call generateModel() and then show() to display.
virtual void weightGaussianFromContour(float stddev=-1.0, float clampValue=-1.0)
Select model points inside contour, compute distance map and Gaussian weight the result.
bool largeMode
Large Data set mode enabled?
void generateTubes(float red=defaultColour, float green=defaultColour, float blue=defaultColour)
Generates the tubes for the dataset. Arguments provided are for the colours of the tubes...
QAction * wireframeAct
Show wireframe.
QAction * quadricDecimateAct
Action for Quadric decimating model.
QAction * renameScalarsAct
Action for renaming scalars array.
void thresholdScalarsBinary(double lowValue=0.0, double upValue=0.0, double insideVal=1.0, double outsideVal=0.0)
Binary threshold scalar values on the mesh. Geometry and topology is unchanged, and scalars become tw...
QAction * humanAct
Show human view orientation glyph?
float colourGreen
Saved colour, used for refresh etc.
void SetInput(vtkSmartPointer< vtkPolyData > mesh)
Assigns the mesh provided to the class, preparing for display. Call generateModel() and then show() t...
QAction * registerLandmarkAct
Action for registering two models via landmark transform.
void voxelise()
Convert surface to an image volume.
void setDeletableOnClose(bool delOnClose)
Set if the window deletable on close. Default is true.
QList< QMenu * > menusToAdd
Context Menu's to add.
bool appended
Appended data present?
void generateNormals(int pointNormals=0)
Generates normals of the model, with point normals being default.
virtual void copyToContextMenu(QMenu *copyMenu)
Copies the menu, by duplicating the entries, to the context menu. Connections are assumed to be made ...
QAction * backgroundAct
Action for axes of the display.
QAction * triAct
Action for triangulate model.
vtkSmartPointer< vtkOutlineFilter > outlineMesh
outline box
QAction * registerAct
Action for registering two models.
void createConnections()
Create the connections for context menu etc.
void Delaunay2DTriangulation()
Compute the Delaunay 2D triangluation of the points in the mesh.
static vtkMatrix4x4 * OpenITKTransform(std::string filename)
Opens an ITK transform file and converts it to a VTK transform matrix.
QString prefix
Prefix of the data.
void SetPolys(vtkSmartPointer< vtkCellArray > modelPolys)
Sets the polygons for the model to be generated. Must pass a vtkCellArray objects, which is easy to use.
QAction * centroidAct
show centroid action
vtkSmartPointer< vtkPolyData > & Result()
Returns the current model, i.e. the result of the latest operation.
void printDebug(QString msg)
Debug message wrapper for console.
QAction * contourPolyDataAct
Save contour surface points as polydata.
vtkIdType GetNumberOfPoints()
Returns the total number of points of the model currently held.
QAction * genQuantiseAct
Action for quantising points in a model.
bool modelled
Model has been generated?
void generateWireframe(float red=defaultColour, float green=defaultColour, float blue=defaultColour)
Generates the 3D graph for the dataset. Arguments provided are for the colours of the edges of the gr...
void enableOutline(vtkDataObject *dataOutline=NULL)
Display outline box of data.
void AddArray(vtkSmartPointer< vtkDataArray > array)
Adds an array to the model, appending it to the current list of arrays.
This class represents the MILX Qt Model/Mesh Display object using VTK.
virtual void scaleDisplay(const bool forceDisplay=false)
Toggles the scale bar display.
bool computedCovariance
Computed covariance matrix already?
QAction * contourAct
Action for contouring surface points using Dijkstras algorithm.
void SetPoints(vtkSmartPointer< vtkPoints > modelPoints)
Assign points to the model.
void outputScalars(QString filename="")
Output the scalars of model to file.
void generatePoints(float red=defaultColour, float green=defaultColour, float blue=defaultColour)
Generates points display of the model, i.e. points at each point for the dataset. Arguments provided ...
void generatePointModel(double newScale=1.0, float red=defaultColour, float green=defaultColour, float blue=defaultColour)
Generates a point model, i.e. glyphs at each point for the dataset. Arguments provided are for the co...
QList< ImageActorItem > imageActors
Images actors being displayed in model view.
void Render()
Force Render or Update of the display.
void Decimate(const float reduceFactor)
Decimate the mesh (in terms of points) using the Decimate PRO. Generally use QuadricDecimate() instea...
void SetVectors(vtkSmartPointer< vtkDataArray > modelVectors)
Sets the vector field of the mesh (vectors per vertex of the surface)
QAction * genCapBoundaries
Action for capping the boundaries of a open mesh.
QAction * decimateAct
Action for decimating model.
QAction * specularAct
Action for changing the specular of a model to flat.
void setDefaultOrientation(int orientMode)
Change orientation mode to one of the supported standards. Default: Radiological. ...
void registerLandmarks(QString filename="", bool similarity=false)
Register or align current mesh to another mesh using the landmark transform, whose filename is provid...
vnl_matrix< double > & covarianceMatrix()
Computes and returns the covariance matrix of the model currently held.
QAction * cleanAct
Action for cleaning model.
bool scalarsSet
Scalars set to points of mesh?
virtual void enableScale(QString title="", const bool quiet=false, double minRange=0.0, double maxRange=0.0, int noOfLabels=3)
Enable scale bar display with the title provided.
void refresh()
Refresh the display of the model.
QMenu * basicContextMenu()
Return the basic context menu with the milxQtModel class ordering. This is for the benefit of derived...
bool outlineBefore
scale displayed?
QMenu * scalarsMenu()
Return the scalars menu with the milxQtModel class ordering. This is for the benefit of derived class...
QAction * curvatureAct
Action for calculating mean curvation of a model.
void matchInfo(QString filename="", bool rescale=true, double factor=1.0)
Loads another model and matches its centroid and (optionally) scales this model to match...
void SetOpacity(double opacity)
Adjusts the opacity of the model in the display. 1.0 is totally opaque and 0.0 is completely transpar...
QAction * genDelaunayTriAct
Action for generating Delaunay triangulation.
void rotate(bool xAxis=false, bool yAxis=false, bool zAxis=false, float angle=90)
Rotate model along any axis, useful for matching orientation with ITK etc.
void Append(vtkSmartPointer< vtkPolyData > model)
Appends the model provided to the member into the current model.
void modelInfo()
Computes and prints the centroid, centroid size and covariance matrix to standard out...
int orientationView
view orientation standard
void GenerateVerticesAs2DGlyphs(const GlyphType glyphType)
Generate (only) vertices (as 2D glyphs like crosses etc.) for display from point data. Good for when only points in mesh.
void Threshold(const coordinateType belowVal, const coordinateType aboveVal, const coordinateType outsideVal)
Threshold the scalars on the mesh based on a levels provided.
void QuadricDecimate(const float reduceFactor)
Decimate the mesh (in terms of points) using the Quadric algorithm.
float colourBlue
Saved colour, used for refresh etc.
QAction * colourAct
Action for changing colours of a model.
QList< QAction * > actionsToAppend
Context actions to append.
QAction * contourNodePolyDataAct
Save contour surface nodes as polydata.
void WindowedSincSmoothing(const int iterations, const float passBand=0.1)
Smooth the mesh (in terms of points) using the Taubin (1995) optimal filter.
vtkSmartPointer< vtkDataArray > GetNormals()
Returns the normal vectors of the model.
QAction * cubeAxesAct
show cube axes action
bool saveScalarsOfModel(const QString filename, milxQtModel *data)
Saves the scalars of a model as a CSV or VTK Text file. The CSV format is output if the extension is ...
void Curvature(const bool meanCurvature=true)
Compute the curvature (using Laplace-Beltrami operator) of the mesh.
vtkSmartPointer< vtkDataArray > GetVectors()
Returns the active vectors of the model.
QAction * genRegionLabels
Action for labelling unconnected regions of mesh.
QAction * refreshAct
Action for refreshing the display.
void resetFlags()
Reset the flags for pointers and computations. Useful when the data changes and all previous results ...
QAction * contourInitAct
Load contour surface points from polydata.
bool scaleBefore
scale displayed?
void maskScalars(QString filename="")
Mask scalar values on the mesh using scalars on another mesh. Assumes point correspondence between me...
void SetInput(vtkSmartPointer< vtkPolyData > model)
Assigns the input model to class.
void gradient()
Compute the gradient of the scalar field on the model.
void enableActionBasedOnView()
Enables the view actions corresponding to current view set.
QMenu * contourMenu
Contour Menu.
void SetTransform(vtkSmartPointer< vtkTransform > transform)
Sets the transform for the model that will be generated. Must pass a vtkTransform objects...
void LaplacianSmoothing(const int iterations)
Smooth the mesh (in terms of points) using the Laplacian algorithm. It is unstable, use WindowedSincSmoothing() instead unless massive non-edge preserving smoothing is required.
void generateModel(float red=defaultColour, float green=defaultColour, float blue=defaultColour)
Generates the model so that its ready for display. It requires that data has been set or assigned alr...
QMenu * arraysMenu()
Return the arrays menu with the milxQtModel class ordering. This is for the benefit of derived class ...
bool cubeAxesBefore
scale displayed?
void changeColour(float red=-1, float green=-1, float blue=-1)
Changes the colour of the model if no scalars are present.
void SetPoints(vtkSmartPointer< vtkPoints > modelPoints)
Sets the points for the model to be generated. Must pass a vtkPoints objects, which is easy to use...
virtual void updateCoords(vtkObject *obj)
Picks the coordinates and pixel value from the current mouse position in the window.
void SetTransform(vtkSmartPointer< vtkAbstractTransform > newTransform)
Transforms the model by given transform.
void generateSampledPoints(float distance=0.0, float red=defaultColour, float green=defaultColour, float blue=defaultColour)
Generates points sampled "distance" apart on the model with glyphs at each point. ...
QAction * thresholdScalarsAct
Action for thresholding scalar values on model.
void smoothSinc(int iterations=0)
Smooth the model using the Windowed Sinc approach of Taubin et al. Iterations to smooth by is acquire...
virtual void updateLookupTable()
Sets the necessary LUTs to model view.
QAction * clusterDecimateAct
Action for Cluster decimating model.
QAction * resetAct
Action for refreshing the display.
void clusterDecimate()
Reduce the polygon count (decimate) the model using Quadric Clustering Decimation. The final result is the best simplification of the mesh, preserving topology.
QAction * flipAct
Action for flipping surface.
QMenu * colourMapMenu
Colour map menu.
bool computedCentroid
Computed centroid already?
QAction * genModelAct
Action for generating model.
void quadricDecimate(double factor=0.0)
Reduce the polygon count (decimate) the model using Quadric Decimation. The final result is the best ...
void generateRender()
Generate the render so it is ready for display. Should be called before showing the window...
virtual void disableScale()
Disables the scale bar display.
void linkProgressEventOf(vtkObject *obj)
Link the progress of filters etc to keep the UI responsive.
void triangulate()
Triangulate the model cells.
void LandmarkBasedRegistration(vtkSmartPointer< vtkPolyData > fixedMesh, const bool similarity=false)
Computes the landmark transform registration of the current mesh to the one provided. Requires point correspondence and same number of points.
void thresholdScalars(double lowValue=0.0, double upValue=0.0, double outsideVal=0.0)
Threshold scalar values on the mesh. Geometry and topology is unchanged.
vtkSmartPointer< vtkPolyData > GetOutput()
Returns the mesh data object (PolyData) used internally VTK style.
QMenu * arrayMenu
arrays Menu
void generateQuantisedPoints(float quantiseFactor=0.0)
Generates points that are snapped to a grid given by factor.
QAction * saveViewAct
Save camera view.
vtkSmartPointer< vtkDataArray > GetScalars()
Returns the scalars of the model currently held.
QAction * genVerticesAct
Action for generating vertices.
QAction * viewXY
Change view to xy-plane (Axial)
void reset()
Reset the display of the model, includes camera and regeneration.
void resetScalarRange()
Restores the scalar range of the model currently held to current max range for display.
static vnl_matrix< Type > CovarianceMatrix(vnl_vector< Type > sourceVector)
Compute the covariance matrix from a vector. EXPERIMENTAL.
void Clean()
Removes duplicate points etc. from model.
void curvature()
Compute the mean curvature of mesh and place the curvature as scalars on mesh.
void outlineDisplay()
Toggles the outline box display.
bool labelled
Labels generated?
void smooth(int iterations=0)
Smooth the model using the standard Laplacian approach. Iterations to smooth by is acquired by input ...
QAction * genPointModelAct
Action for generating labels.
void Gradient()
Compute the gradient (using Laplace-Beltrami operator) of the scalars on the mesh.
void flip(bool xAxis=false, bool yAxis=false, bool zAxis=false)
Flip model along any axis, useful for matching coordinate systems with ITK or flipping left to right...
void AddActor2D(vtkSmartPointer< vtkProp > actor)
Add a VTK actor to this window.
QAction * selectPointsAct
select points within contour
QMenu * transformMenu
Transform Menu.
void renameScalars(QString newName="")
Rename the scalars on the mesh.
QMenu * scalarMenu
Context Menu.
QAction * genSamplesAct
Action for generating sampled points on mesh.
vtkSmartPointer< vtkActor > outlineActor
Outline box actor.
void GetScalarRange(double *range)
Returns the scalar range of the model.
vtkSmartPointer< vtkPolyData > & PreviousResult()
Returns the previous model, i.e. the result of the penultimate operation.
bool rendered
Scene as been setup for rendering? (by generateRender())
void generateTensorField(double newScale=0.0, float red=defaultColour, float green=defaultColour, float blue=defaultColour)
Generates a tensor field model, i.e. ellipses at each point for the dataset. Arguments provided are f...
QList< QAction * > actionsToAdd
Context actions to add.
static Type CentroidSize(const vnl_matrix< Type > &data, const vnl_vector< Type > ¢roid, bool norm=false)
Compute the centroid size or scale for a series of points.
QAction * thresholdScalarsBinaryAct
Action for binary thresholding scalar values on model.
virtual ~milxQtModel()
The standard destructor.
vtkSmartPointer< vtkDataArray > GetVectors()
Returns the vectors of the model currently held.
void showArray(QAction *action)
Change scalars on model to one given by string or action.
void GenerateVectorField(const double newScale=0.0, const bool useNormals=false)
Generate vector field for vectors present (as an array) in the mesh at given scaling.
void transform(QString filename="", bool inverse=false)
Transform the model using a loaded affine transform file. File is asked for within this member...
void setupTooltips()
Assign tooltips to each action for users benefit. The tooltips explains the function of each action...
void SetScalars(vtkSmartPointer< vtkDataArray > modelScalars)
Sets the scalars for the model to be generated. Must pass a vtkDataArray or its derivatives (such as ...
virtual void copyToContextMenu(QMenu *copyMenu)
Copies the menu, by duplicating the entries, to the context menu. Connections are assumed to be made ...
void SetActiveScalars(std::string nameOfArray)
Sets the array of name as scalars for the model to be generated.
QAction * viewZX
Change view to zx-plane (Sagittal)
void imageAvailable(vtkImageData *, QString)
Send signal that an image is available for showing.
QMenu * operationsMenu()
Return the operations menu with the milxQtModel class ordering. This is for the benefit of derived cl...
void generateVerticesAs(const GlyphType glyphType=Circle, float red=defaultColour, float green=defaultColour, float blue=defaultColour)
Generates the vertices as 2D circles for the dataset. Arguments provided are for the colours of the v...
QMenu * showMenu
Camera Menu.
vtkSmartPointer< vtkPolyData > GetPolyDataInput()
Returns the original mesh data object (PolyData) used internally VTK style.
void generateVectorField(double newScale=0.0, float red=defaultColour, float green=defaultColour, float blue=defaultColour)
Generates a vector field model, i.e. arrows at each point for the dataset. Arguments provided are for...
void DistanceMap(vtkSmartPointer< vtkPoints > loopPoints)
Compute the distance map of the mesh points given a loop (as points) assumed to be on the mesh surfac...
void disableCubeAxes()
Disables the cube axes display.
vtkIdType GetNumberOfPoints()
Returns the total number of points of the model currently held.
QAction * genNormalsAct
Action for generating normals.
void done(int value)
Send signal that computation is done. Value carries the progress,.
vtkSmartPointer< vtkScalarBarActor > scale
Scale for the display.
QMenu * transformsMenu()
Return the transform menu with the milxQtModel class ordering. This is for the benefit of derived cla...
void setView(int viewMode)
Change view to view mode identified by number. 0-axial, 1-coronal, 2-sagittal.
QAction * genHedgehogAct
Action for generating Hedgehog fields.
QAction * thresholdAct
Action for thresholding model.
void background(bool white=false)
Changes background to white.
QAction * matchAct
Action for matching scale and centroids of two models.
void GenerateNormals(const int pointNormals=0)
Generate normal vectors for each point on the mesh. If pointNormals is (0,1,2), then normals are for ...
void generatePolyDataFromImage(vtkSmartPointer< vtkImageData > img)
Generates polygonal data from image data, i.e. the result is a surface.
QAction * outScalarsAct
Action for output of scalars.
void setDefaultView(int viewMode)
Change default view to view mode identified by number. 0-axial, 1-coronal, 2-sagittal.
void removeOverlays()
Removes all actors that are overlaid with the model.
void GeneratePointModel(const double newScale)
Generate spheres of scaling for each point of the mesh.
void Clip(const coordinateType belowValue, const coordinateType aboveValue)
Clip the mesh based on a scalar threshold of the mesh scalars.
void GenerateElevation(double x, double y, double z)
Generate scalar field for the mesh proportional to the elevation (dot product) with a given vector/di...
void IterativeClosestPointsRegistration(vtkSmartPointer< vtkPolyData > fixedMesh, const bool similarity=false, const int maxPoints=1024)
Computes the ICP registration of the current mesh to the one provided.
milx::Model model
Actual model and its operations (from SMILI)
virtual void selectPointsInContour()
Select model points inside contour and compute distance map.
void GenerateKMeansClustering(int numberOfClusters)
Generate k-means clustering for the point positions in the mesh.
void GenerateTubes()
Generate tubes along edges of the mesh.
void texture()
Emit texture of the model.
QMenu * generateMenu
Menu for generating viewing options.
void refresh()
Refresh the display of the model including widgets. Camera remains as is.
vtkSmartPointer< vtkDataArray > GetNormals()
Returns the normals of the model currently held.
QMenu * operateMenu
Operate Menu.
void GenerateQuantisedPoints(float quantiseFactor)
Generate points of the mesh to have integral cordinates.
QAction * interpAct
Action for changing the interpolation of a model.
void SetScalars(vtkSmartPointer< vtkDataArray > modelScalars)
Sets the scalar field of the mesh (values per vertex of the surface)
void Triangulate()
Ensures the polygons in the model are triangulated. Useful when some filters required triangulation b...
QAction * genDelaunayAct
Action for generating Delaunay graphs.
QActionGroup * displayGroup
Grouping for check boxes.
void printInfo(QString msg)
Info message wrapper for console.
void GaussianWeightScalars(float stddev, float clampValue)
Evaluate the Gaussian function with the given standard deviation for all values of the scalars on the...
bool useDefaultView
Using log scalar map?
QAction * rotateAct
Action for rotating surface.
void ClusterDecimate()
Decimate the mesh (in terms of points) using the Quadric Clustering algorithm.
void IsoSurface(vtkSmartPointer< vtkImageData > img, double minValue)
void generateElevation()
Generates scalars based on the elevation from the bounding box extremes of the mesh.
void working(int value)
Send signal that computation is in progress. Value carries the progress,.
vtkSmartPointer< vtkScalarBarWidget > scalarBar
Scalar Bar Widget for the display.
QMenu * windowPropertiesMenu
Context Menu.
vtkRenderer * GetRenderer()
Returns the VTK Renderer object.
QAction * doAct
Action for undoing and redoing actions.
virtual void background(bool white=false)
Changes background to white.
void Rotate(const bool xAxis, const bool yAxis, const bool zAxis, const float angle, const coordinate centre)
Rotate the mesh along the selected axes from the centre by angle.
vtkSmartPointer< vtkCubeAxesActor > cubeAxesActor
outline box
bool undidProcess
Undid a process?
QStatusBar * updateBar
Pointer to bar, not allocated or deleted. To be passed to only.
void normals(const bool turnOn=false)
Shows the point normals of the model.
QAction * genElevation
Action for elevation scalars of mesh.
QList< QMenu * > menusToAppend
Context Menu's to append.
virtual void viewToXYPlane()
Change view to xy-plane.
QAction * loadViewAct
Load camera view.
void toggleSpecular(bool quiet=false)
Toggles the specular or shininess of the mesh between Flat and Shiny. Default is Shiny.
void SetGraph(vtkSmartPointer< vtkMutableUndirectedGraph > graph)
Assigns the graph provided to the class, preparing for display. Call generateModel() and then show() ...
QAction * genPointIDsAct
Action for generating labels.
void removeModelActor(vtkSmartPointer< vtkActor > mdlActor)
Directly remove model actor from generic view.
vtkSmartPointer< vtkPointPicker > dataPicker
For determining coordinates and points from the window.
void threshold(double lowValue=0.0, double upValue=0.0)
Clip the mesh based on scalar values on the mesh.
QAction * transformAct
Action for transforming model.
void clean()
Clean the model of duplicate points by merging appropriately.
QAction * loadViewFileAct
Load camera view to file.
void generateHedgehog(double newScale=0.0, float red=defaultColour, float green=defaultColour, float blue=defaultColour)
Generates a hedgehog model, i.e. lines at each point for the dataset whose lengths are given by the v...