21 #include <QApplication> 22 #include <QMainWindow> 40 #include "milxQtFile.h" 41 #include "milxQtModel.h" 43 int main(
int argc,
char *argv[])
45 QApplication app(argc,argv);
46 QMainWindow mainWindow;
48 QPixmap icon(
":resources/smilx_icon.png");
49 app.setWindowIcon(QIcon(icon));
53 cerr <<
"milxModelViewer Application:" << endl;
54 cerr <<
"For quick and fast display of model/surface/polydata files." << endl;
55 cerr <<
"View configuration always matches sMILX settings wherever possible." << endl;
56 cerr <<
"Usage:" << endl;
57 cerr <<
"<Model Filename> " << endl;
61 std::string inputSurfaceFilename = argv[1];
66 bool success = reader->
openModel(inputSurfaceFilename.c_str(), model);
70 cerr <<
"Error opening model file." << endl;
77 QSize desktopSize = qApp->desktop()->availableGeometry().size();
78 int newWidth = 2.0*desktopSize.width()/3.0 + 0.5;
79 int newHeight = 4.0*desktopSize.height()/5.0 + 0.5;
80 int xOffset = (desktopSize.width()-newWidth)/2.0;
81 int yOffset = (desktopSize.height()-newHeight)/2.0;
82 mainWindow.resize( QSize(newWidth, newHeight) );
83 mainWindow.move( QPoint(xOffset, yOffset) );
86 QSettings settings(
"Shekhar Chandra",
"milxQt");
87 int defaultViewMode = 2;
88 int defaultOrientationTypeMode = 0;
89 model->
setView(settings.value(
"defaultView", defaultViewMode).toInt());
90 model->
setDefaultOrientation(settings.value(
"defaultOrientationType", defaultOrientationTypeMode).toInt());
93 QMenuBar *menuBar =
new QMenuBar(&mainWindow);
95 QMenu *menuFile = menuBar->addMenu(
"File");
97 QAction *actionExit = menuFile->addAction(
"Exit");
98 QObject::connect(actionExit, SIGNAL(activated()), &mainWindow, SLOT(close()));
99 mainWindow.setMenuBar(menuBar);
103 mainWindow.setWindowTitle(
"milxModelViewer");
104 mainWindow.setCentralWidget(model);
virtual void createMenu(QMenu *menu)
Create the menu for the data in this object. Used for context menu and file menus.
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 *...
This class represents the MILX Qt File I/O object using VTK/ITK/Qt.
This class represents the MILX Qt Model/Mesh Display object using VTK.
void setDefaultOrientation(int orientMode)
Change orientation mode to one of the supported standards. Default: Radiological. ...
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...
void setView(int viewMode)
Change view to view mode identified by number. 0-axial, 1-coronal, 2-sagittal.
virtual void colourMapToJet(double minRange=0.0, double maxRange=0.0)
Change the colour map to Jet.