19 #include <QApplication> 20 #include <QMainWindow> 22 #include "milxQtFile.h" 23 #include "milxQtImage.h" 25 int main(
int argc,
char *argv[])
27 QApplication app(argc,argv);
28 QMainWindow mainWindow;
30 QPixmap icon(
":resources/smilx_icon.png");
31 app.setWindowIcon(QIcon(icon));
35 cerr <<
"milxImageViewer Application:" << endl;
36 cerr <<
"For quick and fast display of image files." << endl;
37 cerr <<
"View configuration always matches sMILX settings wherever possible." << endl;
38 cerr <<
"Usage:" << endl;
39 cerr <<
"<Image Filename> " << endl;
43 std::string inputSurfaceFilename = argv[1];
48 bool success = reader->
openImage(inputSurfaceFilename.c_str(), image);
52 cerr <<
"Error opening image file." << endl;
59 QSize desktopSize = qApp->desktop()->availableGeometry().size();
60 int newWidth = 2.0*desktopSize.width()/3.0 + 0.5;
61 int newHeight = 4.0*desktopSize.height()/5.0 + 0.5;
62 int xOffset = (desktopSize.width()-newWidth)/2.0;
63 int yOffset = (desktopSize.height()-newHeight)/2.0;
64 mainWindow.resize( QSize(newWidth, newHeight) );
65 mainWindow.move( QPoint(xOffset, yOffset) );
68 QSettings settings(
"Shekhar Chandra",
"milxQt");
69 int defaultViewMode = 2;
70 int defaultOrientationTypeMode = 0;
71 image->
setView(settings.value(
"defaultView", defaultViewMode).toInt());
72 image->
setDefaultOrientation(settings.value(
"defaultOrientationType", defaultOrientationTypeMode).toInt());
75 QMenuBar *menuBar =
new QMenuBar(&mainWindow);
77 QMenu *menuFile = menuBar->addMenu(
"File");
79 QAction *actionExit = menuFile->addAction(
"Exit");
80 QObject::connect(actionExit, SIGNAL(activated()), &mainWindow, SLOT(close()));
81 mainWindow.setMenuBar(menuBar);
83 mainWindow.setWindowTitle(
"milxImageViewer");
84 mainWindow.setCentralWidget(image);
This class represents the MILX Qt Image Display object using VTK.
This class represents the MILX Qt File I/O object using VTK/ITK/Qt.
virtual void createMenu(QMenu *menu)
Create the menu for the data in this object. Used for context menu and file menus.
void setView(int viewMode)
Change view to view mode identified by number. 0-axial, 1-coronal, 2-sagittal.
void generateImage(const bool quietly=false)
Assigns the array data to the image and setups up the viewer.
bool openImage(const QString filename, vtkImageData *data)
Opens an image file, which is any of the following: JPEG, PNG, DICOM, TIFF, NIFTI, HDR etc.
void setDefaultOrientation(int orientMode)
Change orientation mode to one of the supported standards. Default: Radiological. ...