SMILX  1.01
milxQtImage.h
1 /*=========================================================================
2  The Software is copyright (c) Commonwealth Scientific and Industrial Research Organisation (CSIRO)
3  ABN 41 687 119 230.
4  All rights reserved.
5 
6  Licensed under the CSIRO BSD 3-Clause License
7  You may not use this file except in compliance with the License.
8  You may obtain a copy of the License in the file LICENSE.md or at
9 
10  https://stash.csiro.au/projects/SMILI/repos/smili/browse/license.txt
11 
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  See the License for the specific language governing permissions and
16  limitations under the License.
17 =========================================================================*/
18 #ifndef MILXQTIMAGE_H
19 #define MILXQTIMAGE_H
20 
21 #include <QStatusBar>
22 
23 //VTK Headers
24 #include <vtkSmartPointer.h>
25 #include <itkCommand.h>
26 #include <vtkImageData.h>
27 #include <vtkMatrix4x4.h>
28 #include <vtkImageAppend.h>
29 #include <vtkImagePermute.h>
30 #include <vtkImageAccumulate.h>
31 #include <vtkImageMapToWindowLevelColors.h>
32 #if(VTK_MAJOR_VERSION > 5)
33  #include <vtkResliceCursor.h>
34  #include <vtkResliceCursorActor.h>
35 #endif
36 //ITK Imaging
37 #include <itkRGBPixel.h>
38 #include <itkImage.h>
39 #include <itkVectorImage.h>
40 //VXL
41 #include <vnl/vnl_matrix.h>
42 
43 #include "milxQtRenderWindow.h"
44 #include "vtkImageViewer3.h" //smili vtk-ext
45 #include "milxImage.h"
46 
47 //Typedefs
48 typedef unsigned char charPixelType;
49 typedef itk::Image<charPixelType, milx::imgDimension> charImageType;
50 typedef int intPixelType;
51 typedef itk::Image<intPixelType, milx::imgDimension> intImageType;
52 typedef itk::RGBPixel<unsigned char> rgbPixelType;
53 typedef itk::Image<rgbPixelType, milx::imgDimension> rgbImageType;
54 typedef float floatPixelType;
55 typedef itk::Image<floatPixelType, milx::imgDimension> floatImageType;
56 typedef itk::VectorImage<floatPixelType, milx::imgDimension> vectorImageType;
57 
58 //Struct for image actors
60 {
61  vtkSmartPointer<vtkActor> modelActor; //image actor to display in model view
62  vtkSmartPointer<vtkActor> parentActor; //The parent actor it's connected to
63 };
64 
71 class itkEventQtObserver : public itk::Command
72 {
73 public:
74  itkNewMacro( itkEventQtObserver );
75 
76 public:
77 
78  void Execute(itk::Object *caller, const itk::EventObject & event)
79  {
80  Execute( (const itk::Object *)caller, event);
81  }
82 
83  void Execute(const itk::Object * object, const itk::EventObject & event)
84  {
85  qApp->processEvents(); //Update Qt event loop to keep application responsive
86  }
87 };
88 
119 {
120  Q_OBJECT
121 
122 public:
127  milxQtImage(QWidget *theParent = 0, bool contextSystem = true);
132  virtual ~milxQtImage();
133 
137  virtual inline const char * GetNameOfClass() const
138  {
139  return "milxQtImage";
140  }
141 
142  //Data Members
147  inline QString strippedNamePrefix()
148  {
149  return prefix + QFileInfo(name).fileName();
150  }
151 
156  inline void SetInput(vtkSmartPointer<vtkImageData> newImg)
157  {
158  setData(newImg);
159  }
167  inline void SetInput(charImageType::Pointer newImg, const bool flipY = true)
168  {
169  setData(newImg, flipY);
170  }
178  inline void SetInput(intImageType::Pointer newImg, const bool flipY = true)
179  {
180  setData(newImg, flipY);
181  }
189  inline void SetInput(rgbImageType::Pointer newImg, const bool flipY = true)
190  {
191  setData(newImg, flipY);
192  }
200  inline void SetInput(floatImageType::Pointer newImg, const bool flipY = true)
201  {
202  setData(newImg, flipY);
203  }
211  inline void SetInput(vectorImageType::Pointer newImg, const bool flipY = true)
212  {
213  setData(newImg, flipY);
214  }
221  void SetTransform(vtkSmartPointer<vtkTransform> transform);
222 
229  void setData(QPointer<milxQtImage> newImg, const bool forceDeepCopy = false);
234  void setData(vtkSmartPointer<vtkImageData> newImg);
242  void setData(charImageType::Pointer newImg, const bool flipY = true);
250  void setData(intImageType::Pointer newImg, const bool flipY = true);
258  void setData(rgbImageType::Pointer newImg, const bool flipY = true);
266  void setData(floatImageType::Pointer newImg, const bool flipY = true);
275  void setData(vectorImageType::Pointer newImg, const bool flipY = true, const bool deepCopy = false);
280  void setData(vnl_matrix<double> &newData);
285  void setData(const unsigned slice, vnl_matrix<double> &newData);
292  void setDisplayData(QPointer<milxQtImage> newImg);
297  inline void setSharedData(QPointer<milxQtImage> newImg)
298  { setDisplayData(newImg); }
308  void setDisplayData(charImageType::Pointer newImg, const bool flipY = true);
313  inline void setSharedData(charImageType::Pointer newImg, const bool flipY = true)
314  { setDisplayData(newImg, flipY); }
324  void setDisplayData(intImageType::Pointer newImg, const bool flipY = true);
329  inline void setSharedData(intImageType::Pointer newImg, const bool flipY = true)
330  { setDisplayData(newImg, flipY); }
340  void setDisplayData(rgbImageType::Pointer newImg, const bool flipY = true);
345  inline void setSharedData(rgbImageType::Pointer newImg, const bool flipY = true)
346  { setDisplayData(newImg, flipY); }
356  void setDisplayData(floatImageType::Pointer newImg, const bool flipY = true);
361  inline void setSharedData(floatImageType::Pointer newImg, const bool flipY = true)
362  { setDisplayData(newImg, flipY); }
372  void setDisplayData(vectorImageType::Pointer newImg, const bool flipY = true);
377  inline void setSharedData(vectorImageType::Pointer newImg, const bool flipY = true)
378  { setDisplayData(newImg, flipY); }
379 
384  inline vtkSmartPointer<vtkImageData> GetOutput()
385  {
386  return imageData;
387  }
392  inline charImageType::Pointer GetCharImage()
393  {
394  return imageChar;
395  }
400  inline intImageType::Pointer GetIntImage()
401  {
402  return imageInt;
403  }
408  inline rgbImageType::Pointer GetRGBImage()
409  {
410  return imageRGB;
411  }
416  inline floatImageType::Pointer GetFloatImage()
417  {
418  return imageFloat;
419  }
426  inline vectorImageType::Pointer GetVectorImage()
427  {
428  return imageVector;
429  }
430 #if VTK_MAJOR_VERSION <= 5
431 
435  inline vtkAlgorithmOutput* GetOutputPort()
436  { return imageData->GetProducerPort(); }
437 #endif
438 
442  inline vtkImageActor* GetImageActor()
443  {
444  return viewer->GetImageActor();
445  }
450 #if(VTK_MAJOR_VERSION > 5)
451  inline void SetCursor(vtkResliceCursor *newCursor)
452  {
453  viewer->SetCursor(newCursor);
454  }
455 #else
456  inline void SetCursor(vtkCursor3D *newCursor)
457  {
458  viewer->SetCursor(newCursor);
459  }
460 #endif
461 
465 #if(VTK_MAJOR_VERSION > 5)
466  inline vtkResliceCursor* GetCursor()
467  {
468  return viewer->GetCursor();
469  }
470 #else
471  inline vtkCursor3D* GetCursor()
472  {
473  return viewer->GetCursor();
474  }
475 #endif
476 
480 #if(VTK_MAJOR_VERSION > 5)
481  inline void SetCursorActor(vtkResliceCursorActor *newCursorActor)
482  {
483  viewer->SetCursorActor(newCursorActor);
484  }
485 #else
486  inline void SetCursorActor(vtkActor *newCursorActor)
487  {
488  viewer->SetCursorActor(newCursorActor);
489  }
490 #endif
491 
495  inline vtkProp3D* GetCursorActor()
496  {
497  return viewer->GetCursorActor();
498  }
503  inline int* GetDisplayExtent()
504  {
505  return GetImageActor()->GetDisplayExtent();
506  }
510  inline virtual vtkDataSet* GetDataSet()
511  {
512  return imageData;
513  }
517  inline virtual vtkRenderWindowInteractor* GetVTKInteractor()
518  {
519  return viewer->GetRenderWindow()->GetInteractor();
520  }
521 
522  //Flags
527  inline void set8BitImage()
528  {
529  eightbit = true;
530  rgb = false;
531  vectorised = false;
532  }
537  inline bool is8BitImage()
538  {
539  return eightbit;
540  }
545  inline void set32BitImage()
546  {
547  eightbit = false;
548  integer = true;
549  rgb = false;
550  vectorised = false;
551  }
556  inline bool is32BitImage()
557  {
558  return integer;
559  }
564  inline void setRGBImage()
565  {
566  eightbit = false;
567  rgb = true;
568  vectorised = false;
569  }
574  inline bool isRGBImage()
575  {
576  return rgb;
577  }
582  inline void setFloatingPointImage()
583  {
584  eightbit = false;
585  rgb = false;
586  vectorised = false;
587  }
592  inline bool isFloatingPointImage()
593  {
594  return (!eightbit && !rgb && !vectorised);
595  }
600  inline void setVectorImage()
601  {
602  eightbit = false;
603  rgb = false;
604  vectorised = true;
605  }
610  inline bool isVectorImage()
611  {
612  return vectorised;
613  }
618  inline bool isVTKImage()
619  {
620  return usingVTKImage;
621  }
622 
629  inline bool isDisplayFlipped()
630  {
631  return flipped;
632  }
637  inline bool isInterpolated()
638  {
639  if(viewer->GetImageActor()->GetInterpolate())
640  return true;
641  else
642  return false;
643  }
648  inline bool isOriented()
649  {
650  return orientAct->isChecked();
651  }
656  inline bool isCrosshair()
657  {
658  return cursorAct->isChecked();
659  }
660 
667  inline void setActualNumberOfDimensions(const size_t dims)
668  {
669  actualNumberOfDimensions = dims;
670  }
671  inline size_t getActualNumberOfDimensions()
672  {
673  return actualNumberOfDimensions;
674  }
675 
683  void trackView(milxQtImage *windowToTrack, ViewType viewTo);
684 
685  //VTK Filters
686  vtkSmartPointer<vtkImageData> butterWorthHighPass(vtkSmartPointer<vtkImageData> img);
687 
688 public slots:
689  void userEvent(QMouseEvent *event = NULL);
690  void userEvent(QKeyEvent *event);
691  void userEvent(QWheelEvent *event);
696  virtual void updateCoords(vtkObject *obj);
701  void updateSlice(vtkObject *obj);
706  void updateTrackedView(vtkObject *obj);
711  virtual void contour();
712 
717  void autoLevel(float percentile=0.99);
722  void setLevel(int level);
727  inline vtkImageMapToWindowLevelColors* GetWindowLevel()
728  {
729  return viewer->GetWindowLevel();
730  }
735  double GetIntensityWindow();
740  void SetIntensityWindow(double window);
745  double GetIntensityLevel();
750  void SetIntensityLevel(double level);
751 #if (ITK_REVIEW || ITK_VERSION_MAJOR > 3)
752 
756  void overlay(QString filename = "");
761  void overlayContour(QString filename = "");
766  void computeContour();
767 #endif // (ITK_REVIEW || ITK_VERSION_MAJOR > 3)
768 
772  void blend(QString filename = "", float opacity = -1.0);
777  void blend(milxQtImage *imageToMatch, float opacity = -1.0);
782  void volumeRendering();
787  void imageInformation();
792  void rescale();
797  void relabel();
802  void histogramEqualisation();
807  void gradientMagnitude();
812  void sobelEdges();
817  void cannyEdges();
822  void laplacian();
827  void normalize();
832  void invertIntensity();
837  void matchInfo(milxQtImage *imageToMatch);
842  void matchInfo(QString filename = "");
847  void matchHistogram(milxQtImage *imageToMatch);
852  void matchHistogram(QString filename = "");
857  void resample(QString filename = "");
864  void mask(QString filename = "");
869  void subsample(size_t xSampleFactor = 0, size_t ySampleFactor = 0, size_t zSampleFactor = 0);
876  void crop(QString filename = "");
881  void resampleLabel(QString filename = "");
888  void transform(QString filename = "", QString refImgFilename = "", bool inverse = false);
893  void checkerBoard(QString filename = "", int numberOfSquares = 0);
900  void checkerBoard(milxQtImage *img, int numberOfSquares = 0);
907  void distanceMap(bool signedDistance = true, bool inside = false);
912  void thresholdAbove(float value = 0, float level = 0);
917  void thresholdBelow(float value = 0, float level = 0);
922  void threshold(float value = 0, float blevel = 0, float alevel = 0);
927  void binaryThreshold(float value = 0, float blevel = 0, float alevel = 0);
932  void otsu(int bins = 0);
937  void otsuMultiple(int bins = 0, int labels = 0);
942  void flip(bool xAxis = false, bool yAxis = false, bool zAxis = false, bool aboutOrigin = true);
949  void surface(const float value = numeric_limits<float>::max());
956  void polyData();
961  void magnitude();
966  void component(int index = -1);
973  void pseudoImage();
980  void vectorField(int subsampleFactor = 0, float scaling = 0.0);
987  void streamLines();
992  void anisotropicDiffusion();
997  void gaussianSmooth();
1002  void bilateral();
1007  void median();
1012  void zeros(const unsigned long xSize, const unsigned long ySize, const unsigned long zSize, milxQtImage *refImage = NULL);
1017  void resize(double outputSpacing = 0.0);
1022  void resize(const unsigned long xSize, const unsigned long ySize, const unsigned long zSize, milxQtImage *refImage = NULL);
1027  void add(milxQtImage *img);
1032  void add(QString filename = "");
1037  void subtract(milxQtImage *img);
1042  void subtract(QString filename = "");
1047  void multiply(milxQtImage *img);
1052  void multiply(QString filename = "");
1057  void scale(float scaling);
1062  void convolve(milxQtImage *img);
1063 
1064  //VTK Filters
1071  void highpass();
1072 
1073  //Display
1080  void interpolateDisplay(const bool quietly = false);
1081  inline void disableInterpolateDisplay()
1082  { viewer->GetImageActor()->InterpolateOn(); interpolateDisplay(); }
1083  inline void enableInterpolateDisplay()
1084  { viewer->GetImageActor()->InterpolateOff(); interpolateDisplay(); }
1092  void applyOrientDisplay(const bool quietly = false);
1093  inline void disableApplyOrientDisplay()
1094  { orientAct->setChecked(false); applyOrientDisplay(); }
1095  inline void enableApplyOrientDisplay()
1096  { orientAct->setChecked(true); applyOrientDisplay(); }
1104  void setDefaultOrientation(int orientMode);
1111  virtual void enableScale(QString title = "", const bool quiet = false, double minRange = 0.0, double maxRange = 0.0, int noOfLabels = 3);
1118  virtual void scaleDisplay(const bool forceDisplay = false);
1123  virtual void showCrosshair(const bool quietly = false);
1128  virtual inline void enableCrosshair()
1129  {
1130  if(viewerSetup)
1131  {
1132  viewer->EnableCursor();
1133  cursorAct->setChecked(true);
1134  }
1135  }
1140  virtual inline void disableCrosshair()
1141  {
1142  viewer->DisableCursor();
1143  cursorAct->setChecked(false);
1144  }
1149  virtual inline void enableCrosshairPointer()
1150  {
1151  if(rendered)
1152  {
1153  viewer->GetRenderWindow()->SetCurrentCursor(VTK_CURSOR_CROSSHAIR);
1154  crosshairAct->setChecked(true);
1155  }
1156  }
1161  virtual inline void disableCrosshairPointer()
1162  {
1163  viewer->GetRenderWindow()->SetCurrentCursor(0);
1164  crosshairAct->setChecked(false);
1165  }
1166 #if VTK_MAJOR_VERSION > 5
1167 
1171  virtual void resliceMode(const bool quietly = false);
1176  virtual inline void enableResliceMode()
1177  {
1178  printDebug("Oblique slicing enabled. Use Shift + Left Mouse.");
1179  viewer->GetInteractorStyle()-> SetInteractionModeToImage3D();
1180  resliceAct->setChecked(true);
1181  }
1186  virtual inline void disableResliceMode()
1187  {
1188  viewer->GetInteractorStyle()->SetInteractionModeToImageSlicing();
1189  resliceAct->setChecked(false);
1190  }
1191 #endif
1192 
1197  void setView(int viewMode);
1202  virtual void viewToXYPlane();
1207  virtual void viewToZXPlane();
1212  virtual void viewToZYPlane();
1217  inline void setCrosshairPosition(double *position)
1218  {
1219  viewer->SetCursorFocalPoint(position);
1220  viewer->UpdateCursor();
1221  }
1226  inline double* getCrosshairPosition()
1227  { return viewer->GetCursorFocalPoint(); }
1232  virtual void updateLookupTable();
1237  void histogram(int bins = 256, float belowValue = 0, float aboveValue = 255, bool plotHistogram = true);
1242  void surfacePlot();
1249  void setSlice(int slice);
1254  inline int getSlice()
1255  {
1256  return viewer->GetSlice();
1257  }
1262  inline double getIntensityWindow()
1263  {
1264  return viewer->GetWindowLevel()->GetWindow();
1265  }
1270  inline double getIntensityLevel()
1271  {
1272  return viewer->GetWindowLevel()->GetLevel();
1273  }
1278  inline void setIntensityWindow(double window)
1279  {
1280  viewer->GetWindowLevel()->SetWindow(window);
1281  }
1286  inline void setIntensityLevel(double level)
1287  {
1288  viewer->GetWindowLevel()->SetLevel(level);
1289  }
1294  void refresh();
1299  void reset();
1300 
1305  virtual void createMenu(QMenu *menu);
1306 
1313  void generateImage(const bool quietly = false);
1318  void generateVoxelisedSurface(vtkSmartPointer<vtkPolyData> surfaceToVoxelise, double *bounds = NULL, double *spacing = NULL);
1319 
1320  //Custom
1327  virtual void customOperation();
1328  void updateModelActor(vtkObject * obj, unsigned long, void * client_data, void *, vtkCommand * command);
1329  void updateDisplay(QPointer<milxQtImage> img);
1330 
1331 signals:
1336  void imageToSurface(vtkSmartPointer<vtkImageData>, const float );
1341  void imageToPolyData(vtkSmartPointer<vtkImageData> );
1346  void imageToPseudoImage(vectorImageType::Pointer );
1351  void imageToVectorField(vectorImageType::Pointer, floatImageType::Pointer, int, float);
1356  void imageToTensorField(vectorImageType::Pointer, floatImageType::Pointer, int, float );
1361  void imageToStreamLines(vectorImageType::Pointer, floatImageType::Pointer );
1366  void imageToVolume(vtkSmartPointer<vtkImageData> , bool);
1371  void imageToPlot(vtkSmartPointer<vtkImageData>, int);
1376  void modified(QPointer<milxQtImage> );
1381  void coordinateChanged(int, int, int);
1382 
1383 protected:
1384  //Flags
1386  bool imported;
1388  bool eightbit;
1389  bool integer;
1390  bool rgb;
1391  bool vectorised;
1393  bool volume;
1394  bool flipped;
1395  bool track;
1396 
1397  //Image Related
1398  //ITK
1399  charImageType::Pointer imageChar;
1400  intImageType::Pointer imageInt;
1401  rgbImageType::Pointer imageRGB;
1402  floatImageType::Pointer imageFloat;
1403  vectorImageType::Pointer imageVector;
1404 
1406  ViewType viewToTrack;
1407 
1408  //VTK
1409  vtkSmartPointer<vtkImageViewer3> viewer;
1410  vtkSmartPointer<vtkImageData> imageData;
1411  vtkSmartPointer<vtkImageAppend> imageDataAppended;
1412  vtkSmartPointer<vtkImagePermute> permute;
1413  vtkSmartPointer<vtkImageAccumulate> hist;
1414  QList<ModelActorItem> modelActors;
1415 
1416  itkEventQtObserver::Pointer observeProgress;
1417 
1419  double meanValue;
1420  double stddevValue;
1421  double minValue;
1422  double maxValue;
1423 
1424  //Context Menu
1425  //menu defined in milxQtWindow
1426  //------------------
1427  QMenu* operateMenu;
1428  QAction* rescaleAct;
1429  QAction* equaliseAct;
1431  QAction* smoothAct;
1432  QAction* gaussianAct;
1433  QAction* bilateralAct;
1434  QAction* medianAct;
1435  QAction* gradMagAct;
1436  QAction* sobelAct;
1437  QAction* cannyAct;
1438  QAction* laplacianAct;
1439  QAction* highPassAct;
1440  QAction* normAct;
1441  QAction* invertAct;
1442  QAction* relabelAct;
1443  //------------------
1444  QMenu* transformMenu;
1445  QAction* matchAct;
1446  QAction* matchHistAct;
1448  QAction* resampleAct;
1449  QAction* resampleLabelAct;
1450  QAction* subsampleAct;
1451  QAction* transformAct;
1452  QAction* maskAct;
1453  QAction* cropAct;
1454  QAction* checkerAct;
1455  QAction* distMapAct;
1456  QAction* flipAct;
1457  QAction* surfaceAct;
1458  QAction* polyDataAct;
1459  //------------------
1460  QMenu* thresholdMenu;
1461  QAction* otsuAct;
1462  QAction* otsuMultipleAct;
1463  QAction* binaryAct;
1464  QAction* bandAct;
1465  QAction* aboveAct;
1466  QAction* belowAct;
1467  //------------------
1468  QMenu* vectorMenu;
1471  QAction* pseudoImageAct;
1472  QAction* vectorFieldAct;
1473  QAction* streamLinesAct;
1474  //------------------
1475  QAction* levelAct;
1476  QAction* overlayAct;
1478  QAction* blendAct;
1479  QAction* volRenderAct;
1480  QAction* histogramAct;
1481  QAction* surfacePlotAct;
1482  QAction* infoAct;
1483  QAction* interpolateAct;
1484  QAction* orientAct;
1485  QAction* resliceAct;
1486  QAction* cursorAct;
1487 
1492  void updateData(const bool orient = true);
1499  void setupEvents();
1500  //Internal Members
1505  void createActions();
1510  void createConnections();
1515  void contextMenuEvent(QContextMenuEvent *event);
1520  QMenu* basicContextMenu();
1525  QMenu* operationsMenu();
1530  QMenu* thresholdsMenu();
1535  QMenu* transformsMenu();
1540  QMenu* vectorsMenu();
1545  void dropEvent(QDropEvent *event);
1546 
1551  virtual void SetupWidgets(vtkRenderWindowInteractor *interactor);
1556  inline void updateViewer(vtkObject * obj, unsigned long, void * client_data, void *, vtkCommand * command)
1557  {
1558  #if VTK_MAJOR_VERSION <= 5
1559  viewer->SetInput(imageData);
1560  #else
1561  viewer->SetInputData(imageData);
1562  #endif
1563  }
1568  QString getOpenFilename(const QString labelForDialog = "Select Image", QString exts = "");
1569 
1570 private:
1571 
1572 };
1573 
1574 #endif // MILXQTIMAGE_H
void setSharedData(rgbImageType::Pointer newImg, const bool flipY=true)
Shares the ITK image data to image (same as setDisplayData()). You will need to call generate image a...
Definition: milxQtImage.h:345
QAction * blendAct
Action for blending images.
Definition: milxQtImage.h:1478
QAction * matchAct
Action for matching info of image to another image.
Definition: milxQtImage.h:1445
vtkSmartPointer< vtkImageData > imageData
Points to the current VTK Image Data, Smart Pointer.
Definition: milxQtImage.h:1410
bool isFloatingPointImage()
Returns true if image is a floating point (float) image.
Definition: milxQtImage.h:592
QAction * overlayAct
Action for overlaying labelled image.
Definition: milxQtImage.h:1476
QAction * orientAct
Orient image?
Definition: milxQtImage.h:1484
void setCrosshairPosition(double *position)
Set the position of the Crosshair.
Definition: milxQtImage.h:1217
QAction * histogramAct
Action for displaying histogram.
Definition: milxQtImage.h:1480
bool eightbit
Using eightbit data?
Definition: milxQtImage.h:1388
QAction * cropAct
Action for auto cropping image.
Definition: milxQtImage.h:1453
void setIntensityWindow(double window)
Get or set the window/level for the image intensity tranfert function.
Definition: milxQtImage.h:1278
itkEventQtObserver::Pointer observeProgress
Observer for the Qt event loop.
Definition: milxQtImage.h:1416
void SetInput(floatImageType::Pointer newImg, const bool flipY=true)
ITK interface function: Assigns the image data internally. Same as setData() function.
Definition: milxQtImage.h:200
virtual vtkRenderWindowInteractor * GetVTKInteractor()
Get the interactor associated with the view rendering.
Definition: milxQtImage.h:517
void setSharedData(vectorImageType::Pointer newImg, const bool flipY=true)
Shares the ITK image data to image (same as setDisplayData()). You will need to call generate image a...
Definition: milxQtImage.h:377
QAction * relabelAct
Action for relabelling image.
Definition: milxQtImage.h:1442
This class represents the MILX Qt Render Window Display object using QVTK.
QAction * cannyAct
Action for canny edges of image.
Definition: milxQtImage.h:1437
void SetInput(charImageType::Pointer newImg, const bool flipY=true)
ITK interface function: Assigns the image data internally. Same as setData() function.
Definition: milxQtImage.h:167
vtkSmartPointer< vtkImageViewer3 > viewer
VTK Viewer handler, Smart Pointer.
Definition: milxQtImage.h:1409
vtkSmartPointer< vtkImagePermute > permute
Permute axis class, Smart Pointer.
Definition: milxQtImage.h:1412
QAction * otsuMultipleAct
Otsu Threshold.
Definition: milxQtImage.h:1462
void setSharedData(floatImageType::Pointer newImg, const bool flipY=true)
Shares the ITK image data to image (same as setDisplayData()). You will need to call generate image a...
Definition: milxQtImage.h:361
This class represents the MILX Qt Image Display object using VTK.
Definition: milxQtImage.h:118
vtkProp3D * GetCursorActor()
Set the internal cursor used for display.
Definition: milxQtImage.h:495
QAction * pseudoImageAct
Action for displaying vector/tensor fields as a pseudo image.
Definition: milxQtImage.h:1471
QAction * vectorMagnitudeAct
Action for displaying magnitude of vector images.
Definition: milxQtImage.h:1469
floatImageType::Pointer imageFloat
Up to date floating point image data.
Definition: milxQtImage.h:1402
virtual void disableCrosshair()
removes the cursor/crosshair.
Definition: milxQtImage.h:1140
QAction * cursorAct
Show cursor?
Definition: milxQtImage.h:1486
void updateViewer(vtkObject *obj, unsigned long, void *client_data, void *, vtkCommand *command)
Update the viewer image data to reflect changes.
Definition: milxQtImage.h:1556
void setSharedData(charImageType::Pointer newImg, const bool flipY=true)
Shares the ITK image data to image (same as setDisplayData()). You will need to call generate image a...
Definition: milxQtImage.h:313
QAction * flipAct
Action for flipping image.
Definition: milxQtImage.h:1456
QAction * distMapAct
Action for distance map of image.
Definition: milxQtImage.h:1455
bool rgb
Using RGB data?
Definition: milxQtImage.h:1390
vtkSmartPointer< vtkImageAccumulate > hist
Histogram filter, allocated on histogram() call.
Definition: milxQtImage.h:1413
QAction * surfacePlotAct
Action for displaying surface plot.
Definition: milxQtImage.h:1481
QAction * resliceAct
Reslice mode?
Definition: milxQtImage.h:1485
QAction * laplacianAct
Action for Laplacian of image.
Definition: milxQtImage.h:1438
bool isVTKImage()
Returns true if image is a VTK-type image.
Definition: milxQtImage.h:618
vtkImageActor * GetImageActor()
Returns the internal image actor used for display.
Definition: milxQtImage.h:442
double stddevValue
Std deviation data value currently held.
Definition: milxQtImage.h:1420
void setFloatingPointImage()
Sets image is a floating point (float) image. Relevant only for when creating images, otherwise automatically set.
Definition: milxQtImage.h:582
void setActualNumberOfDimensions(const size_t dims)
Sets the actual number of dimensions of the image.
Definition: milxQtImage.h:667
QAction * belowAct
Threshold from below.
Definition: milxQtImage.h:1466
QAction * bandAct
Threshold inbetween band.
Definition: milxQtImage.h:1464
QAction * streamLinesAct
Action for displaying stream lines.
Definition: milxQtImage.h:1473
QAction * otsuAct
Otsu Threshold.
Definition: milxQtImage.h:1461
bool track
track the coordinates during user interaction
Definition: milxQtImage.h:1395
QAction * volRenderAct
Action for volume rendering.
Definition: milxQtImage.h:1479
vectorImageType::Pointer GetVectorImage()
Returns the internal vector image data. Unlike the other Get*Image() members, the return value can be...
Definition: milxQtImage.h:426
QAction * matchHistAct
Action for matching histogram of image.
Definition: milxQtImage.h:1446
bool is32BitImage()
Returns true if image is an 32-bit (int) image.
Definition: milxQtImage.h:556
bool appendedData
Appended image data?
Definition: milxQtImage.h:1387
void SetCursorActor(vtkActor *newCursorActor)
Set the internal cursor actor used for display.
Definition: milxQtImage.h:486
QAction * infoAct
Action for displaying information about the image.
Definition: milxQtImage.h:1482
QMenu * vectorMenu
Vector Menu.
Definition: milxQtImage.h:1468
QAction * checkerAct
Action for checkerboard of image.
Definition: milxQtImage.h:1454
QMenu * transformMenu
Transform Menu.
Definition: milxQtImage.h:1444
bool imported
Imported before?
Definition: milxQtImage.h:1386
virtual vtkDataSet * GetDataSet()
Get the data, return the vtkImageData object downcast to vtkDataSet, useful for getting scalar range ...
Definition: milxQtImage.h:510
QAction * aboveAct
Threshold from above.
Definition: milxQtImage.h:1465
rgbImageType::Pointer GetRGBImage()
Returns the internal RGB image data.
Definition: milxQtImage.h:408
vtkImageMapToWindowLevelColors * GetWindowLevel()
Returns the internal image window levels data used for display.
Definition: milxQtImage.h:727
QMenu * thresholdMenu
Threshold Menu.
Definition: milxQtImage.h:1460
int getSlice()
Gets the current slice of the volume.
Definition: milxQtImage.h:1254
virtual void enableCrosshair()
Enables the cursor/crosshair for marking. Image must be generated before calling. ...
Definition: milxQtImage.h:1128
#define MILXQT_EXPORT
Define Windows DLL importing.
Definition: milxQtAliases.h:80
QAction * transformAct
Action for transforming image.
Definition: milxQtImage.h:1451
QAction * levelAct
Action for auto-levelling gamma for display.
Definition: milxQtImage.h:1475
QAction * normAct
Action for normalization of image.
Definition: milxQtImage.h:1440
bool isOriented()
Returns true if orientation is applied to the display of the image.
Definition: milxQtImage.h:648
QAction * binaryAct
Binary Threshold.
Definition: milxQtImage.h:1463
void SetInput(intImageType::Pointer newImg, const bool flipY=true)
ITK interface function: Assigns the image data internally. Same as setData() function.
Definition: milxQtImage.h:178
bool viewerSetup
has the viewer/window been setup (only done initial so is to not disturb users settings) ...
Definition: milxQtImage.h:1392
bool isCrosshair()
Returns true if cursor shown to the display of the image.
Definition: milxQtImage.h:656
QAction * equaliseAct
Action for contouring image.
Definition: milxQtImage.h:1429
QAction * sobelAct
Action for sobel edges of image.
Definition: milxQtImage.h:1436
double meanValue
Other Variables.
Definition: milxQtImage.h:1419
bool integer
Using integer data?
Definition: milxQtImage.h:1389
QAction * overlayContourAct
Action for overlaying labelled image as contour.
Definition: milxQtImage.h:1477
QAction * interpolateAct
Interpolate image?
Definition: milxQtImage.h:1483
QAction * resampleAct
Action for resampling image.
Definition: milxQtImage.h:1448
QAction * highPassAct
Action for high pass filtering of image.
Definition: milxQtImage.h:1439
double minValue
min value in image
Definition: milxQtImage.h:1421
QAction * gradMagAct
Action for gradient magnitude of image.
Definition: milxQtImage.h:1435
double getIntensityLevel()
Get or set the window/level for the image intensity tranfert function.
Definition: milxQtImage.h:1270
QList< ModelActorItem > modelActors
Model actors being displayed in image view.
Definition: milxQtImage.h:1414
vtkAlgorithmOutput * GetOutputPort()
Returns the image data object (ImageData) producer port used internally VTK style.
Definition: milxQtImage.h:435
void set8BitImage()
Sets image as an 8-bit (unsigned char) image. Relevant only for when creating images, otherwise automatically set.
Definition: milxQtImage.h:527
charImageType::Pointer imageChar
Up to date 8-bit greyscale image data.
Definition: milxQtImage.h:1399
void SetInput(vtkSmartPointer< vtkImageData > newImg)
VTK interface function: Assigns the image data internally. Same as setData() function.
Definition: milxQtImage.h:156
QAction * gaussianAct
Action for Gaussian smoothing of image.
Definition: milxQtImage.h:1432
bool isVectorImage()
Returns true if image is a vector image.
Definition: milxQtImage.h:610
QAction * subsampleAct
Action for downsampling image.
Definition: milxQtImage.h:1450
QAction * rescaleAct
Action for contouring image.
Definition: milxQtImage.h:1428
bool usingVTKImage
using VTK image data?
Definition: milxQtImage.h:1385
double * getCrosshairPosition()
Get the position of the Crosshair.
Definition: milxQtImage.h:1226
bool isDisplayFlipped()
Returns true if image was flipped internally for display purposes only.
Definition: milxQtImage.h:629
void set32BitImage()
Sets image as an 32-bit (int) image. Relevant only for when creating images, otherwise automatically ...
Definition: milxQtImage.h:545
double maxValue
max value in image
Definition: milxQtImage.h:1422
bool vectorised
Using Vector image data?
Definition: milxQtImage.h:1391
QAction * vectorFieldAct
Action for displaying vector/tensor fields.
Definition: milxQtImage.h:1472
QAction * resampleSpacingAct
Action for resampling image based on spacing.
Definition: milxQtImage.h:1447
void setSharedData(intImageType::Pointer newImg, const bool flipY=true)
Shares the ITK image data to image (same as setDisplayData()). You will need to call generate image a...
Definition: milxQtImage.h:329
vtkSmartPointer< vtkImageData > GetOutput()
Returns the image data object (ImageData) used internally VTK style.
Definition: milxQtImage.h:384
QString strippedNamePrefix()
Returns the stripped (path removed) name of the data with "Image" prefix.
Definition: milxQtImage.h:147
QAction * invertAct
Action for invert intensity of image.
Definition: milxQtImage.h:1441
vtkSmartPointer< vtkImageAppend > imageDataAppended
Appended Data.
Definition: milxQtImage.h:1411
virtual const char * GetNameOfClass() const
ITK interfacing member for exceptions.
Definition: milxQtImage.h:137
This class can be attached as an observer to trigger Qt to update the event loop. ...
Definition: milxQtImage.h:71
void setSharedData(QPointer< milxQtImage > newImg)
Shares the ITK image data to image (same as setDisplayData()). You will need to call generate image a...
Definition: milxQtImage.h:297
bool flipped
Flip for display?
Definition: milxQtImage.h:1394
charImageType::Pointer GetCharImage()
Returns the internal unsigned char image data.
Definition: milxQtImage.h:392
void SetInput(rgbImageType::Pointer newImg, const bool flipY=true)
ITK interface function: Assigns the image data internally. Same as setData() function.
Definition: milxQtImage.h:189
double getIntensityWindow()
Get or set the window/level for the image intensity tranfert function.
Definition: milxQtImage.h:1262
QAction * medianAct
Action for median smoothing of image.
Definition: milxQtImage.h:1434
size_t actualNumberOfDimensions
All images loaded as 3D images or 3D vector images, this shows actual dimension.
Definition: milxQtImage.h:1405
virtual void enableCrosshairPointer()
Enables the mouse pointer as a crosshair instead. Scene must be rendered before calling.
Definition: milxQtImage.h:1149
floatImageType::Pointer GetFloatImage()
Returns the internal float image data.
Definition: milxQtImage.h:416
QAction * computeContourAct
Action for contouring image.
Definition: milxQtImage.h:1430
void SetInput(vectorImageType::Pointer newImg, const bool flipY=true)
ITK interface function: Assigns the image data internally. Same as setData() function.
Definition: milxQtImage.h:211
QAction * maskAct
Action for resampling image.
Definition: milxQtImage.h:1452
bool isRGBImage()
Returns true if image is an RGB (3-vector unsigned char image) image.
Definition: milxQtImage.h:574
QAction * polyDataAct
Action for image to poly data.
Definition: milxQtImage.h:1458
void setRGBImage()
Sets image as an RGB (3-vector unsigned char image) image. Relevant only for when creating images...
Definition: milxQtImage.h:564
int * GetDisplayExtent()
Returns the current display extent of the image data, i.e the current slice dimensions/extents.
Definition: milxQtImage.h:503
vectorImageType::Pointer imageVector
Up to date vector image data.
Definition: milxQtImage.h:1403
intImageType::Pointer imageInt
Up to date 32-bit greyscale image data.
Definition: milxQtImage.h:1400
bool is8BitImage()
Returns true if image is an 8-bit (unsigned char) image.
Definition: milxQtImage.h:537
virtual void disableCrosshairPointer()
Restores the mouse pointer to default.
Definition: milxQtImage.h:1161
QAction * smoothAct
Action for smoothing of image.
Definition: milxQtImage.h:1431
void setVectorImage()
Sets image as a vector image. Relevant only for when creating images, otherwise automatically set...
Definition: milxQtImage.h:600
bool volume
is the image a volume?
Definition: milxQtImage.h:1393
QAction * resampleLabelAct
Action for resampling image.
Definition: milxQtImage.h:1449
intImageType::Pointer GetIntImage()
Returns the internal unsigned char image data.
Definition: milxQtImage.h:400
QAction * surfaceAct
Action for image to surface.
Definition: milxQtImage.h:1457
QAction * vectorComponentAct
Action for displaying components of vector images.
Definition: milxQtImage.h:1470
ViewType viewToTrack
In tracking mode, what slice to show.
Definition: milxQtImage.h:1406
QAction * bilateralAct
Action for bilateral smoothing of image.
Definition: milxQtImage.h:1433
QMenu * operateMenu
Operate Menu.
Definition: milxQtImage.h:1427
void setIntensityLevel(double level)
Get or set the window/level for the image intensity tranfert function.
Definition: milxQtImage.h:1286
bool isInterpolated()
Returns true if image display is interpolated.
Definition: milxQtImage.h:637
rgbImageType::Pointer imageRGB
Up to date 32-bit image data (used only internally atm)
Definition: milxQtImage.h:1401