GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
QGoTabImageView3DwT.cxx
Go to the documentation of this file.
1 /*=========================================================================
2  Authors: The GoFigure Dev. Team.
3  at Megason Lab, Systems biology, Harvard Medical school, 2009-11
4 
5  Copyright (c) 2009-11, President and Fellows of Harvard College.
6  All rights reserved.
7 
8  Redistribution and use in source and binary forms, with or without
9  modification, are permitted provided that the following conditions are met:
10 
11  Redistributions of source code must retain the above copyright notice,
12  this list of conditions and the following disclaimer.
13  Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16  Neither the name of the President and Fellows of Harvard College
17  nor the names of its contributors may be used to endorse or promote
18  products derived from this software without specific prior written
19  permission.
20 
21  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
25  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
27  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
30  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 
33 =========================================================================*/
34 
35 #include "QGoTabImageView3DwT.h"
36 #include "QShortcut"
37 #include "QDebug"
38 #include "QShortcut"
39 
40 #include "QGoImageView3D.h"
41 //#include "QGoLUTDialog.h"
44 
45 #if defined ( ENABLEFFMPEG ) || defined ( ENABLEAVI )
46 
47 #include "QGoVideoRecorder.h"
48 
49 #endif /* ENABLEVIDEORECORD */
50 
51 #include "SnapshotHelper.h"
52 
53 #include "GoDBContourRow.h"
54 #include "GoDBCoordinateRow.h"
55 #include "GoDBMeshRow.h"
56 
57 #include "vtkLSMReader.h"
58 
59 #include "vtkImageData.h"
60 #include "vtkActor.h"
61 #include "vtkLookupTable.h"
62 #include "vtkImageAppendComponents.h"
63 #include "vtkOrientedGlyphContourRepresentation.h"
64 #include "vtkContourWidget.h"
65 #include "vtkProperty.h"
66 #include "vtkPolyData.h"
67 #include "vtkImageActorPointPlacer.h"
69 #include "ConvertToStringHelper.h"
70 
71 #include "vtkViewImage2D.h"
72 #include "vtkCellArray.h"
73 #include "vtkMath.h"
74 #include "vtkPolyData.h"
75 
76 #include "vtkPolyDataMapper.h"
77 #include "vtkOutlineFilter.h"
78 
79 //VTK FILTERS
80 #include "vtkImageExport.h"
81 
82 //ITK FILTERS
84 #include "ContourToMeshFilter.h"
85 
86 #include "GoFigureMeshAttributes.h"
87 
88 #include <QCursor>
89 
90 #include <QLabel>
91 #include <QSpinBox>
92 #include <QVBoxLayout>
93 #include <QColorDialog>
94 #include <QInputDialog>
95 #include <QProgressDialog>
96 
97 #include "vtkBox.h"
98 #include "vtkClipPolyData.h"
99 
100 #include <set>
101 
102 // base segmentation dock widgets
105 
106 // track dockwidget
107 #include "QGoTrackViewDockWidget.h"
108 
109 // lineage dockwidget
111 
112 // lineage viwer
113 #include "QGoLineageViewerWidget.h"
114 
115 // image processors
116 #include "GoMegaImageProcessor.h"
117 #include "GoLSMImageProcessor.h"
118 
119 // transfer function editor
121 
122 //-------------------------------------------------------------------------
124  QGoTabElementBase(iParent),
125  m_ImageProcessor(NULL),
126  m_BackgroundColor(Qt::black),
127  m_TraceSettingsToolBar(NULL),
128  m_IntersectionLineWidth(2.),
129  m_PCoord(0),
130  m_RCoord(0),
131  m_CCoord(0),
132  m_XTileCoord(0),
133  m_YTileCoord(0),
134  m_ZTileCoord(0),
135  m_TCoord(-1),
136  m_MeshEditingWidget(NULL),
137  m_Seeds( 3 )
138 {
139  m_Seeds[0] = vtkPoints::New();
140  m_Seeds[1] = vtkPoints::New();
141  m_Seeds[2] = vtkPoints::New();
142 
143  m_VolumeRenderingEnabled = false;
144 
145  m_HighlightedContoursProperty = vtkProperty::New();
146  m_HighlightedContoursProperty->SetColor(1., 0., 0.);
147  m_HighlightedContoursProperty->SetOpacity(1.);
148  m_HighlightedContoursProperty->SetLineWidth(3.);
149 
150  m_HighlightedMeshesProperty = vtkProperty::New();
151  m_HighlightedMeshesProperty->SetColor(1., 0., 0.);
152  m_HighlightedMeshesProperty->SetOpacity(1.);
153  m_HighlightedMeshesProperty->SetSpecular(0.6);
154  m_HighlightedMeshesProperty->SetLineWidth(3.);
155  m_HighlightedMeshesProperty->SetInterpolationToPhong();
156 
158 
159  setupUi(this);
160 
161  m_MegaCaptureReader = itk::MegaCaptureReader::New();
162 
166 
167  m_MeshContainer = new MeshContainer(this, this->m_ImageView);
170 
171  m_TrackContainer = new TrackContainer(this, this->m_ImageView);
174 
176 
178 
179  // create TF dockwidget
182 
183  // track dock widget
185  this->m_TrackViewDockWidget->setObjectName("TrackViewDockWidget");
186 
188  SIGNAL( ChangeColorCode(const QString&) ),
190  SLOT( ChangeColorCode(const QString&) ) );
191 
193  SIGNAL( UpdateTracksRepresentation(const double&, const double&, const double&) ),
195  SLOT( UpdateTracksRepresentation(const double&, const double&, const double&) ) );
196 
197  // lineage dock widget
199  this->m_LineageViewDockWidget->setObjectName("LineageViewDockWidget");
200 
202  SIGNAL( ChangeDivisionsColorCode(const QString&) ),
204  SLOT( ChangeDivisionsColorCode(const QString&) ) );
205 
206  // lineage viewer
208  m_QGoLineageViewerWidget->setObjectName("QGoLineageViewerWidget");
209 
211 
212 #if defined ( ENABLEFFMPEG ) || defined ( ENABLEAVI )
213  CreateVideoRecorderWidget();
214 #endif
215 
217 
219 
221 
222  ReadSettings();
223 
224  m_DockWidgetList.push_back(
225  std::pair< QGoDockWidgetStatus *, QDockWidget * >(
227  m_NavigationDockWidget, Qt::RightDockWidgetArea, false, true, this),
229 
230  m_DockWidgetList.push_back(
231  std::pair< QGoDockWidgetStatus *, QDockWidget * >(
234  Qt::RightDockWidgetArea, false, true, this),
236 
237  m_DockWidgetList.push_back(
238  std::pair< QGoDockWidgetStatus *, QDockWidget * >(
240  Qt::LeftDockWidgetArea, false, true, this),
241  this->m_TrackViewDockWidget) );
242 
243 
244  m_DockWidgetList.push_back(
245  std::pair< QGoDockWidgetStatus *, QDockWidget * >(
247  Qt::LeftDockWidgetArea, false, true, this),
248  this->m_LineageViewDockWidget) );
249 
250  m_DockWidgetList.push_back(
251  std::pair< QGoDockWidgetStatus *, QDockWidget * >(
253  Qt::TopDockWidgetArea, false, true, this),
254  this->m_DataBaseTables) );
255 
256 #if defined ( ENABLEFFMPEG ) || defined ( ENABLEAVI )
257  m_DockWidgetList.push_back(
258  std::pair< QGoDockWidgetStatus *, QDockWidget * >(
259  new QGoDockWidgetStatus(m_VideoRecorderWidget, Qt::LeftDockWidgetArea, false, true, this),
260  m_VideoRecorderWidget) );
261 
262 #endif
263 
264  SetUpShortcuts();
265 }
266 
267 //-------------------------------------------------------------------------
268 
269 //-------------------------------------------------------------------------
272 {
274  m_HighlightedMeshesProperty->Delete();
275 
276  m_Seeds[0]->Delete();
277  m_Seeds[1]->Delete();
278  m_Seeds[2]->Delete();
279 
280  unsigned int minch = m_MegaCaptureReader->GetMinChannel();
281  unsigned int maxch = m_MegaCaptureReader->GetMaxChannel();
282 
283  for( unsigned int i = minch; i < maxch + 1; i++ )
284  {
285  vtkImageData *temp = m_MegaCaptureReader->GetOutput(i);
286  if ( temp )
287  {
288  temp->Delete();
289  temp = NULL;
290  }
291  }
292 
293  if ( m_ContourContainer )
294  {
295  delete m_ContourContainer;
296  }
297  if ( m_MeshContainer )
298  {
299  delete m_MeshContainer;
300  }
301  if ( m_TrackContainer )
302  {
303  delete m_TrackContainer;
304  }
305  if ( m_LineageContainer)
306  {
307  delete m_LineageContainer;
308  }
309 
310  if(m_ImageProcessor)
311  {
312  delete m_ImageProcessor;
313  }
314 
316  {
318  }
319 }
320 
321 //-------------------------------------------------------------------------
322 
323 //-------------------------------------------------------------------------
324 void
326 {
327  for( size_t id = 0; id < m_Seeds.size(); id++ )
328  {
329  m_Seeds[id]->Initialize();
330  }
331 
333 }
334 
335 //-------------------------------------------------------------------------
336 
337 std::vector< QString >
339 {
340  // build channel vector
341  unsigned int numberOfChannels = m_ImageProcessor->getNumberOfChannels();
342 
343  std::vector< QString > channelNames;
344  channelNames.resize( numberOfChannels );
345 
346  for(unsigned int i =0; i<numberOfChannels; ++i)
347  {
349  }
350 
351  return channelNames;
352 }
353 
354 //-------------------------------------------------------------------------
355 void
357  int iTimeMin, int iTimeMax)
358 {
359  //----------------------------------------------------------------
360  // Create base contour segmentation dock widget:
361  // basic interactor connections
362  //----------------------------------------------------------------
363 
364  std::vector< QString > channelNames = this->GetChannelNames();
365 
367  channelNames, iTimeMin, iTimeMax, &m_Seeds,
368  m_ImageProcessor, &m_TCoord, this);
369 
370  this->CreateConnectionsTraceEditingWidget<QGoContourEditingWidgetManager>(
371  iTimeMin, iTimeMax, this->m_ContourEditingWidget);
372 
373  // signals from the manual segmentation
375  SIGNAL( ManualSegmentationActivated(bool) ),
376  this,
377  SLOT( ManualInteractorBehavior(bool) ) );
378 
380  SIGNAL( ContourValidated(int) ),
381  this, SLOT( ValidateContour(int) ) );
382 
384  SIGNAL( reinitializeContour() ),
385  m_ImageView,
386  SLOT( ReinitializeContourWidget() ) );
387 
389  SIGNAL( changeContourRepresentationProperty(float, QColor,
390  QColor, QColor) ),
391  m_ImageView,
392  SLOT( UpdateContourRepresentationProperties(float, QColor,
393  QColor, QColor) ) );
394 
396  SIGNAL(TracesCreatedFromAlgo(std::vector<vtkPolyData *>, int) ),
397  this,
398  SLOT( SaveInDBAndRenderContourForVisu(std::vector<vtkPolyData *>, int) ) );
399 
400 
402 }
403 
404 //-------------------------------------------------------------------------
405 
406 //-------------------------------------------------------------------------
407 void
409 {
410  //----------------------------------------------------------------
411  // Create base contour segmentation dock widget:
412  // basic interactor connections
413  //----------------------------------------------------------------
414 
415  // build channel vector
416  std::vector< QString > channelNames = this->GetChannelNames();
417 
419  channelNames, iTimeMin, iTimeMax, &m_Seeds,
420  m_ImageProcessor, &m_TCoord, this);
421 
422  this->CreateConnectionsTraceEditingWidget<QGoMeshEditingWidgetManager>(
423  iTimeMin, iTimeMax, this->m_MeshEditingWidget);
424 
426  SIGNAL(TracesCreatedFromAlgo(std::vector<vtkPolyData *>, int) ),
427  this,
428  SLOT( SaveInDBAndRenderMeshForVisu(std::vector<vtkPolyData *>, int) ) );
429 
431  SIGNAL(TracesSplittedFromAlgo(std::vector<vtkPolyData *>) ),
432  this,
433  SLOT( SplitInDBAndRenderMeshForVisu(std::vector<vtkPolyData *>) ) );
434 
436  SIGNAL(TracesMergedFromAlgo(vtkPolyData *)),
437  this,
438  SLOT( MergeInDBAndRenderMeshForVisu(vtkPolyData * ) ));
439 
442  SIGNAL(SetOfContoursFromAlgo(std::vector<std::vector<vtkPolyData*> >, int) ),
443  this,
444  SLOT(SaveInDBAndRenderSetOfContoursForVisu(std::vector<std::vector<vtkPolyData*> >, int)));
445 
446  QObject::connect( this,
447  SIGNAL( TimePointChanged(int) ),
448  this,
449  SLOT(UpdateTracesEditingWidget() ) );
450 
452  SIGNAL(RequestPolydatas() ),
453  this,
454  SLOT( PolydatasRequested() ) );
455 
456  QObject::connect( this,
457  SIGNAL( RequestedPolydatas(std::list< vtkPolyData* >) ),
458  this->m_MeshEditingWidget,
459  SLOT( RequestedPolydatas(std::list< vtkPolyData* >) ) );
460 }
461 
462 //-------------------------------------------------------------------------
463 
464 //-------------------------------------------------------------------------
465 void
467 {
468  DefaultInteractorBehavior(iVisible);
469  this->m_ImageView->EnableContourWidget(iVisible);
470 }
471 
472 //-------------------------------------------------------------------------
473 
474 //-------------------------------------------------------------------------
475 void
477 {
478  DefaultInteractorBehavior(iVisible);
479  this->m_ImageView->EnableSeedWidget(iVisible);
480 }
481 
482 //-------------------------------------------------------------------------
483 void
485 {
486  if ( iVisible )
487  {
488  this->m_ImageView->DefaultMode();
489  }
490 }
491 
492 //-------------------------------------------------------------------------
493 
494 //-------------------------------------------------------------------------
495 void
497 {
498  if ( iVisible )
499  {
500  this->m_ImageView->ZoomMode();
501  }
502 }
503 
504 //-------------------------------------------------------------------------
505 
506 //-------------------------------------------------------------------------
507 void
509 {
510  if ( iVisible )
511  {
512  // pan is translate now, for consistency with the shortcuts
513  this->m_ImageView->PanMode();
514  }
515 }
516 
517 //-------------------------------------------------------------------------
518 
519 //-------------------------------------------------------------------------
520 void
522 {
523  if ( iVisible )
524  {
525  this->m_ImageView->ActorPickingMode();
526  }
527 }
528 
529 //-------------------------------------------------------------------------
530 
531 //-------------------------------------------------------------------------
532 void
534 {
535  this->m_ImageView->EnableDistanceWidget(iActive);
536 }
537 
538 //-------------------------------------------------------------------------
539 
540 //-------------------------------------------------------------------------
541 void
543 {
544  this->m_ImageView->EnableAngleWidget(iActive);
545 }
546 
547 //-------------------------------------------------------------------------
548 
549 //-------------------------------------------------------------------------
550 void
552 {
553  this->m_ImageView->EnableBoxWidget(iActive);
554 }
555 
556 //-------------------------------------------------------------------------
557 
558 //-------------------------------------------------------------------------
559 void
561 {
562  this->m_ImageView->EnablePlaneWidget(iActive);
563 }
564 
565 //-------------------------------------------------------------------------
566 
567 //-------------------------------------------------------------------------
568 void
570 {
578 
579  QObject::connect( m_NavigationDockWidget, SIGNAL( XSliceChanged(int) ),
580  this, SLOT( SetSliceViewYZ(int) ) );
581 
582  QObject::connect( this, SIGNAL( SliceViewYZChanged(int) ),
583  m_NavigationDockWidget, SLOT( SetXSlice(int) ) );
584 
585  QObject::connect( m_NavigationDockWidget, SIGNAL( YSliceChanged(int) ),
586  this, SLOT( SetSliceViewXZ(int) ) );
587 
588  QObject::connect( this, SIGNAL( SliceViewXZChanged(int) ),
589  m_NavigationDockWidget, SLOT( SetYSlice(int) ) );
590 
591  QObject::connect( m_NavigationDockWidget, SIGNAL( ZSliceChanged(int) ),
592  this, SLOT( SetSliceViewXY(int) ) );
593 
594  QObject::connect( this, SIGNAL( SliceViewXYChanged(int) ),
595  m_NavigationDockWidget, SLOT( SetZSlice(int) ) );
596 
597  QObject::connect( m_NavigationDockWidget, SIGNAL( TSliceChanged(int) ),
598  this, SLOT( SetTimePoint(int) ) );
599 
600  QObject::connect( this, SIGNAL( TimePointChanged(int) ),
601  m_NavigationDockWidget, SLOT( SetTSlice(int) ) );
602 
604  this, SLOT( ModeChanged(int) ) );
605 
607  this, SLOT( StepChanged(int) ) );
608 
610  this, SLOT( DopplerSizeChanged(int) ) );
611 
613  this, SLOT( visibilityChanged(QString, bool) ) );
614 }
615 
616 //-------------------------------------------------------------------------
617 
618 //-------------------------------------------------------------------------
619 void
621 {
623  SIGNAL( DBVariablesSet() ),
624  this,
626  //in order also, to update the list of meshes in the collectionIDs when
627  //the trace is contour and to update the show/hide contours and meshes
628  QObject::connect( this,
629  SIGNAL( TimePointChanged(int) ),
630  this->m_DataBaseTables,
631  SLOT( UpdateSelectedTimePoint(int) ) );
632 
634  SIGNAL( TraceToReEdit(unsigned int) ),
635  this, SLOT( ReEditContour(unsigned int) ) );
636 
638  SIGNAL( NewMeshToGenerate(std::list< unsigned int >, int) ),
639  this,
640  SLOT( CreateMeshFromSelectedContours(std::list< unsigned int >, int) ) );
641 
642  QObject::connect( this->m_DataBaseTables, SIGNAL( NeedToGoToTheLocation(int, int, int, int) ),
643  this, SLOT( GoToLocation(int, int, int, int) ) );
644 
646  SIGNAL( NeedToGoToTheRealLocation(double, double, double, int) ),
647  this,
648  SLOT( GoToRealLocation(double, double, double, int) ) );
649 
650  QObject::connect( this->m_DataBaseTables->toggleViewAction(), SIGNAL (toggled(bool) ),
651  this, SLOT(SetTraceSettingsToolBarVisible(bool) ) );
652 
654  //this->m_TraceSettingsWidgetForToolBar = this->m_DataBaseTables->GetTraceSettingsWidgetForToolBar();
655 }
656 //-------------------------------------------------------------------------
657 
658 //-------------------------------------------------------------------------
660 {
661  this->SetTheContainersForDB();
663  SIGNAL( PrintMessage(QString, int) ),
664  this->m_StatusBar,
665  SLOT( showMessage(QString, int) ) );
666 }
667 
668 //-------------------------------------------------------------------------
669 
670 //-------------------------------------------------------------------------
671 void
673 {
678 }
679 
680 //-------------------------------------------------------------------------
681 #if defined ( ENABLEFFMPEG ) || defined ( ENABLEAVI )
682 //-------------------------------------------------------------------------
683 
684 void
685 QGoTabImageView3DwT::CreateVideoRecorderWidget()
686 {
687  m_VideoRecorderWidget = new QGoVideoRecorder(this);
688 
689  QObject::connect( this, SIGNAL( FullScreenViewChanged(int) ),
690  this, SLOT( SetRendererWindow(int) ) );
691 
692  QObject::connect( m_VideoRecorderWidget, SIGNAL( XSliceChanged(int) ),
693  this, SLOT( SetSliceViewYZ(int) ) );
694  QObject::connect( m_VideoRecorderWidget, SIGNAL( YSliceChanged(int) ),
695  this, SLOT( SetSliceViewXZ(int) ) );
696  QObject::connect( m_VideoRecorderWidget, SIGNAL( ZSliceChanged(int) ),
697  this, SLOT( SetSliceViewXY(int) ) );
698  QObject::connect( m_VideoRecorderWidget, SIGNAL( TSliceChanged(int) ),
699  this, SLOT( SetTimePoint(int) ) );
700 
701  QObject::connect( m_VideoRecorderWidget, SIGNAL( GetSliceView() ),
702  this, SLOT( SetSliceView() ) );
703 }
704 
705 //-------------------------------------------------------------------------
706 void
707 QGoTabImageView3DwT::SetRendererWindow(int iValue)
708 {
709  if ( iValue >= 1 )
710  {
711  m_VideoRecorderWidget->SetRenderingWindow(
712  m_ImageView->GetInteractor(iValue - 1)->GetRenderWindow() );
713  }
714  else
715  {
716  m_VideoRecorderWidget->SetRenderingWindow(NULL);
717  }
718 }
719 
720 #endif /* ENABLEVIDEORECORD */
721 //-------------------------------------------------------------------------
722 
723 //-------------------------------------------------------------------------
724 void
726 {
727  QAction *separator1 = new QAction(this);
728  separator1->setSeparator(true);
729  this->m_ViewNoToolBarActions.push_back(separator1);
730 
731  QActionGroup *group = new QActionGroup(this);
732 
733  QAction *QuadViewAction = new QAction(tr("Quad-View"), this);
734 
735  QuadViewAction->setCheckable(true);
736  QuadViewAction->setChecked(true);
737 
738  QIcon quadviewicon;
739  quadviewicon.addPixmap(QPixmap( QString::fromUtf8(":/fig/4views.png") ),
740  QIcon::Normal, QIcon::Off);
741  QuadViewAction->setIcon(quadviewicon);
742 
743  group->addAction(QuadViewAction);
744 
745  this->m_ViewActions.push_back(QuadViewAction);
746 
747  QObject::connect( QuadViewAction, SIGNAL( triggered() ),
748  this, SLOT( Quadview() ) );
749 
750  QAction *FullScreenXYAction = new QAction(tr("Full-Screen XY"), this);
751  FullScreenXYAction->setCheckable(true);
752 
753  QIcon xyicon;
754  xyicon.addPixmap(QPixmap( QString::fromUtf8(":/fig/xy.png") ),
755  QIcon::Normal, QIcon::Off);
756  FullScreenXYAction->setIcon(xyicon);
757 
758  group->addAction(FullScreenXYAction);
759 
760  this->m_ViewActions.push_back(FullScreenXYAction);
761 
762  QObject::connect( FullScreenXYAction, SIGNAL( triggered() ),
763  this, SLOT( FullScreenViewXY() ) );
764 
765  QAction *FullScreenXZAction = new QAction(tr("Full-Screen XZ"), this);
766  FullScreenXZAction->setCheckable(true);
767 
768  QIcon xzicon;
769  xzicon.addPixmap(QPixmap( QString::fromUtf8(":/fig/zx.png") ),
770  QIcon::Normal, QIcon::Off);
771  FullScreenXZAction->setIcon(xzicon);
772 
773  group->addAction(FullScreenXZAction);
774 
775  this->m_ViewActions.push_back(FullScreenXZAction);
776 
777  QObject::connect( FullScreenXZAction, SIGNAL( triggered() ),
778  this, SLOT( FullScreenViewXZ() ) );
779 
780  QAction *FullScreenYZAction = new QAction(tr("Full-Screen YZ"), this);
781  FullScreenYZAction->setCheckable(true);
782 
783  QIcon yzicon;
784  yzicon.addPixmap(QPixmap( QString::fromUtf8(":/fig/yz.png") ),
785  QIcon::Normal, QIcon::Off);
786  FullScreenYZAction->setIcon(yzicon);
787 
788  group->addAction(FullScreenYZAction);
789 
790  this->m_ViewActions.push_back(FullScreenYZAction);
791 
792  QObject::connect( FullScreenYZAction, SIGNAL( triggered() ),
793  this, SLOT( FullScreenViewYZ() ) );
794 
795  QAction *FullScreenXYZAction = new QAction(tr("Full-Screen XYZ"), this);
796  FullScreenXYZAction->setCheckable(true);
797 
798  QIcon xyzicon;
799  xyzicon.addPixmap(QPixmap( QString::fromUtf8(":/fig/xyz.png") ),
800  QIcon::Normal, QIcon::Off);
801  FullScreenXYZAction->setIcon(xyzicon);
802 
803  group->addAction(FullScreenXYZAction);
804 
805  this->m_ViewActions.push_back(FullScreenXYZAction);
806 
807  QObject::connect( FullScreenXYZAction, SIGNAL( triggered() ),
808  this, SLOT( FullScreenViewXYZ() ) );
809 
810  QAction *separator2 = new QAction(this);
811  separator2->setSeparator(true);
812  this->m_ViewActions.push_back(separator2);
813 
814  QAction *ActionDisplayAnnotations =
815  new QAction(tr("Display annotations"), this);
816  ActionDisplayAnnotations->setCheckable(true);
817  ActionDisplayAnnotations->setChecked(true);
818  ActionDisplayAnnotations->setStatusTip( tr(" Display annotations in each 2d view") );
819 
820  QIcon displayannotationsicon;
821  displayannotationsicon.addPixmap(QPixmap( QString::fromUtf8(":/fig/2D_VIEWS_INFOS.png") ),
822  QIcon::Normal, QIcon::Off);
823  ActionDisplayAnnotations->setIcon(displayannotationsicon);
824 
825  QObject::connect( ActionDisplayAnnotations, SIGNAL( triggered() ),
826  this->m_ImageView, SLOT( ShowAnnotations() ) );
827 
828  this->m_ViewNoToolBarActions.push_back(ActionDisplayAnnotations);
829 
830  QAction *ActionDisplaySplinePlanes =
831  new QAction(tr("Display spline planes"), this);
832  ActionDisplaySplinePlanes->setCheckable(true);
833  ActionDisplaySplinePlanes->setChecked(true);
834  ActionDisplaySplinePlanes->setStatusTip( tr(" Display spline planes on each view") );
835 
836  QIcon displaysplineplaneicon;
837  displaysplineplaneicon.addPixmap(QPixmap( QString::fromUtf8(":/fig/C_M_L_Border.png") ),
838  QIcon::Normal, QIcon::Off);
839  ActionDisplaySplinePlanes->setIcon(displaysplineplaneicon);
840  this->m_ViewNoToolBarActions.push_back(ActionDisplaySplinePlanes);
841 
842  QObject::connect( ActionDisplaySplinePlanes, SIGNAL( triggered() ),
843  this->m_ImageView, SLOT( ShowSplinePlane() ) );
844 
845  QAction *DisplayCube3D = new QAction(tr("Display 3D cube"), this);
846  DisplayCube3D->setCheckable(true);
847  DisplayCube3D->setChecked(true);
848  DisplayCube3D->setStatusTip( tr(" Display or not cube in 3d") );
849 
850  QIcon cube3dicon;
851  cube3dicon.addPixmap(QPixmap( QString::fromUtf8(":/fig/cube.png") ),
852  QIcon::Normal, QIcon::Off);
853  DisplayCube3D->setIcon(cube3dicon);
854 
855  QObject::connect( DisplayCube3D, SIGNAL( triggered() ),
856  this->m_ImageView, SLOT( ShowCube3D() ) );
857 
858  this->m_ViewNoToolBarActions.push_back(DisplayCube3D);
859 
860  QAction *LookupTableAction = new QAction(tr("Lookup Table"), this);
861  LookupTableAction->setObjectName("LUT");
862  LookupTableAction->setEnabled(false);
863  LookupTableAction->setStatusTip( tr(" Change the associated lookup table") );
864 
865  //take
866  /*QIcon luticon;
867  luticon.addPixmap(QPixmap( QString::fromUtf8(":/fig/LookupTable.png") ),
868  QIcon::Normal, QIcon::Off);
869  LookupTableAction->setIcon(luticon);
870 
871  // Here write the connection
872  QObject::connect( LookupTableAction, SIGNAL( triggered() ),
873  this, SLOT( ChangeLookupTable() ) );
874 
875  this->m_ViewActions.push_back(LookupTableAction);*/
876 
877  QAction *ScalarBarAction = new QAction(tr("Display Scalar Bar"), this);
878  ScalarBarAction->setEnabled(false);
879  ScalarBarAction->setCheckable(true);
880  ScalarBarAction->setObjectName("ScalarBar");
881 
882  QIcon scalarbaricon;
883  scalarbaricon.addPixmap(QPixmap( QString::fromUtf8(":/fig/scalarbar.png") ),
884  QIcon::Normal, QIcon::Off);
885  ScalarBarAction->setIcon(scalarbaricon);
886 
887  this->m_ViewActions.push_back(ScalarBarAction);
888 
889  QObject::connect( ScalarBarAction, SIGNAL( toggled(bool) ),
890  m_ImageView, SLOT( ShowScalarBar(bool) ) );
891 
892  QPixmap Pix(16, 16);
893  Pix.fill(Qt::black);
894  m_BackgroundColorAction = new QAction(Pix, tr("Set Background Color"), this);
895  this->m_ViewActions.push_back(m_BackgroundColorAction);
896 
897  QObject::connect( m_BackgroundColorAction, SIGNAL( triggered() ),
898  this, SLOT( ChangeBackgroundColor() ) );
899 
900  QAction *separator4 = new QAction(this);
901  separator4->setSeparator(true);
902  this->m_ViewActions.push_back(separator4);
903 
905 
907 
908  this->m_ViewActions.push_back( m_DataBaseTables->toggleViewAction() );
909 
911  QAction *Change3DPerspectiveToAxialAction =
912  new QAction(tr("Change 3D view to Posterior "), this);
913  QIcon axialicon;
914  axialicon.addPixmap(QPixmap( QString::fromUtf8(":/fig/PosteriorView.png") ),
915  QIcon::Normal, QIcon::Off);
916  Change3DPerspectiveToAxialAction->setIcon(axialicon);
917  this->m_ViewNoToolBarActions.push_back(Change3DPerspectiveToAxialAction);
918 
919  QObject::connect( Change3DPerspectiveToAxialAction, SIGNAL( triggered() ),
920  this, SLOT( Change3DPerspectiveToAxial() ) );
921 
922  QAction *Change3DPerspectiveToCoronalAction =
923  new QAction(tr("Change 3D view to Dorsal "), this);
924  QIcon coronalicon;
925  coronalicon.addPixmap(QPixmap( QString::fromUtf8(":/fig/DorsalView.png") ),
926  QIcon::Normal, QIcon::Off);
927  Change3DPerspectiveToCoronalAction->setIcon(coronalicon);
928 
929  this->m_ViewNoToolBarActions.push_back(Change3DPerspectiveToCoronalAction);
930 
931  QObject::connect( Change3DPerspectiveToCoronalAction, SIGNAL( triggered() ),
932  this, SLOT( Change3DPerspectiveToCoronal() ) );
933 
934  QAction *Change3DPerspectiveToSagittalAction =
935  new QAction(tr("Change 3D view to Left "), this);
936  QIcon sagittalicon;
937  sagittalicon.addPixmap(QPixmap( QString::fromUtf8(":/fig/LeftView.png") ),
938  QIcon::Normal, QIcon::Off);
939  Change3DPerspectiveToSagittalAction->setIcon(sagittalicon);
940 
941  this->m_ViewNoToolBarActions.push_back(Change3DPerspectiveToSagittalAction);
942 
943  QObject::connect( Change3DPerspectiveToSagittalAction, SIGNAL( triggered() ),
944  this, SLOT( Change3DPerspectiveToSagittal() ) );
945 
946  QAction *separator7 = new QAction(this);
947  separator7->setSeparator(true);
948  this->m_ViewActions.push_back(separator7);
949 
950  // Enable volume rendering
951  QAction *VolumeRenderingAction =
952  new QAction(tr("Enable the volume rendering for the current channel(s)"), this);
953  VolumeRenderingAction->setCheckable(true);
954  VolumeRenderingAction->setChecked(false);
955  this->m_ViewActions.push_back(VolumeRenderingAction);
956 
957  QIcon volumerenderingicon;
958  volumerenderingicon.addPixmap(QPixmap( QString::fromUtf8(":/fig/VolumeRendering1.png") ),
959  QIcon::Normal, QIcon::Off);
960  VolumeRenderingAction->setIcon(volumerenderingicon);
961 
962  QObject::connect( VolumeRenderingAction, SIGNAL( toggled(bool) ),
963  this, SLOT( EnableVolumeRendering(bool) ) );
964 
965  // Enable synchronization
966  QAction *SynchronizeViewsAction =
967  new QAction(tr("synchronize the different views"), this);
968  SynchronizeViewsAction->setCheckable(true);
969  SynchronizeViewsAction->setChecked(true);
970  this->m_ViewActions.push_back(SynchronizeViewsAction);
971 
972  QIcon synchronizeicon;
973  synchronizeicon.addPixmap(QPixmap( QString::fromUtf8(":/fig/synchronize.png") ),
974  QIcon::Normal, QIcon::Off);
975  SynchronizeViewsAction->setIcon(synchronizeicon);
976 
977  QObject::connect( SynchronizeViewsAction, SIGNAL( toggled(bool) ),
978  this->m_ImageView, SLOT( SynchronizeViews(bool) ) );
979 
980  // Show/hide the planes
981  QAction *PlaneVisibilityAction =
982  new QAction(tr("show planes in the 3d view"), this);
983  PlaneVisibilityAction->setCheckable(true);
984  PlaneVisibilityAction->setChecked(true);
985  this->m_ViewActions.push_back(PlaneVisibilityAction);
986 
987  QIcon PlaneVisibilityicon;
988  PlaneVisibilityicon.addPixmap(QPixmap( QString::fromUtf8(":/fig/C_M_L.png") ),
989  QIcon::Normal, QIcon::Off);
990  PlaneVisibilityAction->setIcon(PlaneVisibilityicon);
991 
992  QObject::connect( PlaneVisibilityAction, SIGNAL( toggled(bool) ),
993  this->m_ImageView, SLOT( ShowPlanes(bool) ) );
994 }
995 
996 //-------------------------------------------------------------------------
997 
998 //-------------------------------------------------------------------------
999 void
1001 {
1002  // Track Color Coding
1003  // this->m_TracesActions->m_VectorAction.push_back( m_TrackViewDockWidget->toggleViewAction() );
1004 
1005  // Lineage Color Coding
1006  // this->m_TracesActions->m_VectorAction.push_back( m_LineageViewDockWidget->toggleViewAction() );
1007 }
1008 //-------------------------------------------------------------------------
1009 
1010 //-------------------------------------------------------------------------
1012 {
1013  bool ok;
1014  QStringList channel;
1015  unsigned int* boundChannel = m_ImageProcessor->getBoundsChannel();
1016 
1017  for( unsigned int i = boundChannel[0]; i < boundChannel[1]+1; ++i )
1018  {
1019  channel << QString::number(i, 10);
1020  }
1021 
1022  QString item =
1023  QInputDialog::getItem(this,
1024  tr("Channel selection"),
1025  tr("Please select the channel you want to track"),
1026  channel, 0, false, &ok);
1027 
1028  if ( ok )
1029  {
1030  m_ImageProcessor->setDopplerMode(ok, // bool: true/false
1031  item.toInt(&ok, 10)); // selected channel ID
1032  // update image
1033  m_ImageProcessor->setDoppler(m_TCoord, 0); // 0 is for optimization later on...
1034 
1035  // update widget
1036  // hide channels
1038  //update values - show requiered widgets
1039  std::vector<int> time = m_ImageProcessor->getDopplerTime(m_TCoord);
1040  // get number of items in container
1041  // requiereds to call this method since the number of items varies
1042  for(unsigned int i=0; i<m_ImageProcessor->getDopplerSize(); ++i)
1043  {
1044  if(time[i]>=0)
1045  {
1046  std::string name = m_ImageProcessor->getChannelName(time[i]);
1047 
1048  // channel color
1049  std::vector<double> color = m_ImageProcessor->getColor(name);
1050 
1051  // update navigation dockwidget
1053  QString::fromStdString(name),
1054  QColor(color[0],
1055  color[1],
1056  color[2],
1057  color[3]),
1058  time[i],
1059  true); // all checkboxes are check edwhen we start
1060  }
1061  }
1062  // set channel name
1064  QString("Channel %1").arg(m_ImageProcessor->getDopplerChannel()));
1065  }
1066 }
1067 
1068 //-------------------------------------------------------------------------
1069 void
1071 {
1072 #if defined( ENABLEFFMPEG ) || defined( ENABLEAVI )
1073  this->m_ToolsActions.push_back( m_VideoRecorderWidget->toggleViewAction() );
1074  this->m_VideoRecorderWidget->toggleViewAction()->setEnabled(false);
1075 #endif
1076 
1077  m_TakeSnapshotAction = new QAction(tr("Take Snapshot"), this);
1078  QIcon snapshoticon;
1079  snapshoticon.addPixmap(QPixmap( QString::fromUtf8(":/fig/camera-photo.png") ),
1080  QIcon::Normal, QIcon::Off);
1081  m_TakeSnapshotAction->setIcon(snapshoticon);
1082  m_TakeSnapshotAction->setStatusTip( tr("You have to be in full screen view to use the snapshot") );
1084  QObject::connect( m_TakeSnapshotAction, SIGNAL( triggered() ),
1085  this, SLOT( TakeSnapshot() ) );
1086 
1087  this->m_ToolsActions.push_back(m_TakeSnapshotAction);
1088 }
1089 
1090 //-------------------------------------------------------------------------
1091 
1092 //-------------------------------------------------------------------------
1094 {
1095  QAction *AddBookmarkAction = new QAction(tr("Add a bookmark"), this);
1096 
1097  this->m_BookmarkActions.push_back(AddBookmarkAction);
1098  QObject::connect( AddBookmarkAction, SIGNAL ( triggered() ),
1099  this, SLOT ( AddBookmark() ) );
1100  QAction *DeleteBookmarkAction = new QAction(tr("Delete a bookmark"), this);
1101  this->m_BookmarkActions.push_back(DeleteBookmarkAction);
1102  QObject::connect( DeleteBookmarkAction, SIGNAL ( triggered() ),
1103  this->m_DataBaseTables, SLOT( DeleteBookmarks() ) );
1104  QObject::connect( this->m_DataBaseTables, SIGNAL ( PrintDBReady() ),
1105  this, SLOT( GetTheRelatedToDBActions() ) );
1106  QObject::connect( this->m_DataBaseTables, SIGNAL( OpenBookmarksToUpdate() ),
1107  this, SLOT( GetTheOpenBookmarksActions() ) );
1108 }
1109 
1110 //-------------------------------------------------------------------------
1111 
1112 //-------------------------------------------------------------------------
1114 {
1116  QMenu * ImportMenu = new QMenu(tr("Import"), this);
1117  QAction *ImportContoursAction = new QAction(tr("Contours"), this);
1118  ImportContoursAction->setStatusTip(
1119  tr("Import the data of the contours from the text file into the GoFigure database" ) );
1120  QAction *ImportMeshesAction = new QAction(tr("3DMeshes"), this);
1121  ImportMeshesAction->setStatusTip(
1122  tr("Import the data of the meshes from the text file into the GoFigure database" ) );
1123  QAction *ImportTracksAction = new QAction(tr("Tracks"), this);
1124  ImportTracksAction->setStatusTip(
1125  tr("Import the data of the tracks from the text file into the GoFigure database" ) );
1126 
1127  ImportMenu->addAction(ImportContoursAction);
1128  ImportMenu->addAction(ImportMeshesAction);
1129  ImportMenu->addAction(ImportTracksAction);
1130 
1131  QMenu * ExportMenu = new QMenu(tr("Export"), this);
1132  QAction *ExportContoursAction = new QAction(tr("Contours"), this);
1133  ExportContoursAction->setStatusTip(
1134  tr("Export all the data related to all contours of the imagingsession from the database into a .txt file") );
1135 
1136  QAction *ExportMeshesAction = new QAction(tr("3DMeshes"), this);
1137  ExportMeshesAction->setStatusTip(
1138  tr("Export all the data related to all meshes of the imagingsession from the database into a .txt file") );
1139 
1140  QAction *ExportLineagesAction = new QAction(tr("Lineages For Lineage Viewer"), this);
1141  ExportLineagesAction->setStatusTip(
1142  tr("Export each lineage into a vtkFile in order to be visualized separately into the lineage viewer outside of Gofigure") );
1143 
1144  ExportMenu->addAction(ExportContoursAction);
1145  ExportMenu->addAction(ExportMeshesAction);
1146  ExportMenu->addAction(ExportLineagesAction);
1147 
1148  this->m_ToolsActions.push_back( ImportMenu->menuAction() );
1149  this->m_ToolsActions.push_back( ExportMenu->menuAction() );
1150 
1151  QObject::connect( ExportContoursAction, SIGNAL( triggered() ),
1152  this->m_DataBaseTables, SLOT( ExportContours () ) );
1153  QObject::connect( ImportContoursAction, SIGNAL( triggered() ),
1154  this, SLOT( ImportContours() ) );
1155  QObject::connect( ExportMeshesAction, SIGNAL( triggered() ),
1156  this->m_DataBaseTables, SLOT( ExportMeshes() ) );
1157  QObject::connect( ImportMeshesAction, SIGNAL ( triggered() ),
1158  this, SLOT ( ImportMeshes() ) );
1159  QObject::connect( ImportTracksAction, SIGNAL ( triggered() ),
1160  this, SLOT ( ImportTracks() ) );
1161  QObject::connect( ExportLineagesAction, SIGNAL ( triggered() ),
1163  SIGNAL( ExportLineages() ) );
1164 }
1165 
1166 //-------------------------------------------------------------------------
1167 
1168 //-------------------------------------------------------------------------
1170 {
1171  bool UpdateOpenBookmarks = false;
1172 
1173  if ( this->m_BookmarkActions.size() > 2 )
1174  {
1175  this->m_BookmarkActions.erase(
1176  this->m_BookmarkActions.begin() + this->m_BookmarkActions.size() - 1
1177  );
1178  UpdateOpenBookmarks = true;
1179  }
1181 
1182  size_t NumberBookmarks = ListBookmarks.size();
1183 
1184  QMenu *OpenBookmarkMenu = new QMenu(tr("Open a bookmark"), this);
1185 
1186  for ( size_t i = 0; i < NumberBookmarks; i++ )
1187  {
1188  QAction *OpenBookmarkAction = new QAction(ListBookmarks[i].first.c_str(), this);
1189 
1190  std::string TextStatusTip = "Description of the bookmark: ";
1191 
1192  TextStatusTip += ListBookmarks[i].second;
1193 
1194  OpenBookmarkAction->setStatusTip( TextStatusTip.c_str() );
1195 
1196  OpenBookmarkMenu->addAction(OpenBookmarkAction);
1197 
1199  OpenBookmarkAction, SIGNAL( triggered() ),
1200  this, SLOT( OpenExistingBookmark() )
1201  );
1202  }
1203 
1204  this->m_BookmarkActions.push_back( OpenBookmarkMenu->menuAction() );
1205 
1206  if ( UpdateOpenBookmarks )
1207  {
1209  }
1210 }
1211 
1212 //-------------------------------------------------------------------------
1213 
1214 //-------------------------------------------------------------------------
1216 {
1217  QAction * taction = qobject_cast< QAction * >( sender() );
1218  std::string BookmarkName = taction->text().toStdString();
1219  GoDBCoordinateRow Coord = this->m_DataBaseTables->GetCoordinateForBookmark(BookmarkName);
1220 
1221  int tt = Coord.GetMapValue<int>("TCoord");
1222  int tz = Coord.GetMapValue<int>("ZCoord");
1223  int ty = Coord.GetMapValue<int>("YCoord");
1224  int tx = Coord.GetMapValue<int>("XCoord");
1225 
1226  this->SetTimePoint(tt);
1227  this->SetSliceViewXY(tz);
1228  this->SetSliceViewXZ(ty);
1229  this->SetSliceViewYZ(tx);
1230 }
1231 
1232 //-------------------------------------------------------------------------
1233 
1234 //-------------------------------------------------------------------------
1235 void
1237 {
1238  // Get the current view displayed in full screen
1239  int FullScreenView = m_ImageView->GetFullScreenView();
1240 
1242 
1243  filename.append( QString("%1").arg("/") );
1244 
1245  switch ( FullScreenView )
1246  {
1247  case 1:
1248  filename.append("snapshot-xy-");
1250  break;
1251 
1252  case 2:
1253  filename.append("snapshot-xz-");
1255  break;
1256 
1257  case 3:
1258  filename.append("snapshot-yz-");
1260  break;
1261 
1262  default:
1263  filename.append("snapshot-xyz-");
1265  break;
1266  }
1267 }
1268 
1269 //-------------------------------------------------------------------------
1270 
1271 //-------------------------------------------------------------------------
1272 void
1274 {
1275  if ( iParent->objectName().isEmpty() )
1276  {
1277  iParent->resize(800, 800);
1278  }
1279 
1280  m_ImageView = new QGoImageView3D( this );
1282  m_DataBaseTables = new QGoPrintDatabase( this );
1283  this->addDockWidget(Qt::TopDockWidgetArea, m_DataBaseTables);
1285 
1286 
1289 
1291  this, SIGNAL( SliceViewXYChanged(int) ) );
1292 
1294  this, SIGNAL( SliceViewXZChanged(int) ) );
1295 
1297  this, SIGNAL( SliceViewYZChanged(int) ) );
1298 
1300  this, SIGNAL( FullScreenViewChanged(int) ) );
1301  // connect the contours selection connection
1302  QObject::connect( m_ImageView, SIGNAL( SelectionChanged() ),
1303  this, SLOT( HighlightPickedActor() ) );
1304 
1305  // connect the contours selection connection
1306  QObject::connect( m_ImageView, SIGNAL( VisibilityChanged() ),
1307  this, SLOT( VisibilityPickedActor() ) );
1308 
1309  retranslateUi(iParent);
1310 
1312 }
1313 //-------------------------------------------------------------------------
1314 
1315 //-------------------------------------------------------------------------
1316 void
1318 {
1319  iParent->setWindowTitle( tr("QGoTabImageView3DwT") );
1320  Q_UNUSED(iParent);
1321 }
1322 //-------------------------------------------------------------------------
1323 
1324 //-------------------------------------------------------------------------
1327 {
1328  return GoFigure::THREE_D_WITH_T;
1329 }
1330 
1331 //-------------------------------------------------------------------------
1332 
1333 //-------------------------------------------------------------------------
1334 void
1335 QGoTabImageView3DwT::SetLSMReader(vtkLSMReader *iReader, const int & iTimePoint)
1336 {
1337  GoLSMImageProcessor* processor = new GoLSMImageProcessor;
1338  processor->setReader(iReader);
1339  m_ImageProcessor = processor;
1340 
1341  m_TCoord = iTimePoint;
1342  // update image processor
1344  //update images
1345  UpdateImage();
1346  // update actors
1347  this->ShowTraces(m_TCoord);
1348  // update widgets on image loading
1350  // render
1351  m_ImageView->Update();
1352 
1353  // for the trace widget, navigation widget and table widget
1354  // should not be requiered since we just initialize it before
1355  emit TimePointChanged(m_TCoord);
1356 }
1357 
1358 //-------------------------------------------------------------------------
1359 
1360 //-------------------------------------------------------------------------
1361 void
1363  const GoFigureFileInfoHelperMultiIndexContainer & iContainer,
1364  const GoFigure::FileType & iFileType,
1365  const std::string & iHeader,
1366  const unsigned int & iTimePoint)
1367 {
1368  m_FileList = iContainer;
1369  m_FileType = iFileType;
1370 
1371  // setup megacapture reader
1372  m_MegaCaptureReader->SetInput(m_FileList);
1373  m_MegaCaptureReader->SetMegaCaptureHeader(iHeader);
1374  m_MegaCaptureReader->SetFileType(m_FileType);
1375  m_MegaCaptureReader->SetTimeBased(true);
1376  m_MegaCaptureReader->SetTimePoint(iTimePoint);
1377  m_MegaCaptureReader->Update();
1378 
1379  GoMegaImageProcessor* processor = new GoMegaImageProcessor;
1380  processor->setReader(m_MegaCaptureReader);
1381  m_ImageProcessor = processor;
1382 
1383  m_TCoord = iTimePoint;
1384  // update image processor
1386  //update images
1387  UpdateImage();
1388  // update widgets on image loading
1390  // render
1391  m_ImageView->Update();
1392 
1393  // for the trace widget, navigation widget and table widget
1394  // should not be requiered since we just initialize it before
1395  emit TimePointChanged(m_TCoord);
1396 }
1397 //-------------------------------------------------------------------------
1398 
1399 //-------------------------------------------------------------------------
1400 void
1403 {
1404  unsigned int* boundTime = m_ImageProcessor->getBoundsTime();
1405  unsigned int NumberOfChannels = m_ImageProcessor->getNumberOfChannels();
1406  int* extent = m_ImageProcessor->getExtent();
1407 
1408  assert( extent );
1409 
1410  // Initialize the widgets with the good number of channels
1411  // it will update the size of the related combobox
1413 
1414  for( unsigned int i = 0; i < NumberOfChannels; i++ )
1415  {
1416  std::string name = m_ImageProcessor->getChannelName(i);
1417  // channel color
1418  std::vector<double> color = m_ImageProcessor->getColor(name);
1419 
1420  QString channelname = QString::fromStdString(name);
1421  // update navigation dockwidget
1423  channelname,
1424  QColor(color[0],
1425  color[1],
1426  color[2],
1427  color[3]),
1428  i,
1429  true); // all checkboxes are check edwhen we start
1430  // create TF editor
1431  // add it in the vector
1432  this->createTransferFunctionEditor( channelname );
1433  }
1434 
1435  m_NavigationDockWidget->SetXMinimumAndMaximum(extent[0], extent[1]);
1436  m_NavigationDockWidget->SetXSlice( ( extent[0] + extent[1] ) / 2 );
1437 
1438  m_NavigationDockWidget->SetYMinimumAndMaximum(extent[2], extent[3]);
1439  m_NavigationDockWidget->SetYSlice( ( extent[2] + extent[3] ) / 2 );
1440 
1441  m_NavigationDockWidget->SetZMinimumAndMaximum(extent[4], extent[5]);
1442  m_NavigationDockWidget->SetZSlice( ( extent[4] + extent[5] ) / 2 );
1443 
1444  m_NavigationDockWidget->SetTMinimumAndMaximum(boundTime[0], boundTime[1]);
1445  m_NavigationDockWidget->SetTSlice(boundTime[0]);
1447 
1448  CreateContourEditingDockWidget(boundTime[0], boundTime[1]);
1449  CreateMeshEditingDockWidget(boundTime[0], boundTime[1]);
1450  m_DockWidgetList.push_back(
1451  std::pair< QGoDockWidgetStatus *, QDockWidget * >(
1452  new QGoDockWidgetStatus(
1454  Qt::LeftDockWidgetArea, false, true, this),
1456 
1457  m_DockWidgetList.push_back(
1458  std::pair< QGoDockWidgetStatus *, QDockWidget * >(
1459  new QGoDockWidgetStatus(
1461  Qt::LeftDockWidgetArea, false, true, this),
1462  this->m_MeshEditingWidget->GetDockWidget()) );
1463 
1464  // Set up QSpinBox in m_VideoRecorderWidget
1465 #if defined( ENABLEFFMPEG ) || defined( ENABLEAVI )
1466  m_VideoRecorderWidget->SetXMinAndMax(extent[0], extent[1]);
1467  m_VideoRecorderWidget->SetYMinAndMax(extent[2], extent[3]);
1468  m_VideoRecorderWidget->SetZMinAndMax(extent[4], extent[5]);
1469  m_VideoRecorderWidget->SetTMinAndMax(boundTime[0], boundTime[1]);
1470 #endif /* ENABLEVIDEORECORD */
1471 }
1472 //-------------------------------------------------------------------------
1473 
1474 //-------------------------------------------------------------------------
1475 void
1477 {
1478  // get number of visible channels instead
1479  unsigned int NumberOfVisibleChannels = m_ImageProcessor->getNumberOfVisibleChannels();
1480 
1481  if ( NumberOfVisibleChannels>1 )
1482  {
1484  }
1485  else if( NumberOfVisibleChannels == 1)
1486  {
1487  //update Image
1489  // update LUT
1491  // CONFIGURE LUT
1492  this->findChild<QAction*>("LUT")->setEnabled(true);
1493  this->findChild<QAction*>("ScalarBar")->setEnabled(true);
1494  }
1495  else
1496  {
1497  // Start by creating a black lookup table.
1498  vtkSmartPointer<vtkLookupTable> bwLut =
1499  vtkSmartPointer<vtkLookupTable>::New();
1500  bwLut->SetTableRange (0, 1);
1501  bwLut->SetSaturationRange (0, 0);
1502  bwLut->SetHueRange (0, 0);
1503  bwLut->SetValueRange (0, 0);
1504  bwLut->Build();
1505  m_ImageView->SetLookupTable(bwLut);
1506  }
1507 }
1508 
1509 //-------------------------------------------------------------------------
1510 
1511 //-------------------------------------------------------------------------
1512 void
1514 {
1515  // update widget
1516  //update values - show requiered widgets
1517  std::vector<int> time = m_ImageProcessor->getDopplerTime(m_TCoord);
1518  // get number of items in container
1519  // requiereds to call this method since the number of items varies
1520  for(unsigned int i=0; i<m_ImageProcessor->getDopplerSize(); ++i)
1521  {
1522  if(time[i]>=0)
1523  {
1524  std::string name = m_ImageProcessor->getChannelName(time[i]);
1525  // channel color
1526  std::vector<double> color = m_ImageProcessor->getColor(name);
1527  // update navigation dockwidget
1529  QString::fromStdString(name),
1530  QColor(color[0],
1531  color[1],
1532  color[2],
1533  color[3]),
1534  time[i],
1535  true); // all checkboxes are check edwhen we start
1536  }
1537  }
1538  // set channel name
1540  QString("Channel %1").arg(m_ImageProcessor->getDopplerChannel()));
1541 }
1542 
1543 //-------------------------------------------------------------------------
1544 
1545 //-------------------------------------------------------------------------
1546 void
1547 QGoTabImageView3DwT::SetTimePoint(const int & iTimePoint)
1548 {
1549  if ( iTimePoint == m_TCoord )
1550  {
1551  return;
1552  }
1553 
1554  QApplication::setOverrideCursor( QCursor(Qt::WaitCursor) );
1555 
1556  m_TCoord = iTimePoint;
1557 
1559  {
1560  // update image processor
1562  }
1563  else
1564  {
1565  // delete previous doppler widget
1567  // update the image processor
1568  m_ImageProcessor->setDoppler(m_TCoord, 0); // 0 is for optimization later on...
1569  //rebuild navigation widget
1571  }
1572 
1573  // update image container
1574  UpdateImage();
1575 
1576  // if go from t=0 to t=1 in doppler mode
1578  {
1579  //clean TF Editor
1581  //createTransferFunctionEditor(channel name)
1583  }
1584  else
1585  {
1586  // update TF editor (histogram and max value)
1587  UpdateTFEditor();
1588  }
1589 
1591 
1592  // for the trace widget, navigation widget and table widget
1593  emit TimePointChanged(m_TCoord);
1594 
1595  //if we use the database, update table and traces!
1597  {
1598  // clean table widget and container
1599  // then load new traces in TW and put polydatas in container
1600  std::list<unsigned int> timePoints =
1601  this->m_DataBaseTables->
1602  UpdateTableWidgetAndContainersForGivenTimePoint(
1603  m_TCoord);
1604 
1605  // create actors if we use the database
1606  // function has to be splitted-> remove duplications
1607  this->CreateContoursActorsFromVisuContainer(timePoints);
1608  this->CreateMeshesActorsFromVisuContainer(timePoints);
1609 
1610  //show time specific actors
1611  this->ShowTraces(m_TCoord);
1612  }
1613 
1614  m_ImageView->Update();
1615 
1617 }
1618 //-------------------------------------------------------------------------
1619 
1620 //-------------------------------------------------------------------------
1621 /*void
1622 QGoTabImageView3DwT::ChangeLookupTable()
1623 {
1624  vtkImageData *image = m_ImageView->GetImage();
1625 
1626  if ( image->GetNumberOfScalarComponents() == 1 )
1627  {
1628  vtkLookupTable *lut = QGoLUTDialog::GetLookupTable( this,
1629  tr("Choose one look-up table") );
1630  if ( lut )
1631  {
1632  m_ImageView->SetLookupTable(lut);
1633 
1634  // free memory since it is not freed in the QGoLUTDialog
1635  lut->Delete();
1636  }
1637  }
1638 }*/
1639 
1640 //-------------------------------------------------------------------------
1641 
1642 //-------------------------------------------------------------------------
1643 QString
1645  GoFigure::FileType iType,
1646  QString iBaseName)
1647 {
1648  return m_ImageView->SnapshotViewXY(iType, iBaseName);
1649 }
1650 
1651 //-------------------------------------------------------------------------
1652 
1653 //-------------------------------------------------------------------------
1654 QString
1656  GoFigure::FileType iType,
1657  QString iBaseName)
1658 {
1659  return m_ImageView->SnapshotViewXZ(iType, iBaseName);
1660 }
1661 
1662 //-------------------------------------------------------------------------
1663 
1664 //-------------------------------------------------------------------------
1665 QString
1667  GoFigure::FileType iType,
1668  QString iBaseName)
1669 {
1670  return m_ImageView->SnapshotViewYZ(iType, iBaseName);
1671 }
1672 
1673 //-------------------------------------------------------------------------
1674 
1675 //-------------------------------------------------------------------------
1676 QString
1678  GoFigure::FileType iType,
1679  QString iBaseName)
1680 {
1681  return m_ImageView->SnapshotViewXYZ(iType, iBaseName);
1682 }
1683 
1684 //-------------------------------------------------------------------------
1685 
1686 //-------------------------------------------------------------------------
1687 void
1689 {
1691 }
1692 
1693 //-------------------------------------------------------------------------
1694 
1695 //-------------------------------------------------------------------------
1696 void
1698 {
1700 }
1701 
1702 //-------------------------------------------------------------------------
1703 
1704 //-------------------------------------------------------------------------
1705 void
1707 {
1709 }
1710 
1711 //-------------------------------------------------------------------------
1712 
1713 //-------------------------------------------------------------------------
1714 void
1716 {
1718 }
1719 
1720 //-------------------------------------------------------------------------
1721 
1722 //-------------------------------------------------------------------------
1723 void
1725 {
1728 #if defined ( ENABLEFFMPEG ) || defined ( ENABLEAVI )
1729  this->m_VideoRecorderWidget->toggleViewAction()->setEnabled(false);
1730 #endif
1731 }
1732 
1733 //-------------------------------------------------------------------------
1734 
1735 //-------------------------------------------------------------------------
1736 void
1738 {
1741 #if defined ( ENABLEFFMPEG ) || defined ( ENABLEAVI )
1742  this->m_VideoRecorderWidget->toggleViewAction()->setEnabled(true);
1743 #endif
1744 }
1745 
1746 //-------------------------------------------------------------------------
1747 
1748 //-------------------------------------------------------------------------
1749 void
1751 {
1754 #if defined ( ENABLEFFMPEG ) || defined ( ENABLEAVI )
1755  this->m_VideoRecorderWidget->toggleViewAction()->setEnabled(true);
1756 #endif
1757 }
1758 
1759 //-------------------------------------------------------------------------
1760 
1761 //-------------------------------------------------------------------------
1762 void
1764 {
1767 #if defined ( ENABLEFFMPEG ) || defined ( ENABLEAVI )
1768  this->m_VideoRecorderWidget->toggleViewAction()->setEnabled(true);
1769 #endif
1770 }
1771 
1772 //-------------------------------------------------------------------------
1773 
1774 //-------------------------------------------------------------------------
1775 void
1777 {
1780 #if defined ( ENABLEFFMPEG ) || defined ( ENABLEAVI )
1781  this->m_VideoRecorderWidget->toggleViewAction()->setEnabled(true);
1782 #endif
1783 }
1784 
1785 //-------------------------------------------------------------------------
1786 
1787 //-------------------------------------------------------------------------
1788 void
1790 {
1791  double r(0.), g(0.), b(0.);
1792 
1793  m_ImageView->GetBackgroundColor(r, g, b);
1794  m_BackgroundColor.setRgbF(r, g, b);
1795 }
1796 
1797 //-------------------------------------------------------------------------
1798 
1799 //-------------------------------------------------------------------------
1800 void
1802 {
1804 }
1805 
1806 //-------------------------------------------------------------------------
1807 
1808 //-------------------------------------------------------------------------
1809 void
1811 {
1812  double r(0.), g(0.), b(0.);
1813 
1814  m_ImageView->GetBackgroundColor(r, g, b);
1815  m_BackgroundColor.setRgbF(r, g, b);
1816 
1818  this, tr("Choose Background Color") );
1819 
1820  if ( temp != m_BackgroundColor )
1821  {
1822  m_BackgroundColor = temp;
1824  QPixmap Pix(16, 16);
1825  Pix.fill(temp);
1827  }
1828 }
1829 
1830 //-------------------------------------------------------------------------
1831 void
1833 {
1834 
1835  //clean TF Editor
1837 
1838  if ( iChannel == 1 )
1839  {
1840  // set image processor and build navigation widget if we click on ok
1841  StartDopplerView();
1842  //createTransferFunctionEditor(channel name)
1844  }
1845  else
1846  {
1848  m_ImageProcessor->setDopplerMode(false, 0);
1849  // update image processor
1851  // change visibility
1853  // create transfer function editor
1854  unsigned int NumberOfChannels = m_ImageProcessor->getNumberOfChannels();
1855  for ( unsigned int i = 0; i < NumberOfChannels; i++ )
1856  {
1857  std::string name = m_ImageProcessor->getChannelName(i);
1858  // create TF editor
1860  }
1861  }
1862 
1863  //update images
1864  UpdateImage();
1865  // update visualization
1866  m_ImageView->Update();
1867  //update the trace editing widget
1869  // update the TF widget
1870 }
1871 //-------------------------------------------------------------------------
1872 
1873 //-------------------------------------------------------------------------
1874 void
1876 {
1877  // delete previous doppler widget
1879  // set the new doppler step
1881  // update the image processor
1882  m_ImageProcessor->setDoppler(m_TCoord, 0); // 0 is for optimization later on...
1883  //rebuild navigation widget
1885  // build new image
1886  UpdateImage();
1887  //clean TF Editor
1889  //
1891  //update
1892  m_ImageView->Update();
1893  //update the trace editing widget
1895 }
1896 //-------------------------------------------------------------------------
1897 
1898 //-------------------------------------------------------------------------
1899 void
1900 QGoTabImageView3DwT::SaveContour(vtkPolyData *contour, vtkPolyData *contour_nodes,
1901  int iTCoord)
1902 {
1903  if ( ( contour->GetNumberOfPoints() > 2 ) && ( iTCoord >= 0 ) )
1904  {
1905  // Compute Bounding Box
1906  std::vector< int > bounds = GetBoundingBox(contour);
1907  // Save contour in database :
1908  this->m_DataBaseTables->SaveContoursFromVisuInDB(bounds[0],
1909  bounds[2],
1910  bounds[4],
1911  iTCoord,
1912  bounds[1],
1913  bounds[3],
1914  bounds[5],
1915  contour_nodes);
1916  }
1917 }
1918 
1919 //-------------------------------------------------------------------------
1920 
1921 //-------------------------------------------------------------------------
1922 std::vector< int >
1924 {
1925  std::vector< int > boundingBox(6, 0);
1926 
1927  if ( iElement )
1928  {
1929  // Compute Bounding Box
1930  double bounds[6];
1931  iElement->GetBounds(bounds);
1932 
1933  // Extract Min and Max from bounds
1934  double Min[3], Max[3];
1935  int k = 0;
1936  unsigned int i;
1937  for( i = 0; i < 3; i++ )
1938  {
1939  Min[i] = bounds[k++];
1940  Max[i] = bounds[k++];
1941  }
1942 
1943  int *min_idx = this->GetImageCoordinatesFromWorldCoordinates(Min);
1944  int *max_idx = this->GetImageCoordinatesFromWorldCoordinates(Max);
1945 
1946  int extent[6];
1947  m_ImageProcessor->getImageBW()->GetExtent(extent);
1948 
1949  for( i = 0; i < 3; i++ )
1950  {
1951  if ( min_idx[i] > extent[2 * i] )
1952  {
1953  boundingBox[2 * i] = min_idx[i];
1954  }
1955  else
1956  {
1957  boundingBox[2 * i] = extent[2 * i];
1958  }
1959  if ( max_idx[i] < extent[2 * i + 1] )
1960  {
1961  boundingBox[2 * i + 1] = max_idx[i];
1962  }
1963  else
1964  {
1965  boundingBox[2 * i + 1] = extent[2 * i + 1];
1966  }
1967  }
1968 
1969  delete[] min_idx;
1970  delete[] max_idx;
1971  }
1972  return boundingBox;
1973 }
1974 
1975 //-------------------------------------------------------------------------
1976 
1977 //-------------------------------------------------------------------------
1978 std::vector< vtkActor * >
1979 QGoTabImageView3DwT::VisualizeTrace(vtkPolyData *iTrace, double *iRGBA)
1980 {
1981  std::vector< vtkActor * > oActors;
1982 
1983  if ( iTrace->GetNumberOfPoints() > 2 )
1984  {
1985  vtkProperty *trace_property = vtkProperty::New();
1986  trace_property->SetColor(iRGBA[0], iRGBA[1], iRGBA[2]);
1987  trace_property->SetOpacity(iRGBA[3]);
1988 
1989  vtkPolyData *trace_copy = vtkPolyData::New();
1990  trace_copy->DeepCopy(iTrace);
1991 
1992  oActors =
1993  this->AddContour(trace_copy, trace_property);
1994 
1995  trace_copy->Delete();
1996  trace_property->Delete();
1997  }
1998 
1999  // add actor to renderer and to Prop3d
2000 
2001  m_ImageView->AddActor(3, oActors[3]);
2002 
2003 
2004  return oActors;
2005 }
2006 
2007 //-------------------------------------------------------------------------
2008 
2009 //-------------------------------------------------------------------------
2010 void
2012 {
2013  bool re_edit = this->m_ContourEditingWidget->GetReeditMode();
2014 
2015 #ifdef HAS_OPENMP
2016 #pragma omp for
2017 #endif
2018  for( int i = 0; i < m_ImageView->GetNumberOfImageViewers(); i++ )
2019  {
2020  vtkPolyData *nodes = m_ImageView->GetContourRepresentationNodePolydata(i);
2021 
2022  if ( nodes->GetNumberOfPoints() > 2 )
2023  {
2025  // m_ImageView->GetContourRepresentationAsPolydata(i)
2026  vtkPolyData *contour = vtkPolyData::New();
2027  contour->DeepCopy( m_ImageView->GetContourRepresentationAsPolydata(i) );
2028 
2029  //polydata for bounding box, node for points
2030  SaveContour(contour, nodes, iTCoord);
2031 
2032  // polydata
2033  //ADD TRACE ID IN POLYDATA
2034  AddTraceIDIntoPolydata(contour, this->m_ContourContainer->m_CurrentElement.TraceID, "CONTOUR");
2035 
2036  std::vector< vtkActor * > actors =
2037  VisualizeTrace(contour,
2038  this->m_ContourContainer->m_CurrentElement.rgba);
2039  contour->Delete();
2040 
2041  //nodes
2043  nodes,
2044  // m_TCoord,
2045  iTCoord,
2046  re_edit, //highlighted
2047  true); //visible
2048 
2050  }
2051  }
2052 
2054 
2055  if ( re_edit ) //need to set the widgets to a normal mode
2056  {
2057  this->m_TraceSettingsToolBar->setEnabled(true);
2058  this->m_TraceSettingsWidget->setEnabled(true);
2059  this->m_ContourEditingWidget->SetReeditMode(false);
2062  }
2063 }
2064 
2065 //-------------------------------------------------------------------------
2066 
2067 //-------------------------------------------------------------------------
2068 int *
2070 {
2072 }
2073 
2074 //-------------------------------------------------------------------------
2075 // std::vector< vtkQuadricLODActor* >
2076 std::vector< vtkActor * >
2077 QGoTabImageView3DwT::AddContour(vtkPolyData *dataset, vtkProperty *iProperty)
2078 {
2079  return this->m_ImageView->AddContour(dataset, iProperty);
2080 }
2081 
2082 //-------------------------------------------------------------------------
2083 
2084 //-------------------------------------------------------------------------
2085 void
2086 QGoTabImageView3DwT::ReEditContour(const unsigned int & iId)
2087 {
2088  vtkPolyData *nodes = NULL;
2089 
2090  if ( this->m_ContourContainer
2091  ->RemoveElementFromVisualizationWithGivenTraceID(iId) )
2092  {
2093  nodes = this->m_ContourContainer->m_CurrentElement.Nodes;
2094 
2095  std::vector< int > bounds = this->GetBoundingBox(nodes);
2096 
2097  int dir = ContourMeshContainer::ComputeDirectionFromBounds< int >(bounds);
2098 
2099  if ( dir != -1 )
2100  {
2101  int idx[3];
2102  idx[0] = ( bounds[0] + bounds[1] ) / 2;
2103  idx[1] = ( bounds[2] + bounds[3] ) / 2;
2104  idx[2] = ( bounds[4] + bounds[5] ) / 2;
2105 
2106  this->GoToLocation(idx[0], idx[1], idx[2], m_TCoord);
2107 
2108  //this->m_ModeActions[0]->setChecked(true);
2109  QAction* action = this->findChild< QAction* >("ContourEditingMode");//->setChecked(true);
2110  action->setChecked(true);
2112 
2113  this->m_TraceSettingsToolBar->setEnabled(false);
2114  this->m_TraceSettingsWidget->setEnabled(false);
2116  // go to manual segmentation
2118 
2119  }
2120  }
2121 }
2122 
2123 //-------------------------------------------------------------------------
2124 
2125 //-------------------------------------------------------------------------
2126 void
2128 {
2129  vtkActor *temp_actor = m_ImageView->GetCurrentActor();
2130  // mesh ID first - higher probability?
2131  if( temp_actor->GetMapper()->GetInput()->GetFieldData()->GetArray("MESH") )
2132  {
2134  temp_actor->GetMapper()->GetInput()->GetFieldData()->GetArray("MESH")->GetTuple1(0));
2135  return;
2136  }
2137 
2138  if( temp_actor->GetMapper()->GetInput()->GetFieldData()->GetArray("TRACK") )
2139  {
2141  temp_actor->GetMapper()->GetInput()->GetFieldData()->GetArray("TRACK")->GetTuple1(0));
2142  return;
2143  }
2144 
2145  if( temp_actor->GetMapper()->GetInput()->GetFieldData()->GetArray("DIVISION") )
2146  {
2148  temp_actor->GetMapper()->GetInput()->GetFieldData()->GetArray("DIVISION")->GetTuple1(0));
2149  return;
2150  }
2151 
2152  if( temp_actor->GetMapper()->GetInput()->GetFieldData()->GetArray("CONTOUR") )
2153  {
2155  temp_actor->GetMapper()->GetInput()->GetFieldData()->GetArray("CONTOUR")->GetTuple1(0));
2156  return;
2157  }
2158 }
2159 
2160 //-------------------------------------------------------------------------
2161 
2162 //-------------------------------------------------------------------------
2163 void
2165 {
2166  vtkActor *temp_actor = m_ImageView->GetCurrentActor();
2167 
2168  if( temp_actor->GetMapper()->GetInput()->GetFieldData()->GetArray("MESH") )
2169  {
2171  temp_actor->GetMapper()->GetInput()->GetFieldData()->GetArray("MESH")->GetTuple1(0),
2173  return;
2174  }
2175 
2176  if( temp_actor->GetMapper()->GetInput()->GetFieldData()->GetArray("TRACK") )
2177  {
2179  temp_actor->GetMapper()->GetInput()->GetFieldData()->GetArray("TRACK")->GetTuple1(0),
2181  return;
2182  }
2183 
2184  if( temp_actor->GetMapper()->GetInput()->GetFieldData()->GetArray("CONTOUR") )
2185  {
2187  temp_actor->GetMapper()->GetInput()->GetFieldData()->GetArray("CONTOUR")->GetTuple1(0),
2189  return;
2190  }
2191 
2192 }
2193 
2194 //-------------------------------------------------------------------------
2195 
2196 //-------------------------------------------------------------------------
2197 int
2199 {
2200  return m_ImageView->GetSliceViewXY();
2201 }
2202 
2203 //-------------------------------------------------------------------------
2204 
2205 //-------------------------------------------------------------------------
2207 {
2208  return m_ImageView->GetSliceViewXZ();
2209 }
2210 
2211 //-------------------------------------------------------------------------
2212 
2213 //-------------------------------------------------------------------------
2215 {
2216  return m_ImageView->GetSliceViewYZ();
2217 }
2218 
2219 //-------------------------------------------------------------------------
2220 
2221 //-------------------------------------------------------------------------
2223 {
2224  return m_TCoord;
2225 }
2226 
2227 //-------------------------------------------------------------------------
2228 
2229 //-------------------------------------------------------------------------
2231 {
2233 }
2234 
2235 //-------------------------------------------------------------------------
2236 
2237 //-------------------------------------------------------------------------
2239 {
2241  this->GetSliceViewXZ(),
2242  this->GetSliceViewXY(),
2243  this->GetTimePoint() );
2244 }
2245 
2246 //-------------------------------------------------------------------------
2247 
2248 //-------------------------------------------------------------------------
2249 void
2251 {
2252  m_ImageView->SetCamera(1);
2253 }
2254 
2255 //-------------------------------------------------------------------------
2256 
2257 //-------------------------------------------------------------------------
2258 void
2260 {
2261  m_ImageView->SetCamera(2);
2262 }
2263 
2264 //-------------------------------------------------------------------------
2265 
2266 //-------------------------------------------------------------------------
2267 void
2269 {
2270  m_ImageView->SetCamera(3);
2271 }
2272 
2273 //-------------------------------------------------------------------------
2274 
2275 //-------------------------------------------------------------------------
2276 void
2278 {
2279 #if defined ( ENABLEFFMPEG ) || defined ( ENABLEAVI )
2280  m_VideoRecorderWidget->SetCurrentX( this->GetSliceViewYZ() );
2281  m_VideoRecorderWidget->SetCurrentY( this->GetSliceViewXZ() );
2282  m_VideoRecorderWidget->SetCurrentZ( this->GetSliceViewXY() );
2283  m_VideoRecorderWidget->SetCurrentT( this->GetTimePoint() );
2284 #endif
2285 }
2286 
2287 //-------------------------------------------------------------------------
2288 
2289 //-------------------------------------------------------------------------
2290 int
2291 QGoTabImageView3DwT::SaveAndVisuContour(int iTCoord, vtkPolyData *iView)
2292 {
2293  if ( !m_DataBaseTables->IsDatabaseUsed() )
2294  {
2295  std::cerr << "Problem with DB" << std::endl;
2296  return -1;
2297  }
2298 
2299  // if no data, we are using the contour widget
2300  if ( !iView )
2301  {
2302  std::cerr << "Input contour is NULL" << std::endl;
2303  return -1;
2304  }
2305 
2306  // if there are no points in the polydata
2307  if ( iView->GetNumberOfPoints() == 0 )
2308  {
2309  std::cerr << "No points in the contour you want to save" << std::endl;
2310  return 0;
2311  }
2312 
2313  vtkPolyData *contour_nodes = vtkPolyData::New();
2314  CreateContour(contour_nodes, iView);
2315 
2316  // polydata for bounding box, nodes for db
2317  SaveContour(iView, contour_nodes, iTCoord);
2318 
2319  AddTraceIDIntoPolydata(iView, this->m_ContourContainer->m_CurrentElement.TraceID, "CONTOUR");
2320 
2321  // should be polydata
2322  std::vector< vtkActor * > actors =
2323  VisualizeTrace(iView,
2324  this->m_ContourContainer->m_CurrentElement.rgba);
2325 
2326 
2327  iView->Delete();
2328 
2329  // should be nodes
2330  // update the container
2332  contour_nodes,
2333  iTCoord,
2334  false, //highlighted
2335  true); //visible
2336 
2338 
2339  return 0;
2340 }
2341 
2342 //-------------------------------------------------------------------------
2343 
2344 //-------------------------------------------------------------------------
2345 void
2346 QGoTabImageView3DwT::CreateContour(vtkPolyData *contour_nodes, vtkPolyData *iView)
2347 {
2348  //generate contour
2349  vtkOrientedGlyphContourRepresentation *contourRep =
2350  vtkOrientedGlyphContourRepresentation::New();
2351 
2352  vtkContourWidget *contourWidget = vtkContourWidget::New();
2353 
2354  contourWidget->SetInteractor( this->m_ImageView->GetImageViewer(0)
2355  ->GetInteractor() );
2356  contourWidget->SetRepresentation(contourRep);
2357  contourWidget->On();
2358 
2359  contourWidget->Initialize(iView);
2360  contourWidget->CloseLoop();
2361 
2362  contourRep->GetNodePolyData(contour_nodes);
2363 
2364  contourWidget->Delete();
2365  contourRep->Delete();
2366 }
2367 
2368 //-------------------------------------------------------------------------
2369 
2370 //-------------------------------------------------------------------------
2371 void
2372 QGoTabImageView3DwT::SaveMesh(vtkPolyData *iView, int iTCoord, int iCollectionID)
2373 {
2374  // Compute Bounding Box
2375  std::vector< int > bounds = this->GetBoundingBox(iView);
2376 
2377  // Save mesh in database
2379  MeshAttributes =
2380  ComputeMeshAttributes( iView, true, static_cast< unsigned int >( iTCoord ) );
2381 
2382  this->m_DataBaseTables->SaveMeshFromVisuInDB(bounds[0], bounds[2], bounds[4],
2383  bounds[1], bounds[3], bounds[5],
2384  iTCoord,
2385  iView,
2386  &MeshAttributes,
2387  iCollectionID);
2388 }
2389 
2390 //-------------------------------------------------------------------------
2391 
2392 //-------------------------------------------------------------------------
2393 void
2395  std::vector<vtkPolyData *> iVectPolydata, int iTCoord)
2396 {
2397  std::vector<vtkPolyData *>::iterator iter = iVectPolydata.begin();
2398  while(iter != iVectPolydata.end())
2399  {
2400  SaveAndVisuMesh(*iter, iTCoord);
2401  ++iter;
2402  }
2403 
2405 }
2406 //-------------------------------------------------------------------------
2407 
2408 //-------------------------------------------------------------------------
2409 void
2411  std::vector<vtkPolyData *> iVectPolydata)
2412 {
2413  int N = static_cast< int >( iVectPolydata.size() );
2414 
2415  if( N == 0 )
2416  {
2417  return;
2418  }
2419 
2420  // get mesh trace ID
2421  std::list< unsigned int > traceID =
2422  this->m_MeshContainer-> GetHighlightedElementsTraceID();
2423  // get mesh track ID
2424  std::list< unsigned int > collectionID =
2425  this->m_MeshContainer-> GetHighlightedElementsCollectionID();
2426  // get mesh time point
2427  std::list< unsigned int > tCoord =
2428  this->m_MeshContainer-> GetHighlightedElementsTCoord();
2429 
2430  // uncheck this element
2431  // need it so when we split next mesh, time point and track ID will be accurate
2432  m_MeshContainer->UpdateElementHighlighting(traceID.front());
2433 
2434  unsigned int timePoint = tCoord.front();
2435 
2436  // Save mesh first mesh, provide track ID
2437  SaveAndVisuMesh(iVectPolydata[0], timePoint, collectionID.front());
2438 
2439  if( N > 1)
2440  {
2441 #ifdef HAS_OPENMP
2442 #pragma omp for
2443 #endif
2444  for( int i = 1; i < N; ++i )
2445  {
2446  SaveAndVisuMesh( iVectPolydata[i], timePoint, 0 );
2447  }
2448  }
2449 
2451 }
2452 //-------------------------------------------------------------------------
2453 
2454 //-------------------------------------------------------------------------
2455 void
2457  vtkPolyData * iVectPolydata)
2458 {
2459  if( iVectPolydata == NULL )
2460  return;
2461 
2462  // get mesh trace ID
2463  std::list< unsigned int > traceID =
2464  this->m_MeshContainer-> GetHighlightedElementsTraceID();
2465  // get mesh track ID
2466  std::list< unsigned int > collectionID =
2467  this->m_MeshContainer-> GetHighlightedElementsCollectionID();
2468  // get mesh time point
2469  std::list< unsigned int > tCoord =
2470  this->m_MeshContainer-> GetHighlightedElementsTCoord();
2471 
2472  // uncheck all
2473  std::list< unsigned int >::iterator iterator = traceID.begin();
2474  while(iterator != traceID.end())
2475  {
2477  ++iterator;
2478  }
2479 
2480  // Save mesh first mesh, provide track ID
2481  SaveAndVisuMesh(iVectPolydata, tCoord.front(), collectionID.front());
2482 
2484 }
2485 //-------------------------------------------------------------------------
2486 
2487 //-------------------------------------------------------------------------
2488 void
2491  std::vector<std::vector<vtkPolyData*> > iVectorSetOfContours, int iTCoord)
2492 {
2493  // just add to visu as of now
2494  std::vector<std::vector<vtkPolyData*> >::iterator it1 =
2495  iVectorSetOfContours.begin();
2496  while(it1!=iVectorSetOfContours.end())
2497  {
2498  std::vector<vtkPolyData*>::iterator it2 = (*it1).begin();
2499  while(it2!=(*it1).end())
2500  {
2501  vtkPolyData* data = vtkPolyData::New();
2502  data->DeepCopy(*it2);
2503  this->AddContour(data);
2504  ++it2;
2505  }
2506  ++it1;
2507  }
2508 }
2509 
2510 //-------------------------------------------------------------------------
2512  std::vector<vtkPolyData *> iVectPolydata, int iTCoord)
2513 {
2514  std::vector<vtkPolyData *>::iterator iter = iVectPolydata.begin();
2515  while(iter != iVectPolydata.end())
2516  {
2517  SaveAndVisuContour(iTCoord, *iter);
2518  ++iter;
2519  }
2520 
2522 }
2523 //-------------------------------------------------------------------------
2524 
2525 //-------------------------------------------------------------------------
2526 void
2528  unsigned int iTCoord,
2529  int iCollectionID)
2530 {
2531  if ( !iView )
2532  {
2533  std::cerr << "Input Mesh is NULL" << std::endl;
2534  return;
2535  }
2536 
2537  SaveMesh(iView, iTCoord, iCollectionID);
2538 
2539  // should be done in the mesh manager, from goprintdatabase
2540 
2541  //ADD TRACE ID IN POLYDATA
2542  AddTraceIDIntoPolydata(iView, this->m_MeshContainer->m_CurrentElement.TraceID, "MESH");
2543 
2544  std::vector< vtkActor * > actors =
2545  VisualizeTrace(iView,
2546  this->m_MeshContainer->m_CurrentElement.rgba);
2547 
2548  // update container since a new mesh is created
2550  iView,
2551  iTCoord,
2552  false, // highlighted
2553  true); // visible
2555 }
2556 
2557 //-------------------------------------------------------------------------
2558 
2559 //-------------------------------------------------------------------------
2560 void
2562 {
2563  if ( !m_DataBaseTables->IsDatabaseUsed() )
2564  {
2565  std::cerr << "Problem with DB" << std::endl;
2566  return;
2567  }
2568 
2569  vtkPolyData *contour_nodes = vtkPolyData::New();
2570  CreateContour(contour_nodes, iInput);
2571 
2572  //std::list<unsigned int> ListContourIDs;
2573  if ( ( iInput->GetNumberOfPoints() > 2 ) && ( m_TCoord >= 0 ) )
2574  {
2575  // Compute Bounding Box
2576  std::vector< int > bounds = GetBoundingBox(iInput);
2577  // Save contour in database :
2578  //ListContourIDs.push_back(
2580  bounds[2],
2581  bounds[4],
2582  bounds[1],
2583  bounds[3],
2584  bounds[5],
2585  contour_nodes);
2586  //);
2587 
2588  // AND VISU!!!
2589  AddTraceIDIntoPolydata(iInput, this->m_ContourContainer->m_CurrentElement.TraceID, "MESH");
2590 
2591  std::vector< vtkActor * > actors =
2592  VisualizeTrace(iInput,
2593  this->m_ContourContainer->m_CurrentElement.rgba);
2594 
2596 
2597  iInput->Delete();
2598 
2599  // update the container
2601  contour_nodes,
2602  m_TCoord,
2603  false, //highlighted
2604  true); //visible
2605 
2607  }
2608 }
2609 
2610 //-------------------------------------------------------------------------
2611 
2612 //-------------------------------------------------------------------------
2614 {
2615  if ( iEnable )
2616  {
2617  //this->m_ModeActions.at(0)->setChecked(true);
2618  this->findChild< QAction* >("DefaultMode")->setChecked(true);
2619  }
2620 }
2621 
2622 //-------------------------------------------------------------------------
2623 
2624 //-------------------------------------------------------------------------
2627 ComputeMeshAttributes(vtkPolyData *iMesh,
2628  const bool & iIntensity,
2629  const unsigned int& iTCoord )
2630 {
2631  typedef unsigned char PixelType;
2632  const unsigned int Dimension = 3;
2633  typedef itk::Image< PixelType, Dimension > ImageType;
2634 
2637  calculator->SetPolyData(iMesh);
2638  calculator->SetIntensityBasedComputation(iIntensity);
2639 
2640  GoFigureMeshAttributes oAttributes;
2642  {
2643  int NumberOfChannels = static_cast< int >( m_ImageProcessor->getNumberOfChannels() );
2644 
2645  if( iIntensity )
2646  {
2647 #ifdef HAS_OPENMP
2648 #pragma omp for
2649 #endif
2650  for( int i = 0; i < NumberOfChannels; i++ )
2651  {
2652  vtkSmartPointer< vtkImageExport > vtk_exporter =
2653  vtkSmartPointer< vtkImageExport >::New();
2654  itk::VTKImageImport< ImageType >::Pointer itk_importer =
2655  itk::VTKImageImport< ImageType >::New();
2656 
2657  vtk_exporter->SetInput(m_ImageProcessor->getImageBW(i));
2658 
2659  ConnectPipelines< vtkImageExport, itk::VTKImageImport< ImageType >::Pointer >(
2660  vtk_exporter, itk_importer);
2661  calculator->SetImage( itk_importer->GetOutput() );
2662  calculator->Update();
2663 
2664  oAttributes.m_Volume = calculator->GetPhysicalSize();
2665  oAttributes.m_Area = calculator->GetArea();
2666  oAttributes.m_Size = calculator->GetSize();
2667 
2668  std::string channelname = m_ImageProcessor->getChannelName(i);
2669 
2670  oAttributes.m_TotalIntensityMap[channelname] =
2671  static_cast< int >( calculator->GetSumIntensity() );
2672  oAttributes.m_MeanIntensityMap[channelname] =
2673  calculator->GetMeanIntensity();
2674  }
2675  }
2676  else
2677  {
2678  vtkSmartPointer< vtkImageExport > vtk_exporter =
2679  vtkSmartPointer< vtkImageExport >::New();
2680  itk::VTKImageImport< ImageType >::Pointer itk_importer =
2681  itk::VTKImageImport< ImageType >::New();
2682 
2683  vtk_exporter->SetInput( m_ImageProcessor->getImageBW( 0 ) );
2684 
2685  ConnectPipelines< vtkImageExport, itk::VTKImageImport< ImageType >::Pointer >(
2686  vtk_exporter, itk_importer);
2687  calculator->SetImage( itk_importer->GetOutput() );
2688  calculator->Update();
2689 
2690  oAttributes.m_Volume = calculator->GetPhysicalSize();
2691  oAttributes.m_Area = calculator->GetArea();
2692  oAttributes.m_Size = calculator->GetSize();
2693  }
2694  }
2695  else
2696  {
2697  unsigned int* boundChannel = m_ImageProcessor->getBoundsChannel();
2698  unsigned int NumberOfChannels = m_ImageProcessor->getNumberOfChannels();
2699 
2700  std::vector< vtkSmartPointer< vtkImageData > > temp_image( NumberOfChannels );
2701 
2702  // load real image
2703  m_ImageProcessor->initTimePoint(iTCoord);
2704 
2705  if( iIntensity )
2706  {
2707 
2708 #ifdef HAS_OPENMP
2709 #pragma omp parallel for
2710 #endif
2711  for( int i = static_cast< int >( boundChannel[0] );
2712  i <= static_cast< int >( boundChannel[1] );
2713  i++ )
2714  {
2715  temp_image[i] = m_ImageProcessor->getImageBW(i);
2716 
2717  vtkSmartPointer< vtkImageExport > vtk_exporter =
2718  vtkSmartPointer< vtkImageExport >::New();
2719  itk::VTKImageImport< ImageType >::Pointer itk_importer =
2720  itk::VTKImageImport< ImageType >::New();
2721 
2722  vtk_exporter->SetInput(temp_image[i]);
2723 
2724  ConnectPipelines< vtkImageExport, itk::VTKImageImport< ImageType >::Pointer >(
2725  vtk_exporter, itk_importer);
2726  calculator->SetImage( itk_importer->GetOutput() );
2727  calculator->Update();
2728 
2729  oAttributes.m_Volume = calculator->GetPhysicalSize();
2730  oAttributes.m_Area = calculator->GetArea();
2731  oAttributes.m_Size = calculator->GetSize();
2732 
2733  std::string channelname = m_ImageProcessor->getChannelName(i);
2734 
2735  oAttributes.m_TotalIntensityMap[channelname] =
2736  static_cast< int >( calculator->GetSumIntensity() );
2737  oAttributes.m_MeanIntensityMap[channelname] =
2738  calculator->GetMeanIntensity();
2739  }
2740  }
2741  else
2742  {
2743  temp_image[0] = m_ImageProcessor->getImageBW(0);
2744 
2745  vtkSmartPointer< vtkImageExport > vtk_exporter =
2746  vtkSmartPointer< vtkImageExport >::New();
2747  itk::VTKImageImport< ImageType >::Pointer itk_importer =
2748  itk::VTKImageImport< ImageType >::New();
2749 
2750  vtk_exporter->SetInput(temp_image[0]);
2751 
2752  ConnectPipelines< vtkImageExport, itk::VTKImageImport< ImageType >::Pointer >(
2753  vtk_exporter, itk_importer);
2754  calculator->SetImage( itk_importer->GetOutput() );
2755  calculator->Update();
2756 
2757  oAttributes.m_Volume = calculator->GetPhysicalSize();
2758  oAttributes.m_Area = calculator->GetArea();
2759  oAttributes.m_Size = calculator->GetSize();
2760  }
2761  // load doppler image
2762  // visibility should be updated...
2764  }
2765  return oAttributes;
2766 }
2767 
2768 //-------------------------------------------------------------------------
2769 
2770 //-------------------------------------------------------------------------
2772 {
2773  if ( this->m_DataBaseTables->IsDatabaseUsed() )
2774  {
2776 
2777  this->GoToDefaultMenu();
2778  }
2779 }
2780 
2781 //-------------------------------------------------------------------------
2782 
2783 //-------------------------------------------------------------------------
2784 void
2786  std::list< unsigned int > iListContourIDs,
2787  int iMeshID)
2788 {
2790  std::list< unsigned int >::const_iterator contourid_it = iListContourIDs.begin();
2791  std::list< unsigned int >::const_iterator contourid_end = iListContourIDs.end();
2792 
2793  std::vector< vtkPolyData * > list_contours;
2794 
2795  // get the time point
2796  unsigned int tcoord = std::numeric_limits< unsigned int >::max();
2797 
2798  while ( contourid_it != contourid_end )
2799  {
2801 
2802  boost::tuples::tie(it0, it1) =
2803  m_ContourContainer->m_Container.get< TraceID >().equal_range(*contourid_it);
2804 
2805  if ( it0 != it1 )
2806  {
2807  if ( tcoord == std::numeric_limits< unsigned int >::max() )
2808  {
2809  tcoord = it0->TCoord;
2810  }
2811  else
2812  {
2813  if ( it0->TCoord != tcoord )
2814  {
2816  NULL,
2817  tr("Generate Mesh From Checked Contours"),
2818  tr("Selected contours are at different time point: %1 != %2").arg(tcoord).arg( it0->TCoord) );
2819  return;
2820  }
2821  }
2822 
2823  list_contours.push_back(
2824  vtkPolyData::SafeDownCast(
2825  it0->ActorXYZ->GetMapper()->GetInput() ) );
2826  }
2827  ++contourid_it;
2828  }
2829 
2830  if ( !list_contours.empty() )
2831  {
2832  // make the mesh from the list of contours
2834  FilterType::Pointer filter = FilterType::New();
2835  filter->ProcessContours(list_contours);
2836 
2837  vtkPolyData *mesh = filter->GetOutput();
2838 
2839  vtkBox *implicitFunction = vtkBox::New();
2840  // get bounds from the first visible image
2841  implicitFunction->SetBounds( m_ImageProcessor->getImageBW()->GetBounds() );
2842 
2843  vtkClipPolyData *cutter = vtkClipPolyData::New();
2844  cutter->SetInput(mesh);
2845  cutter->InsideOutOn();
2846  cutter->SetClipFunction(implicitFunction);
2847  cutter->Update();
2848 
2849  vtkPolyData *temp = vtkPolyData::New();
2850  temp->DeepCopy( cutter->GetOutput() );
2851 
2852  cutter->Delete();
2853  implicitFunction->Delete();
2854  mesh->Delete();
2855 
2856  //as the element is already in the container we need to delete it in order
2857  //to update it in the SaveAndVisuMesh:
2859  SaveAndVisuMesh(temp, tcoord);
2860  }
2861 }
2862 
2863 //-------------------------------------------------------------------------
2864 
2865 //-------------------------------------------------------------------------
2867 {
2868  if ( this->m_DataBaseTables->IsDatabaseUsed() )
2869  {
2871 
2872  GoToDefaultMenu();
2873  }
2874 }
2875 
2876 //-------------------------------------------------------------------------
2877 
2878 //-------------------------------------------------------------------------
2880 {
2881  if ( this->m_DataBaseTables->IsDatabaseUsed() )
2882  {
2883  std::vector< int > NewTrackIDs =
2885  //call the method of the trackContainer to update the points :argument
2886  // NewTrackIDs
2887  this->m_TrackContainer->UpdateTracksStrings(NewTrackIDs);
2888  GoToDefaultMenu();
2889  }
2890 }
2891 
2892 //-------------------------------------------------------------------------
2893 
2894 //-------------------------------------------------------------------------
2895 void
2896 QGoTabImageView3DwT::GoToLocation(int iX, int iY, int iZ, int iT)
2897 {
2898  this->SetTimePoint(iT);
2899  this->SetSliceViewXY(iZ);
2900  this->SetSliceViewXZ(iY);
2901  this->SetSliceViewYZ(iX);
2902 }
2903 //-------------------------------------------------------------------------
2904 
2905 //-------------------------------------------------------------------------
2906 void
2907 QGoTabImageView3DwT::GoToRealLocation(double iX, double iY, double iZ, int iT)
2908 {
2909  double p[3];
2910  p[0] = iX;
2911  p[1] = iY;
2912  p[2] = iZ;
2913 
2914  int *index = this->GetImageCoordinatesFromWorldCoordinates( p );
2915 
2916  this->GoToLocation( index[0], index[1], index[2], iT);
2917 
2918  delete[] index;
2919 }
2920 //-------------------------------------------------------------------------
2921 
2922 //-------------------------------------------------------------------------
2923 void
2925 AddTraceIDIntoPolydata( vtkPolyData* iPolydata, unsigned int iTraceID, const char* iTrace)
2926 {
2927  vtkSmartPointer<vtkIntArray> trackIDArray = vtkSmartPointer<vtkIntArray>::New();
2928  trackIDArray->SetNumberOfComponents(1);
2929  trackIDArray->SetNumberOfValues(1);
2930  trackIDArray->SetName(iTrace);
2931  trackIDArray->SetValue(0, iTraceID);
2932 
2933  iPolydata->GetFieldData()->AddArray(trackIDArray);
2934 }
2935 //-------------------------------------------------------------------------
2936 
2937 //-------------------------------------------------------------------------
2938 void
2940 {
2941  if (!IsVisible)
2942  {
2946  {
2947  this->m_TraceSettingsToolBar->setVisible(IsVisible);
2948  }
2949  }
2950  else
2951  {
2953  {
2954  this->m_DataBaseTables->SetTraceNameForTableWidget("contour");
2955  }
2957  {
2959  }
2961  // if the dockwidget is not on floating mode
2962  // or if the trace settings widget is not already visible in the dockwidget
2963  // or if the TW is not visible
2964  {
2965  this->m_TraceSettingsToolBar->setVisible(IsVisible);
2966  }
2967  }
2968 }
2969 //-------------------------------------------------------------------------
2970 
2971 //-------------------------------------------------------------------------
2972 void
2974 QMenu* iMenu, QToolBar* iToolBar)
2975 {
2976  //iToolBar->clear();
2977  QGoToolBarStatus* TracesToolBar =
2978  new QGoToolBarStatus(iToolBar, iMenu, Qt::TopToolBarArea, true, true, this);
2979 
2980  QActionGroup* group = this->findChild< QActionGroup* >("ModeGroup");
2981 
2982  //Contour Editing
2983  QAction *ContourSegmentationAction =
2985  ContourSegmentationAction->setShortcut(tr("2", "Contour Editing Mode"));
2986  ContourSegmentationAction->setParent(this);
2987  ContourSegmentationAction->setObjectName("ContourEditingMode");
2988 
2989  group->addAction(ContourSegmentationAction);
2990  //group->addAction(this->m_ContourSegmentationDockWidget->GetActionForToggle() );
2991 
2992  TracesToolBar->m_VectorAction.push_back(ContourSegmentationAction);
2993  //this->m_TracesActions.push_back(this->m_ContourSegmentationDockWidget->GetActionForToggle());
2994 
2995  //Mesh Editing
2996  QAction *MeshSegmentationAction =
2998  MeshSegmentationAction->setShortcut(tr("3", "Mesh Editing Mode"));
2999 
3000  group->addAction(MeshSegmentationAction);
3001 
3002  TracesToolBar->m_VectorAction.push_back(MeshSegmentationAction);
3003 
3004  // Track Color Coding
3005  TracesToolBar->m_VectorAction.push_back(
3007 
3008  // Lineage Color Coding
3009  TracesToolBar->m_VectorAction.push_back(
3011 
3012  // Lineage Viewer
3013  TracesToolBar->m_VectorAction.push_back(
3015 
3016  QObject::connect( ContourSegmentationAction,
3017  SIGNAL( toggled(bool) ),
3019  SLOT( SetVisible(bool) ) );
3020 
3021  QObject::connect( ContourSegmentationAction,
3022  SIGNAL( toggled(bool) ),
3023  this,
3024  SLOT( SetTraceSettingsToolBarVisible(bool) ) );
3025 
3026  QObject::connect( MeshSegmentationAction,
3027  SIGNAL( toggled(bool) ),
3029  SLOT( SetVisible(bool) ) );
3030 
3031  QObject::connect( MeshSegmentationAction,
3032  SIGNAL( toggled(bool) ),
3033  this,
3034  SLOT( SetTraceSettingsToolBarVisible(bool) ) );
3035 
3036  this->m_ToolBarList.push_back(TracesToolBar);
3037 }
3038 //-------------------------------------------------------------------------
3039 
3040 //-------------------------------------------------------------------------
3041 void
3043 {
3044  m_TraceSettingsToolBar = iToolBar;
3045  QGoToolBarStatus* TraceSettingsToolBar = new QGoToolBarStatus(
3046  iToolBar, 0, Qt::TopToolBarArea,false,true,this,
3048 
3049  this->m_ToolBarList.push_back(TraceSettingsToolBar);
3050 }
3051 //-------------------------------------------------------------------------
3052 
3053 //-------------------------------------------------------------------------
3054 void
3056 {
3057  if (this->m_MeshEditingWidget != NULL && this->m_ContourEditingWidget != NULL)
3058  {
3059  if (!this->m_ImageProcessor->getDopplerMode())
3060  {
3063  }
3064  else
3065  {
3066  QHash<QString, QColor> ListTimePoints;
3067  std::vector<int> dopplerT =
3069 
3070  for(unsigned int i=0; i<this->m_ImageProcessor->getDopplerSize(); ++i)
3071  {
3072  if (dopplerT[i] >= 0 )
3073  {
3074  double* rgb = vtkMath::HSVToRGB(
3075  static_cast<double>(i) /
3076  static_cast<double>(
3077  this->m_ImageProcessor->getDopplerSize()),1,1);
3078  QColor color(rgb[0]*255, rgb[1]*255, rgb[2]*255);
3079  ListTimePoints[tr("%1").arg(dopplerT[i])] = color;
3080  }
3081  }
3082 
3083  this->m_MeshEditingWidget->SetTSliceForDopplerView(ListTimePoints,
3085  this->m_ContourEditingWidget->SetTSliceForDopplerView(ListTimePoints,
3087  }
3088  }
3089 }
3090 //-------------------------------------------------------------------------
3091 
3092 //-------------------------------------------------------------------------
3093 void
3095 {
3096  QGoTabElementBase::CreateModeToolBar(iMenu, iToolBar);
3097 
3098  QActionGroup* group = this->findChild<QActionGroup*>("ModeGroup");
3099  QAction *separator1 = new QAction(this);
3100  separator1->setSeparator(true);
3101  this->m_ModeToolBar->m_VectorAction.push_back(separator1);
3102 
3103  //---------------------------------//
3104  // Actor picking mode //
3105  //---------------------------------//
3106  QAction *ActorPickingAction = new QAction(tr("Object Picking"), this);
3107  ActorPickingAction->setShortcut(tr("P", "Object Picking Mode"));
3108  ActorPickingAction->setCheckable(true);
3109  ActorPickingAction->setChecked(false);
3110 
3111  QIcon ActorPickingIcon;
3112  ActorPickingIcon.addPixmap(QPixmap( QString::fromUtf8(":/fig/ObjectPicking.png") ),
3113  QIcon::Normal, QIcon::Off);
3114  ActorPickingAction->setIcon(ActorPickingIcon);
3115  ActorPickingAction->setStatusTip( tr(
3116  "Select a contour or a mesh (left click when the bounding box of the object of interest is visible)") );
3117 
3118  group->addAction(ActorPickingAction);
3119 
3120  this->m_ModeToolBar->m_VectorAction.push_back(ActorPickingAction);
3121  // it also updates the interactor behaviour
3122  QObject::connect( ActorPickingAction, SIGNAL( toggled(bool) ),
3123  this, SLOT( ActorPickingInteractorBehavior(bool) ) );
3124 
3125  //---------------------------------//
3126  // Box 3D picking mode //
3127  //---------------------------------//
3128  QAction *Box3DPickingAction = new QAction(tr("Show/hide objects using Box"), this);
3129  Box3DPickingAction->setShortcut(tr("B", "Box Widget Mode"));
3130  Box3DPickingAction->setCheckable(true);
3131  Box3DPickingAction->setChecked(false);
3132 
3133  QIcon Box3DPickingIcon;
3134  Box3DPickingIcon.addPixmap(QPixmap( QString::fromUtf8(":/fig/Box3DPicking.png") ),
3135  QIcon::Normal, QIcon::Off);
3136  Box3DPickingAction->setIcon(Box3DPickingIcon);
3137  Box3DPickingAction->setStatusTip( tr("Show only the objects in the box") );
3138 
3139  group->addAction(Box3DPickingAction);
3140 
3141  this->m_ModeToolBar->m_VectorAction.push_back(Box3DPickingAction);
3142  // it also updates the interactor behaviour
3143  QObject::connect( Box3DPickingAction, SIGNAL( toggled(bool) ),
3144  this, SLOT( Box3DPicking(bool) ) );
3145 
3146  //---------------------------------//
3147  // Plane widget mode //
3148  //---------------------------------//
3149  QAction *PlaneWidgetAction = new QAction(tr("Show/hide objects using Plane"), this);
3150  PlaneWidgetAction->setCheckable(true);
3151  PlaneWidgetAction->setChecked(false);
3152 
3153  QIcon PlaneWidgetIcon;
3154  PlaneWidgetIcon.addPixmap(QPixmap( QString::fromUtf8(":/fig/PlaneSelection.png") ),
3155  QIcon::Normal, QIcon::Off);
3156  PlaneWidgetAction->setIcon(PlaneWidgetIcon);
3157  PlaneWidgetAction->setStatusTip( tr("Show only the objects located in front of the plane") );
3158 
3159  group->addAction(PlaneWidgetAction);
3160 
3161  this->m_ModeToolBar->m_VectorAction.push_back(PlaneWidgetAction);
3162  // it also updates the interactor behaviour
3163  QObject::connect( PlaneWidgetAction, SIGNAL( toggled(bool) ),
3164  this, SLOT( PlaneWidgetInteractorBehavior(bool) ) );
3165 
3166  // NOT A MODE: ANNOTATION
3167 
3168  QAction *separator3 = new QAction(this);
3169  separator3->setSeparator(true);
3170  this->m_ModeToolBar->m_VectorAction.push_back(separator3);
3171 
3172  //---------------------------------//
3173  // Distance mode //
3174  //---------------------------------//
3175  QAction *DistanceAction = new QAction(tr("Measure a Distance"), this);
3176  DistanceAction->setCheckable(true);
3177  DistanceAction->setChecked(false);
3178 
3179  QIcon DistanceIcon;
3180  DistanceIcon.addPixmap(QPixmap( QString::fromUtf8(":/fig/Distance.png") ),
3181  QIcon::Normal, QIcon::Off);
3182  DistanceAction->setIcon(DistanceIcon);
3183  DistanceAction->setStatusTip( tr("Measure a distance between 2 points (left click to place/drag the points)") );
3184 
3185  group->addAction(DistanceAction);
3186 
3187  this->m_ModeToolBar->m_VectorAction.push_back(DistanceAction);
3188 
3189  QObject::connect( DistanceAction, SIGNAL( toggled(bool) ),
3190  this, SLOT( DistanceWidgetInteractorBehavior(bool) ) );
3191 
3192  // NOT A MODE: ANNOTATION
3193 
3194  //---------------------------------//
3195  // Angle mode //
3196  //---------------------------------//
3197  QAction *AngleAction = new QAction(tr("Measure an Angle"), this);
3198  AngleAction->setCheckable(true);
3199  AngleAction->setChecked(false);
3200 
3201  QIcon AngleIcon;
3202  AngleIcon.addPixmap(QPixmap( QString::fromUtf8(":/fig/Angle.png") ),
3203  QIcon::Normal, QIcon::Off);
3204  AngleAction->setIcon(AngleIcon);
3205  AngleAction->setStatusTip( tr("Measure an angle between 3 points (left click to place/drag the points)") );
3206 
3207  group->addAction(AngleAction);
3208 
3209  this->m_ModeToolBar->m_VectorAction.push_back(AngleAction);
3210 
3211  QObject::connect( AngleAction, SIGNAL( toggled(bool) ),
3212  this, SLOT( AngleWidgetInteractorBehavior(bool) ) );
3213 }
3214 //-------------------------------------------------------------------------
3215 
3216 //-------------------------------------------------------------------------
3217 void
3219 visibilityChanged(QString iName, bool iVisibility)
3220 {
3221  m_ImageProcessor->visibilityChanged(iName.toStdString(), iVisibility);
3222  UpdateImage();
3223  //if we are in volume rendering
3225 
3226  // update visu
3227  m_ImageView->Update();
3228 }
3229 //-------------------------------------------------------------------------
3230 
3231 //-------------------------------------------------------------------------
3232 void
3234 DopplerSizeChanged(int iDopplerSize)
3235 {
3236  // delete previous doppler widget
3238  // set the new doppler step
3239  m_ImageProcessor->setDopplerSize(iDopplerSize);
3240  // update the image processor
3241  m_ImageProcessor->setDoppler(m_TCoord, 0); // 0 is for optimization later on...
3242  //rebuild navigation widget
3244  // build new image
3245  UpdateImage();
3246  //clean TF Editor
3248  //createTransferFunctionEditor(channel name)
3250  //update
3251  m_ImageView->Update();
3252  //update the trace editing widget
3254 }
3255 //-------------------------------------------------------------------------
3256 
3257 //-------------------------------------------------------------------------
3258 void
3261 {
3262  std::string channelname = iName.toStdString();
3263 
3264  // create editor
3265  // get LUT parameters (gamma, min, max)
3266  std::vector<int> lutParameters = m_ImageProcessor->getLUTParameters( channelname );
3267 
3270  m_ImageProcessor->getColor( channelname ),
3271  lutParameters,
3272  m_ImageProcessor->getImageBW( channelname )->GetScalarRange()[1],
3273  this );
3274  // connect signals
3275 
3276  QObject::connect( editor,
3277  SIGNAL( updateVisualization() ),
3278  this,
3279  SLOT( updateSlot()) );
3280 
3281  QObject::connect( editor,
3282  SIGNAL( UpdateImageStructure(QString,
3283  std::map< unsigned int, unsigned int>,
3284  QColor,
3285  int,
3286  int,
3287  int) ),
3288  this,
3289  SLOT( updatePoints(QString,
3290  std::map< unsigned int, unsigned int>,
3291  QColor,
3292  int,
3293  int,
3294  int)) );
3295 
3296  QObject::connect(this->m_ImageView, SIGNAL(NewWindowLevel(double, double)),
3297  this, SLOT(AdjustWindowLevel(double, double)));
3298 
3299  // show editor - to have consistent geomerty to add the points
3300  editor->show();
3301 
3302  // add points
3303  editor->AddPoints(m_ImageProcessor->getAlpha( channelname ));
3304 
3305  // add LUT
3306  editor->AddLookupTable( m_ImageProcessor->getLookuptable( channelname ) );
3307  // add Opacity TF
3309  m_ImageProcessor->getOpacityTransferFunction( channelname ) );
3310 
3311  // add histogram - should not recalculate all the time...
3312  editor->AddHistogram(m_ImageProcessor->getHistogram( channelname ) );
3313 
3314  // hide editor
3315  editor->hide();
3316 
3317  //editor->setParent(m_TransferFunctionDockWidget);
3319 }
3320 //-------------------------------------------------------------------------
3321 
3322 //-------------------------------------------------------------------------
3323 // color changed
3324 void
3326 {
3327  UpdateImage();
3329 
3330  m_ImageView->Update();
3331 }
3332 //-------------------------------------------------------------------------
3333 
3334 //-------------------------------------------------------------------------
3335 void
3338  std::map< unsigned int, unsigned int> iPoints,
3339  QColor iColor,
3340  int iMin,
3341  int iMax,
3342  int iGamma)
3343 {
3344  // update opacity TF points
3345  m_ImageProcessor->updatePoints(iName.toStdString(), iPoints);
3346 
3347  //color
3348  std::vector<double> color;
3349  color.push_back(iColor.redF()*255);
3350  color.push_back(iColor.greenF()*255);
3351  color.push_back(iColor.blueF()*255);
3352 
3353  m_ImageProcessor->setColor(iName.toStdString(), color);
3354 
3355  //LUT parameters
3356  m_ImageProcessor->setLUTParameters(iName.toStdString(), iGamma, iMin, iMax);
3357 
3358  // color of button in navigation widget
3359  m_NavigationDockWidget->ModifyChannel(iName, iColor);
3360 }
3361 //-------------------------------------------------------------------------
3362 
3363 //-------------------------------------------------------------------------
3364 void
3367 {
3368  if(iEnable)
3369  {
3370  m_VolumeRenderingEnabled = true;
3373  }
3374  else
3375  {
3376  m_VolumeRenderingEnabled = false;
3378  }
3379 }
3380 //-------------------------------------------------------------------------
3381 
3382 //-------------------------------------------------------------------------
3383 void
3386 {
3387  //check mode from print db
3388  std::list<unsigned int> tp = m_DataBaseTables->GetVisibleTimePoints();
3389 
3390  // load all tp
3391  if(tp.size() == 0)
3392  {
3393  unsigned int* time = m_ImageProcessor->getBoundsTime();
3394  for(unsigned int i = time[0]; i<time[1]+1; i++)
3395  {
3396  tp.push_back(i);
3397  }
3398  }
3399 
3401 }
3402 //-------------------------------------------------------------------------
3403 
3404 //-------------------------------------------------------------------------
3405 void
3407 CreateContoursActorsFromVisuContainer(std::list<unsigned int> iTPointToLoad)
3408 {
3409  typedef ContourContainer::MultiIndexContainerType::index< TCoord >::type::iterator
3410  ContourContainerTCoordIterator;
3411 
3412  if ( this->m_ContourContainer )
3413  {
3414  // load everything if no list given
3415  if ( !iTPointToLoad.empty() )
3416  {
3417  std::list<unsigned int>::const_iterator it = iTPointToLoad.begin();
3418  std::list<unsigned int>::const_iterator end = iTPointToLoad.end();
3419 
3420  while(it != end)
3421  {
3422  ContourContainerTCoordIterator it0, it1;
3423  // let's iterate on the container with increasing TraceID
3424  boost::tuples::tie(it0, it1)
3425  = this->m_ContourContainer->m_Container.get< TCoord >().equal_range(*it);
3426 
3427  // we don't need here to save this contour in the database,
3428  // since they have just been extracted from it!
3429  while ( it0 != it1 )
3430  {
3431  this->AddContourFromNodes< TCoord >( it0 );
3432  ++it0;
3433  }
3434  ++it;
3435  }
3436  }
3437  }
3438 }
3439 //-------------------------------------------------------------------------
3440 
3441 //-------------------------------------------------------------------------
3442 void
3445 {
3446  //check mode from print db
3447  std::list<unsigned int> tp = m_DataBaseTables->GetVisibleTimePoints();
3448 
3449  // load all tp
3450  if( tp.empty() )
3451  {
3452  unsigned int* time = m_ImageProcessor->getBoundsTime();
3453  for(unsigned int i = time[0]; i<time[1]+1; i++)
3454  {
3455  tp.push_back(i);
3456  }
3457  }
3458 
3460 }
3461 //-------------------------------------------------------------------------
3462 
3463 //-------------------------------------------------------------------------
3464 void
3466 CreateMeshesActorsFromVisuContainer(std::list<unsigned int> iTPointToLoad)
3467 {
3468  typedef MeshContainer::MultiIndexContainerType::index< TCoord >::type::iterator
3469  MeshContainerTCoordIterator;
3470 
3471  int lastTP = m_ImageProcessor->getBoundsTime()[1];
3472  std::stringstream lastTimePoint;
3473  lastTimePoint << lastTP;
3474 
3475  if( this->m_MeshContainer)
3476  {
3477  // load everything if no list given
3478  if ( !iTPointToLoad.empty() )
3479  {
3480  std::list<unsigned int>::const_iterator it = iTPointToLoad.begin();
3481  std::list<unsigned int>::const_iterator end = iTPointToLoad.end();
3482 
3483  while( it != end )
3484  {
3485  MeshContainerTCoordIterator it0, it1;
3486 
3487  boost::tuples::tie(it0, it1) =
3488  this->m_MeshContainer->m_Container.get< TCoord >().equal_range(*it);
3489 
3490  // progress bar
3491  int size = this->m_DataBaseTables->
3492  GetNumberOfElementForTraceAndTimePoint("mesh", *it);
3493  std::stringstream time;
3494  time << *it;
3495 
3496  QProgressDialog progress( QString::fromStdString("Loading Meshes from T=" + time.str() +"/" + lastTimePoint.str()),
3497  QString(),
3498  0,
3499  size);
3500  size_t i = 0;
3501  progress.setValue( i );
3502 
3503  std::vector< MeshContainerTCoordIterator > tempvector;
3504  while( it0 != it1 )
3505  {
3506  tempvector.push_back(it0);
3507  ++it0;
3508  }
3509 
3510  int numberOfMeshes = static_cast< int >( tempvector.size() );
3511 
3512  // we don't need here to save this mesh in the database,
3513  // since they have just been extracted from it!
3514  //while ( it0 != it1 )
3515 
3516 #ifdef HAS_OPENMP
3517 #pragma omp for
3518 #endif
3519  for( int i = 0; i < numberOfMeshes; i++ )
3520  {
3521  it0 = tempvector[i];
3522 
3523  if ( it0->Nodes )
3524  {
3525  // bug here, don't use TCoord
3526  GoFigureMeshAttributes attributes =
3527  this->ComputeMeshAttributes(
3528  it0->Nodes, // mesh
3529  false, // do not need to compute intensity based measure
3530  it0->TCoord
3531  );
3533  &attributes, it0->TraceID);
3534  }
3535  this->AddMeshFromNodes< TCoord >( it0 );
3536  //++it0;
3537 
3538  //++i;
3539  progress.setValue( i );
3540  }
3541 
3542  progress.setValue(size);
3543  ++it;
3544  }
3545  }
3546  }
3547 }
3548 //-------------------------------------------------------------------------
3549 
3550 //-------------------------------------------------------------------------
3551 void
3553 ShowTraces(const unsigned int& iTimePoint)
3554 {
3555  // only contours and meshes will be modified since tracks and lineage contain
3556  // several time points
3558  this->m_MeshContainer->ShowActorsWithGivenTimePoint(iTimePoint);
3559 }
3560 //-------------------------------------------------------------------------
3561 
3562 //-------------------------------------------------------------------------
3563 void
3565 AdjustWindowLevel(double iMin, double iMax)
3566 {
3568  // if one channel is checked
3569  // (if no channel selected, index == -1, we don't do anything)
3570  if(index >= 0)
3571  {
3574  dynamic_cast<GoTransferFunctionEditorWidget*>(
3575  this->m_TransferFunctionDockWidget->GetWidget(index));
3576  widget->AdjustWindowLevel(iMin, iMax);
3577  }
3578 }
3579 //------------------------------------------------------------------------------
3580 
3581 //------------------------------------------------------------------------------
3582 void
3585 {
3586  int NumberOfChannels = static_cast< int >( m_ImageProcessor->getNumberOfChannels() );
3587  int currentChannel = m_TransferFunctionDockWidget->GetCurrentWidget();
3588 
3589 #ifdef HAS_OPENMP
3590 #pragma omp for
3591 #endif
3592  for( int i = 0; i < NumberOfChannels; i++ )
3593  {
3594  std::string name = m_ImageProcessor->getChannelName(i);
3597  dynamic_cast<GoTransferFunctionEditorWidget*>(
3599 
3600  // update histogram
3601  widget->AddHistogram(m_ImageProcessor->getHistogram(name) );
3602 
3603  // update max value
3604  widget->SetMaximumValue(
3605  m_ImageProcessor->getImageBW(name)->GetScalarRange()[1]);
3606  }
3607 
3609 }
3610 //------------------------------------------------------------------------------
3611 
3612 //-------------------------------------------------------------------------
3613 void
3616 {
3617  std::list< vtkPolyData* > elements = this->m_MeshContainer-> GetHighlightedElements();
3618  emit RequestedPolydatas(elements);
3619 }
3620 //-------------------------------------------------------------------------
3621 
3622 //-------------------------------------------------------------------------
3623 void
3626  // move to next time point
3627  (void)new QShortcut(
3628  QKeySequence(
3629  tr("Ctrl+C", "Next Time Point")),
3630  this, SLOT(MoveToNextTimePoint()));
3631  (void)new QShortcut(
3632  QKeySequence(
3633  tr("Right Arrow", "Next Time Point")),
3634  this, SLOT(MoveToNextTimePoint()));
3635 
3636  // move to previous time point
3637  (void)new QShortcut(
3638  QKeySequence(
3639  tr("Ctrl+Z", "Previous Time Point")),
3640  this, SLOT(MoveToPreviousTimePoint()));
3641  (void)new QShortcut(
3642  QKeySequence(
3643  tr("Left Arrow", "Next Time Point")),
3644  this, SLOT(MoveToPreviousTimePoint()));
3645 
3646 }
3647 //-------------------------------------------------------------------------
3648 
3649 //-------------------------------------------------------------------------
3650 void
3653 {
3655 }
3656 //-------------------------------------------------------------------------
3657 
3658 //-------------------------------------------------------------------------
3659 void
3662 {
3664 }
3665 //-------------------------------------------------------------------------
3666 
3667 //-------------------------------------------------------------------------
3668 void
3671 {
3672  std::vector<int> time = m_ImageProcessor->getDopplerTime(m_TCoord);
3673 
3674  int N = static_cast< int >( m_ImageProcessor->getDopplerSize() );
3675 
3676 #ifdef HAS_OPENMP
3677 #pragma omp for
3678 #endif
3679  for(int i=0; i < N; ++i)
3680  {
3681  if(time[i]>=0)
3682  {
3683  std::string name = m_ImageProcessor->getChannelName(time[i]);
3685  }
3686  }
3687 }
3688 //-------------------------------------------------------------------------
vtkActor * GetCurrentActor()
manages all the database components: table widget, trace settings editing widdet, QGoDBTraceManager...
QAction * toggleViewAction()
void SplitInDBAndRenderMeshForVisu(std::vector< vtkPolyData * > iVectPolydata)
std::string toStdString() const
std::vector< vtkPoints * > m_Seeds
Abstract class for one tab element in GoFigure2.
unsigned int getTimeInterval() const
std::vector< vtkActor * > VisualizeTrace(vtkPolyData *iTrace, double *iRGBA)
QGoTabImageView3DwT(QWidget *parent=0)
Default Constructor.
void SetDatabaseContainersAndDelayedConnections()
give the adress for the contours, meshes and tracks container to the QGoPrintDatabase, and make the connection for the status bar once the database variables have been set for the QGoPrintDatabase
vtkProperty * m_HighlightedMeshesProperty
QString toNativeSeparators(const QString &pathName)
bool IsDatabaseUsed()
return a bool to know if the user is using the database or not
QString & append(QChar ch)
void ModeChanged(int iChannel)
void SetLSMReader(vtkLSMReader *iReader, const int &iTimePoint)
void setReader(vtkLSMReader *iReader)
Set the reader.
void setColor(const std::string &iName, std::vector< double > &iColor)
void EnableBoxWidget(bool)
Creates a box in 3d view to allow multiple meshes selection.
void ReEditContour(const unsigned int &iId)
void SetIntersectionLineWidth(const float &iWidth)
void SaveContour(vtkPolyData *contour, vtkPolyData *contour_nodes, int iTCoord)
itk::MegaCaptureReader::Pointer m_MegaCaptureReader
void setSeparator(bool b)
QString getItem(QWidget *parent, const QString &title, const QString &label, const QStringList &items, int current, bool editable, bool *ok, QFlags< Qt::WindowType > flags, QFlags< Qt::InputMethodHint > inputMethodHints)
void setRgbF(qreal r, qreal g, qreal b, qreal a)
virtual void SetImage(ImageType *iImage)
void setReader(itk::MegaCaptureReader::Pointer iReader)
Set the reader.
void SetZMinimumAndMaximum(const int &iMin, const int &iMax)
Set the extent of the images in the Z direction.
Specialization of GoImageProcessor to handle LSM files.
void UpdateElementVisibility(unsigned int iTraceID, bool iState)
Update highlighting property of one element given one actor.
void fill(const QColor &color)
void ManualInteractorBehavior(bool)
Mouse interaction style allows contours segmentation, according to the selected type of segmentation...
std::vector< vtkActor * > AddContour(vtkPolyData *dataset, vtkProperty *property=NULL)
std::vector< int > getDopplerTime(unsigned int iTime)
qreal redF() const
GoFigure::TabDimensionType GetTabDimensionType() const
void SaveInDBAndRenderSetOfContoursForVisu(std::vector< std::vector< vtkPolyData * > >, int)
void UpdateRenderWindows()
Update only the visualization.
void UpdateTracksStrings(const TList &iTrackList)
Update the points strings of the tracks for each element of the list { 1 -Add trackID to current elem...
QGoPrintDatabase::NamesDescrContainerType NamesDescrContainerType
std::list< QGoDockWidgetStatusPair > m_DockWidgetList
void InitializeTraceSettingsToolBar(QToolBar *iToolBar)
GoImageProcessor * m_ImageProcessor
void RequestedPolydatas(std::list< vtkPolyData * >)
void GetBackgroundColor(double &r, double &g, double &b)
Returns used background color by viewers.
void SeedInteractorBehavior(bool)
Mouse interaction style allows meshes segmentation, according to the selected type of segmentation...
unsigned int * getBoundsChannel()
QObject * sender() const
void UpdateBookmarkOpenActions(std::vector< QAction * >)
void setChecked(bool)
unsigned int getDopplerSize()
void SetXMinimumAndMaximum(const int &iMin, const int &iMax)
Set the extent of the images in the X direction.
void ReinitializeContourWidget()
unsigned int getNumberOfChannels()
GoFigureMeshAttributes ComputeMeshAttributes(vtkPolyData *iMesh, const bool &iIntensity, const unsigned int &iTCoord)
std::list< unsigned int > GetVisibleTimePoints()
void SetMegaCaptureFile(const GoFigureFileInfoHelperMultiIndexContainer &iContainer, const GoFigure::FileType &iFileType, const std::string &iHeader, const unsigned int &iTimePoint)
qreal blueF() const
void setIcon(const QIcon &icon)
void AddChannel(const QString &iName, const QColor &iColor, const unsigned int &iNumber, const bool &iChecked)
TrackContainer * m_TrackContainer
void addAction(QAction *action)
void PrintVolumeAreaForMesh(GoFigureMeshAttributes *iMeshAttributes, unsigned int iMeshID)
display in the table widget the volume and area from iMeshAttributes for iMeshID
virtual void setVisible(bool visible)
MultiIndexContainerType::template index< TraceID >::type::iterator MultiIndexContainerTraceIDIterator
QGoLineageViewDockWidget * m_LineageViewDockWidget
void setDopplerMode(const bool &iEnable, const unsigned int &iChannel)
std::map< unsigned int, unsigned int > getAlpha(const std::string &iName) const
get points to update r, g, b and a TFs in TF editor.
MultiIndexContainerType m_Container
Trace Contaienr.
GoFigureFileInfoHelperMultiIndexContainer m_FileList
bool RemoveElementFromVisualizationWithGivenTraceID(const unsigned int &iId)
Remove element from visualization.
QAction * addAction(QAction *action)
void setupUi(QWidget *parent)
void FullScreenViewChanged(int FullScreen)
vtkPolyData * GetContourRepresentationAsPolydata(int iDir)
std::vector< vtkActor * > AddContour(vtkPolyData *iDataset, vtkProperty *iProperty=NULL)
Add contour with given property into the visualization.
virtual void SetTSliceForDopplerView(QHash< QString, QColor > iListTimePoints, int iChannelNumber)
display the 3 timepoints chosen by the user in the TSlice comboboxes of the qgoalgomanagerwidgets, enable them, display only the channel tracked by the user and disable the channel comboboxes
void CreateMeshFromSelectedContours(std::list< unsigned int > ListContourIDs, int iMeshID)
virtual void SetPolyData(vtkPolyData *iMesh)
virtual void initTimePoint(const unsigned int &iTime)=0
load all the channels for the given time point into the GoMegaImageStructure
QGoPrintDatabase * m_DataBaseTables
manages a map with keys matching fields of the gofiguredatabase Coordinate table and values of the ma...
vtkSmartPointer< vtkImageData > getImageBW(const std::string &iName)
get raw (not colored) image given index
void PlaneWidgetInteractorBehavior(bool)
void SetTraceNameForTableWidget(std::string iTraceName)
update the traceSettingswidget for the trace with the corresponding list of collectionID and set the ...
std::string getChannelName(const unsigned int &iIndex)
get name of a channel given its index.
void EnableSeedWidget(bool iActivate)
Use the one click interactor style.
QString homePath()
QString tr(const char *sourceText, const char *disambiguation, int n)
void SliceViewYZChanged(int Slice)
unsigned int getNumberOfVisibleChannels()
get number of visible channels
void setChannelName(QString iChannelName)
int GetSliceViewYZ() const
void DefaultMode()
Use the default interactor style.
void GetSeeds(std::vector< vtkPoints * > &iPoints)
void MergeInDBAndRenderMeshForVisu(vtkPolyData *iVectPolydata)
GoFigure::FileType m_FileType
vtkPolyData * GetContourRepresentationNodePolydata(int iDir)
std::vector< vtkPiecewiseFunction * > getOpacityTransferFunctions()
get vector of visible opacity transfer functions. Useful for the transfer function editor while volum...
vtkViewImage2D * GetImageViewer(const int &iId)
std::vector< QAction * > m_VectorAction
void resize(int w, int h)
void SetSliceViewXZ(const int &)
void ShowTraces(const unsigned int &iTimePoint)
Show traces from container which are at the given time point. Only updates contours and meshes since ...
void retranslateUi(QWidget *parent)
const char * name() const
void InitializeToolsForTracesToolBar(QMenu *iMenu, QToolBar *iToolBar)
void setValue(int progress)
void AddBookmark(int iXCoord, int iYCoord, int iZCoord, int iTCoord)
void AddLookupTable(vtkLookupTable *iLUT)
Add LUT to the GoTransferFunctionEditorWidget.
unsigned int SaveNewContourForMeshToContours(unsigned int iXCoordMin, unsigned int iYCoordMin, unsigned int iZCoordMin, unsigned int iXCoordMax, unsigned int iYCoordMax, unsigned int iZCoordMax, vtkPolyData *iTraceNodes)
save a new contour in the database, the TW and the container for the contours to sphere action ...
vtkProperty * m_HighlightedContoursProperty
void setEnabled(bool)
QString number(int n, int base)
void VisibilityListChannels(const bool &iVisibility)
QString fromStdString(const std::string &str)
void setLUTParameters(const std::string &iName, int iGamma, int iMin, int iMax)
void CreateMeshEditingDockWidget(int iTimeMin, int iTimeMax)
void EnableDistanceWidget(bool iEnable)
void SaveMeshFromVisuInDB(unsigned int iXCoordMin, unsigned int iYCoordMin, unsigned int iZCoordMin, unsigned int iXCoordMax, unsigned int iYCoordMax, unsigned int iZCoordMax, int iTCoord, vtkPolyData *iMeshNodes, GoFigureMeshAttributes *iMeshAttributes, int iTrackID=-1)
save the mesh into the database for a mesh generated in the visualization, if the mesh is an updated ...
void UpdateElementHighlighting(unsigned int TraceId)
Update highlighting property of one element given one actor.
QString fromUtf8(const char *str, int size)
std::vector< QString > GetChannelNames()
class for the visualization of 3D Image represented by one vtkImageData*.
MeshContainer * m_MeshContainer
int GetFullScreenView() const
std::vector< vtkImageData * > getColoredImages()
get all the visible images colored separately (N images).
QGoTraceSettingsWidget * GetTraceSettingsWidget()
return the TraceSettingsDockWidget
void TimePointChanged(int TimePoint)
void SaveAndVisuMesh(vtkPolyData *iView, unsigned int iTCoord, int iCollection=-1)
Save a mesh in the database and render the mesh at the given time point.
virtual void CreateModeToolBar(QMenu *iMenu, QToolBar *iToolBar)
void AddDoppler(const QString &iName, const QColor &iColor, const unsigned int &iNumber, const bool &iChecked)
void ShowActorsWithGivenTimePoint(const unsigned int &iT)
Display all elements for a given time point.
QString SnapshotViewXYZ(const GoFigure::FileType &iType, const QString &iBaseName=QString("snapshot-xyz-"))
QVTKInteractor * GetInteractor(const int &)
Returns the interactor for one given view.
void AddPoints(const std::map< unsigned int, unsigned int > &iPoints)
Add points to both LUT and Opacity transfer function.
int toInt(bool *ok, int base) const
void ActorPickingInteractorBehavior(bool)
Mouse interaction style allows user to pick contours.
Wraps a boost::multi_index_container of ContourMeshStructure. This class is specialized for the means...
void setObjectName(const QString &name)
std::vector< int > getLUTParameters(const std::string &iName)
void ImportContours()
get the info from a textfile, save it into the database, update the container for visu and the TW ...
void SaveInDBAndRenderContourForVisu(std::vector< vtkPolyData * > iVectPolydata, int iTCoord)
void SetTheContainersForDB()
give the adress for the contours, meshes and tracks container to the QGoPrintDatabase ...
std::vector< int > ImportTracks()
get the info from a textfile, save it into the database, update the container for visu and the TW and...
qreal greenF() const
virtual void ReadSettings()
Read Settings for the related tab element.
virtual void ZoomInteractorBehavior(bool)
Mouse interaction style allows user to zoom in/out volume with all buttons.
void setOverrideCursor(const QCursor &cursor)
QGoLineageViewerWidget * m_QGoLineageViewerWidget
void SetYMinimumAndMaximum(const int &iMin, const int &iMax)
Set the extent of the images in the Y direction.
QGoNavigationDockWidget * m_NavigationDockWidget
void restoreOverrideCursor()
void addPixmap(const QPixmap &pixmap, Mode mode, State state)
void EnableVolumeRendering(const std::vector< vtkImageData * > &iImages, const std::vector< vtkPiecewiseFunction * > &iOpacities)
Creates a box in 3d view to allow multiple meshes selection.
QGoTransferFunctionDockWidget * m_TransferFunctionDockWidget
void setCentralWidget(QWidget *widget)
void setDopplerStep(unsigned int iStep)
void AdjustWindowLevel(double iMin, double iMax)
Adjust window/level between the input values. LUT (using the gamma value) will be calculated between ...
std::vector< QAction * > m_ToolsActions
void AddTransferFunction(QString iName, GoTransferFunctionEditorWidget *iTF)
boost::unordered_map< std::string, double > m_MeanIntensityMap
void hide()
Dock Widget for browsing images (changing slice, time point...)
void updatePoints(QString, std::map< unsigned int, unsigned int >, QColor, int, int, int)
void DopplerSizeChanged(int iSize)
void createTransferFunctionEditor(QString iName)
void InitializeContourWidgetNodes(int iDir, vtkPolyData *iNodes)
void setDopplerSize(int iSize)
void SaveInDBAndRenderMeshForVisu(std::vector< vtkPolyData * > iVectPolydata, int iTCoord)
Save a mesh in the database and render the mesh. at the current time point.
void SetReeditMode(bool iReeditMode)
Set the reedit mode.
void ModifyChannel(QString iName, QColor iColor)
LineageContainer * m_LineageContainer
void SetSliceViewYZ(const int &)
void visibilityChanged(QString iName, bool iVisibility)
void SetTMinimumAndMaximum(const int &iMin, const int &iMax)
Set the extent of the images in the Time.
QString SnapshotViewYZ(const GoFigure::FileType &iType, const QString &iBaseName=QString("snapshot-yz"))
void SaveContoursFromVisuInDB(unsigned int iXCoordMin, unsigned int iYCoordMin, unsigned int iZCoordMin, unsigned int iTCoord, unsigned int iXCoordMax, unsigned int iYCoordMax, unsigned int iZCoordMax, vtkPolyData *iContourNodes)
save a new contour from the visu into the database, update the table widget and the CurrentElement of...
bool blockSignals(bool block)
Wraps a boost multi index container of LineageStructure. This class intends to synchronize Lineage re...
void SliceViewXZChanged(int Slice)
void SetContoursContainer(ContourContainer *iContoursContainer)
set the pointer m_TraceInfoForVisu of the ContoursManager to iContoursContainer
void SliceViewXYChanged(int Slice)
virtual void DefaultInteractorBehavior(bool)
Mouse interaction style set as default.
void setShortcut(const QKeySequence &shortcut)
Specialization of GoImageProcessor to handle mega capture files.
QColor getColor(const QColor &initial, QWidget *parent, const QString &title, QFlags< QColorDialog::ColorDialogOption > options)
virtual void AddActor(const int &iId, vtkActor *iActor)
std::list< QGoToolBarStatus * > m_ToolBarList
void setCheckable(bool)
void SaveMesh(vtkPolyData *iMesh, int iTCoord, int iCollectionID=-1)
Save mesh in Database.
unsigned int getDopplerChannel()
QString SnapshotViewXY(const GoFigure::FileType &iType, const QString &iBaseName=QString("snapshot-xy-"))
std::vector< QAction * > m_ViewNoToolBarActions
int GetSliceViewXZ() const
virtual void setTimePoint(const unsigned int &iTime)=0
update images from the current GoMegaImageStructure
virtual void SetImage(vtkImageData *iImage)
Set the image to displaid.
void ActorPickingMode()
switch to contour picking mode
int * GetImageCoordinatesFromWorldCoordinates(double pos[3])
void SetFullScreenView(const int &iS)
void EnableVolumeRendering(bool iEnable)
QGoTraceSettingsWidget * GetTraceSettingsWidgetForToolBar()
void SetTSliceForDopplerView(QHash< QString, QColor > iListTimePoints, int iChannelNumber)
display the 3 timepoints chosen by the user in the TSlice comboboxes of the qgoalgomanagerwidgets, enable them, display only the channel tracked by the user and disable the channel comboboxes
void SetLineagesContainers(LineageContainer *iContainer, TrackContainer *iTrackContainer)
set the pointer m_LineageInfoForVisu of the LineagesManager to iContainer
std::vector< double > getColor(const std::string &iName) const
get color from channel name.
void CreateContourEditingDockWidget(int iTimeMin, int iTimeMax)
GoDBCoordinateRow GetCoordinateForBookmark(std::string iName)
void SetTraceSettingsToolBarVisible(bool IsVisible)
slot connected to the toggleaction of the TW, the contour and mesh editing, update the trace and coll...
virtual void SetLookupTable(vtkLookupTable *)
void setStatusTip(const QString &statusTip)
int * GetImageCoordinatesFromWorldCoordinates(double pos[3])
Get Image Coordinates from World Coordinates.
void DisableVolumeRendering()
void GoToDefaultMenu(bool iEnable=false)
QAction * toggleViewAction() const
void PanMode()
Use the pan interactor style.
MultiIndexContainerElementType m_CurrentElement
Current Element of the trace type.
void SetHighlightedProperty(vtkProperty *iProperty)
Set property whenever the trace is highlighted.
vtkSmartPointer< vtkImageData > getVisibleImages()
get all the -visible- images present in the containerl. Colors the image and combuine them into 1 ima...
void AddHistogram(vtkImageAccumulate *iHistogram)
1- Add Histogram to the GoTransferFunctionEditorWidget 2- Convert it to QVector<qreal> 3- Add it to t...
virtual void setDoppler(const unsigned int &iTime, const unsigned int &iPrevious)=0
load all time points of the given channel into the GoMegaImageStructure. Called Doppler View...
Wraps a boost::multi_index_container of ContourMeshStructure. This class is specialized for the means...
Definition: MeshContainer.h:46
QString SnapshotViewXZ(GoFigure::FileType iType, QString BaseName=QString("snapshot-xz-"))
QStatusBar * m_StatusBar
void ImportMeshes()
get the info from a textfile, save it into the database, update the container for visu and the TW ...
void GoToRealLocation(double iX, double iY, double iZ, int iT)
void visibilityChanged(std::string iName, bool iVisibility)
change visibility of one channel given its name.
void SetTimePoint(const int &)
QString SnapshotViewXZ(const GoFigure::FileType &iType, const QString &iBaseName=QString("snapshot-xz-"))
virtual vtkRenderWindowInteractor * GetInteractor()
Wraps a boost multi index container of TrackStructure. This class intends to synchronize Track repres...
void EnablePlaneWidget(bool)
Creates a box in 3d view to allow multiple meshes selection.
void setWindowTitle(const QString &)
std::vector< QAction * > m_ViewActions
void UpdateElementHighlighting(const unsigned int &TraceId)
Update highlighting property of one element given one actor.
void SetIntersectionLineWidth(const float &iWidth)
void updatePoints(std::string iChannel, std::map< unsigned int, unsigned int > iPointsAlpha)
store points from TF editor
boost::multi_index::multi_index_container< GoFigureFileInfoHelper, boost::multi_index::indexed_by< boost::multi_index::ordered_non_unique< boost::multi_index::tag< m_PCoord >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< m_RCoord >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< m_CCoord >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< m_XTileCoord >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< m_YTileCoord >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< m_ZTileCoord >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< m_ZCoord >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< m_Channel >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< m_TCoord >, > >> GoFigureFileInfoHelperMultiIndexContainer
QString SnapshotViewXY(GoFigure::FileType iType, QString iBaseName=QString("snapshot-xy-"))
void SetTSliceForClassicView()
display only the current timepoint in the TSlice comboboxes of the qgoalgomanagerwidgets, disable them and enable the channel comboboxes
QGoMeshEditingWidgetManager * m_MeshEditingWidget
void addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget)
void EnableContourWidget(bool iActivate)
void AdjustWindowLevel(double iMin, double iMax)
Dock Widget for browsing images (changing slice, time point...)
QString SnapshotViewYZ(GoFigure::FileType iType, QString iBaseName=QString("snapshot-yz-"))
vtkSmartPointer< vtkImageAccumulate > getHistogram(const std::string &iName) const
get histogram from 1 channel image
StandardButton warning(QWidget *parent, const QString &title, const QString &text, QFlags< QMessageBox::StandardButton > buttons, StandardButton defaultButton)
void SetIntensityBasedComputation(const bool &iComputation)
virtual void SetTSliceForClassicView()
display only the current timepoint in the TSlice comboboxes of the qgoalgomanagerwidgets, disable them and enable the channel comboboxes
QAction * menuAction() const
QString SnapshotViewXYZ(GoFigure::FileType iType, QString iBaseName=QString("snapshot-xyz-"))
void show()
void SetTracksContainer(TrackContainer *iContainer)
set the pointer m_TrackInfoForVisu of the TracksManager to iTracksContainer
void EnableAngleWidget(bool iActive)
void UpdateTracesEditingWidget()
depending on the doppler/classic mode, update the TimePoints and channels of the mesh and contour wid...
unsigned int * getBoundsTime()
int GetNumberOfImageViewers()
void CreateContour(vtkPolyData *contour_nodes, vtkPolyData *iView)
void GoToLocation(int iX, int iY, int iZ, int iT)
QGoTraceSettingsWidget * m_TraceSettingsWidget
void UpdateCollectionHighlighting(const unsigned int &iTraceId)
void AddOpacityTransferFunction(vtkPiecewiseFunction *iOpacity)
Add pointer to the opacity TF for a direct access.
void AngleWidgetInteractorBehavior(bool)
QGoContourEditingWidgetManager * m_ContourEditingWidget
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void DistanceWidgetInteractorBehavior(bool)
vtkSmartPointer< vtkPiecewiseFunction > getOpacityTransferFunction(const std::string &iName) const
get opacity from channel name. Useful for the transfer function editor while volume rendering...
std::vector< QAction * > m_BookmarkActions
int GetSliceViewXY() const
void ZoomMode()
Use the zoom interactor style.
void SetBackgroundColor(const double &r, const double &g, const double &b)
Set background color for all views.
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
void StartDopplerView()
access to the megacapture reader to get the entity of interest images through time. updates the navigation widget.
NamesDescrContainerType GetListBookmarks()
void CreateModeToolBar(QMenu *iMenu, QToolBar *iToolBar)
boost::unordered_map< std::string, int > m_TotalIntensityMap
void AddContourForMeshToContours(vtkPolyData *)
void UpdateCurrentElementFromVisu(std::vector< vtkActor * > &iActors, vtkPolyData *iNodes, const unsigned int &iT, const bool &iHighlighted, const bool &iVisible)
Update Current Element by providing all required informations from the visualization.
void AddTraceIDIntoPolydata(vtkPolyData *iPolydata, unsigned int iTraceID, const char *iTrace)
void SetSliceViewXY(const int &)
virtual void TranslateInteractorBehavior(bool)
Mouse interaction style allows user to Translate volume with all buttons.
void ValidateContour(int iTCoord)
void setEnabled(bool)
void connectSlotsByName(QObject *object)
std::string GetMapValue(const std::string &key)
return the value for the field map[key] after having removed the " at the beginning and at the end of...
Definition: GoDBRow.cxx:174
ContourContainer * m_ContourContainer
void UpdateElementVisibility(const unsigned int &iTraceID, const bool &iState)
Update highlighting property of one element given one actor.
QGoTrackViewDockWidget * m_TrackViewDockWidget
int SaveAndVisuContour(int iTCoord, vtkPolyData *iView=NULL)
bool NeedTraceSettingsToolBarVisible()
check if the tracesettingsWidget is visible, if not, return true.
QGoToolBarStatus * m_ModeToolBar
std::vector< int > GetBoundingBox(vtkPolyData *contour)
virtual ~QGoTabImageView3DwT()
Destructor.
QGoImageView3D * m_ImageView
void SetMeshesContainer(MeshContainer *iMeshesContainer)
set the pointer m_TraceInfoForVisu of the MeshesManager to iMeshesContainer
vtkSmartPointer< vtkLookupTable > getLookuptable(const std::string &iName) const
get LUT from channel name. Useful for the Transfer function editor.
void InsertCurrentElement()
Insert Current Element in the container.