vvToolSimpleInputSelectorWidget
vvToolInputSelectorWidget
vvRegisterForm
+ vvWipeImage
)
# All others sources
--- /dev/null
+#ifdef CLITK_PRIVATE_FEATURES
+#define EXTENSIONS "Images ( *.bmp *.dcm *.png *.jpeg *.jpg *.tif *.mhd *.mha *.hdr *.vox *.his *.xdr *.SCAN *.nii *.nrrd *.nhdr *.refscan *.nii.gz *.usf *.svl)"
+#else
+#define EXTENSIONS "Images ( *.bmp *.dcm *.png *.jpeg *.jpg *.tif *.mhd *.mha *.hdr *.vox *.his *.xdr *.SCAN *.nii *.nrrd *.nhdr *.refscan *.nii.gz)"
+#endif
<addaction name="actionAdd_overlay_image_to_current_image"/>
<addaction name="actionAdd_fusion_image"/>
<addaction name="actionAdd_USSequence_toCT"/>
+ <addaction name="actionAdd_wipe_image"/>
</widget>
<widget class="QMenu" name="menuScreenshots">
<property name="title">
<bool>true</bool>
</property>
</action>
+ <action name="actionAdd_wipe_image">
+ <property name="icon">
+ <iconset resource="../vvIcons.qrc">
+ <normaloff>:/common/icons/wipe.png</normaloff>:/common/icons/wipe.png</iconset>
+ </property>
+ <property name="text">
+ <string>Add wipe Image</string>
+ </property>
+ <property name="iconVisibleInMenu">
+ <bool>true</bool>
+ </property>
+ </action>
<action name="actionConnect_Pacs">
<property name="text">
<string>Connect Pacs</string>
</property>
</action>
+ </property>
+ </action>
</widget>
<customwidgets>
<customwidget>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>vvWipeImage</class>
+ <widget class="QWidget" name="vvWipeImage">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>314</width>
+ <height>197</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Wipe image</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="2" column="2">
+ <widget class="vvIntensityValueSlider" name="mThresholdSlider2" native="true">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Foreground (FG) is greater than : </string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="vvIntensityValueSlider" name="mThresholdSlider1" native="true"/>
+ </item>
+ <item row="2" column="1">
+ <widget class="QRadioButton" name="mRadioButtonLowerThan">
+ <property name="text">
+ <string>and lower than</string>
+ </property>
+ <property name="autoExclusive">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="Line" name="line_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Resulting wipe image:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <widget class="QCheckBox" name="mCheckBoxUseFG">
+ <property name="text">
+ <string>Use FG</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="vvIntensityValueSlider" name="mFGSlider" native="true">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <item>
+ <widget class="QCheckBox" name="mCheckBoxUseBG">
+ <property name="text">
+ <string>Use BG</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="vvIntensityValueSlider" name="mBGSlider" native="true"/>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="Line" name="line_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="mCheckBoxInteractiveDisplay">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Interactive (unchek to disable on the fly contours drawing)</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>vvIntensityValueSlider</class>
+ <extends>QWidget</extends>
+ <header>vvIntensityValueSlider.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>mRadioButtonLowerThan</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>mThresholdSlider2</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>85</x>
+ <y>129</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>305</x>
+ <y>129</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>mCheckBoxUseBG</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>mBGSlider</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>79</x>
+ <y>203</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>395</x>
+ <y>225</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>mCheckBoxUseFG</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>mFGSlider</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>63</x>
+ <y>177</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>242</x>
+ <y>177</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
<file>icons/standardbutton-apply-16.png</file>
<file>icons/standardbutton-cancel-16.png</file>
<file>icons/identity.png</file>
+ <file>icons/wipe.png</file>
<file>icons/basket_download.png</file>
<file>icons/edit.png</file>
<file>icons/bullet_info.png</file>
#define COLUMN_RELOAD_IMAGE 6
#define COLUMN_IMAGE_NAME 7
-#ifdef CLITK_PRIVATE_FEATURES
-#define EXTENSIONS "Images ( *.bmp *.dcm *.png *.jpeg *.jpg *.tif *.mhd *.mha *.hdr *.vox *.his *.xdr *.SCAN *.nii *.nrrd *.nhdr *.refscan *.nii.gz *.usf *.svl)"
-#else
-#define EXTENSIONS "Images ( *.bmp *.dcm *.png *.jpeg *.jpg *.tif *.mhd *.mha *.hdr *.vox *.his *.xdr *.SCAN *.nii *.nrrd *.nhdr *.refscan *.nii.gz)"
-#endif
+#include <extensions.h>
/*Data Tree values
contextActions.push_back(actionAdd_USSequence_toCT);
#endif
+ contextMenu.addAction(actionAdd_wipe_image);
+ contextActions.push_back(actionAdd_wipe_image);
+
contextMenu.addSeparator();
QAction* actionResetMatrix = contextMenu.addAction(QIcon(QString::fromUtf8(":/common/icons/identity.png")),
actionAdd_VF_to_current_Image->setEnabled(0);
actionAdd_fusion_image->setEnabled(0);
actionAdd_USSequence_toCT->setEnabled(0);
+ actionAdd_wipe_image->setEnabled(0);
//init the sliders
verticalSliders.push_back(NOVerticalSlider);
connect(actionRead_saved_state,SIGNAL(triggered()),this,SLOT(ReadSavedState()));
connect(actionExit,SIGNAL(triggered()),this,SLOT(close()));
connect(actionAdd_VF_to_current_Image,SIGNAL(triggered()),this,SLOT(OpenField()));
+ connect(actionAdd_wipe_image,SIGNAL(triggered()),this,SLOT(SelectWipeImage()));
connect(actionAdd_fusion_image,SIGNAL(triggered()),this,SLOT(SelectFusionImage()));
connect(actionAdd_overlay_image_to_current_image,SIGNAL(triggered()), this,SLOT(SelectOverlayImage()));
connect(actionAdd_USSequence_toCT,SIGNAL(triggered()), this,SLOT(SelectFusionSequence()));
actionSave_As->setEnabled(1);
actionAdd_VF_to_current_Image->setEnabled(1);
actionAdd_fusion_image->setEnabled(1);
+ actionAdd_wipe_image->setEnabled(1);
actionAdd_overlay_image_to_current_image->setEnabled(1);
actionAdd_USSequence_toCT->setEnabled(1);
actionNorth_East_Window->setEnabled(1);
}
//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+void vvMainWindow::SelectWipeImage()
+{
+ int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
+
+
+ if (!(CheckAddedImage(index, "wipe")))
+ return;
+
+ vvWipeImage::Pointer wipeImage = vvWipeImage::New();
+ wipeImage->Initialize(mInputPathName, mSlicerManagers);
+ wipeImage->selectWipeImage(index, GetTree());
+ QTreeWidgetItem *item = DataTree->itemAt(index, COLUMN_CLOSE_IMAGE);
+ //connect(item,SIGNAL(clickedInto(QTreeWidgetItem*, int)), this,SLOT(CloseImage(QTreeWidgetItem*, int)));
+ UpdateTree();
+ ImageInfoChanged();
+ for(int i=0; i<4; i++)
+ DisplaySliders(index, i);
+ WindowLevelChanged();
+
+ /*QString Extensions = EXTENSIONS;
+ Extensions += ";;All Files (*)";
+ QStringList files = QFileDialog::getOpenFileNames(this,tr("Load Wipe image"),mInputPathName,Extensions);
+ if (files.isEmpty())
+ return;
+
+ std::vector<std::string> vecFileNames;
+ for (int i = 0; i < files.size(); i++) {
+ vecFileNames.push_back(files[i].toStdString());
+ }*/
+
+ //AddWipeImage(index,vecFileNames,vvImageReader::IMAGE);
+}
+//------------------------------------------------------------------------------
+
+
//------------------------------------------------------------------------------
void vvMainWindow::SelectFusionImage()
{
#include "vvToolManager.h"
#include "vvImageReader.h"
#include "vvMesh.h"
+#include "vvWipeImage.h"
#include "clitkMemoryUsage.h"
#include "vtkSmartPointer.h"
void ReloadImage();
void OpenField();
void SelectOverlayImage();
+ void SelectWipeImage();
void SelectFusionImage();
//select the file(s) from the disk containing the image sequence to fuse
void SelectFusionSequence();
void UpdateMemoryUsage();
void show();
+ static vvMainWindow* Instance(){return mSingleton;}
+
protected:
void createRecentlyOpenedFilesMenu();
vvHelpDialog *help_dialog;
vvDocumentation *documentation;
vvDicomSeriesSelector *dicomSeriesSelector;
+
+ vvWipeImage::Pointer mWipeImage;
#if CLITK_USE_PACS_CONNECTION
vvQPacsConnection *PacsConnection;
// vvMainWindowToolInfo * mCurrentToolInfo;
// std::vector<vvToolCreatorBase*> mListOfRunningTool;
- static vvMainWindow * mSingleton;
+ static vvMainWindow* mSingleton;
int mCurrentTime;
--- /dev/null
+/*=========================================================================
+ Program: vv http://www.creatis.insa-lyon.fr/rio/vv
+
+ Authors belong to:
+ - University of LYON http://www.universite-lyon.fr/
+ - Léon Bérard cancer center http://www.centreleonberard.fr
+ - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the copyright notices for more information.
+
+ It is distributed under dual licence
+
+ - BSD See included LICENSE.txt file
+ - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+
+// vv
+#include "vvWipeImage.h"
+#include "vvSlicer.h"
+#include "vvMainWindow.h"
+
+// clitk
+#include "clitkCropImage_ggo.h"
+#include "clitkCropImageGenericFilter.h"
+#include "clitkExceptionObject.h"
+
+// qt
+#include <QComboBox>
+#include <QCursor>
+#include <QApplication>
+#include <QMessageBox>
+#include <QSignalMapper>
+#include <QFileDialog>
+
+// vtk
+#include <vtkVersion.h>
+#include <vtkStreamingDemandDrivenPipeline.h>
+#include <vtkInformation.h>
+#include <vtkImageData.h>
+#include <vtkSmartPointer.h>
+
+
+#include <extensions.h>
+
+#define COLUMN_TREE 0
+#define COLUMN_UL_VIEW 1
+#define COLUMN_UR_VIEW 2
+#define COLUMN_DL_VIEW 3
+#define COLUMN_DR_VIEW 4
+#define COLUMN_CLOSE_IMAGE 5
+#define COLUMN_RELOAD_IMAGE 6
+#define COLUMN_IMAGE_NAME 7
+
+//------------------------------------------------------------------------------
+vvWipeImage::vvWipeImage():
+ Ui::vvWipeImage()
+{
+ vtkSmartPointer<vtkImageRectilinearWipe> mWipe = vtkSmartPointer<vtkImageRectilinearWipe>::New();
+ mWipe->SetWipe(0);
+ mWipe->SetPosition(256,256);
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+vvWipeImage::~vvWipeImage()
+{
+}
+//------------------------------------------------------------------------------
+
+void vvWipeImage::Initialize(QString inputPathName, std::vector<vvSlicerManager*> slicerManagers)
+{
+ mInputPathName = inputPathName;
+ mSlicerManagers = slicerManagers;
+}
+
+//------------------------------------------------------------------------------
+void vvWipeImage::setInputImage(int number, vvImage::Pointer image)
+{
+ if (image->GetVTKImages().size()) {
+ mImage = image;
+ mWipe->SetInputData(number, mImage->GetVTKImages()[0]); //[0] pour du 4D ?
+ }
+}
+//------------------------------------------------------------------------------
+
+
+
+//------------------------------------------------------------------------------
+void vvWipeImage::crossPointerChanged()
+{
+ mWipe->SetPosition(256,256);
+ UpdateWipe();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvWipeImage::UpdateWipe()
+{
+
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvWipeImage::selectWipeImage(int index, QTreeWidget* DataTree)
+{
+
+ QString Extensions = EXTENSIONS;
+ Extensions += ";;All Files (*)";
+ QStringList files = QFileDialog::getOpenFileNames(NULL,tr("Load Wipe image"),mInputPathName,Extensions);
+ if (files.isEmpty())
+ return;
+
+ std::vector<std::string> vecFileNames;
+ for (int i = 0; i < files.size(); i++) {
+ vecFileNames.push_back(files[i].toStdString());
+ }
+
+ AddWipeImage(index,vecFileNames,vvImageReader::IMAGE, DataTree);
+}
+//------------------------------------------------------------------------------
+
+void vvWipeImage::AddWipeImage(int index, std::vector<std::string> fileNames, vvImageReader::LoadedImageType type, QTreeWidget* DataTree)
+{
+ QString file(fileNames[0].c_str());
+ if (QFile::exists(file))
+ {
+ mInputPathName = itksys::SystemTools::GetFilenamePath(file.toStdString()).c_str();
+ itk::ImageIOBase::Pointer reader = itk::ImageIOFactory::CreateImageIO(
+ file.toStdString().c_str(), itk::ImageIOFactory::ReadMode);
+ reader->SetFileName(fileNames[0].c_str());
+ reader->ReadImageInformation();
+ std::string component = reader->GetComponentTypeAsString(reader->GetComponentType());
+ int dimension = reader->GetNumberOfDimensions();
+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
+ vvProgressDialog progress("Opening " + file.toStdString());
+ qApp->processEvents();
+
+ std::string filename = itksys::SystemTools::GetFilenameWithoutExtension(file.toStdString()).c_str();
+// if (mSlicerManagers[index]->SetOverlay(fileNames,dimension, component,type)) {
+ //create an item in the tree with good settings
+ QTreeWidgetItem *item = new QTreeWidgetItem();
+ item->setData(0,Qt::UserRole,file.toStdString().c_str());
+ item->setData(1,Qt::UserRole,tr("wipe"));
+ QFileInfo fileinfo(file); //Do not show the path
+ item->setData(COLUMN_IMAGE_NAME,Qt::DisplayRole,fileinfo.fileName());
+ item->setToolTip(COLUMN_IMAGE_NAME, mSlicerManagers[index]->GetListOfAbsoluteFilePathInOneString("wipe").c_str());
+ qApp->processEvents();
+#if VTK_MAJOR_VERSION > 5
+ for ( unsigned int i = 0; i < mSlicerManagers[index]->GetNumberOfSlicers(); i++)
+ mSlicerManagers[index]->GetSlicer(i)->ForceUpdateDisplayExtent();
+#endif
+
+ for (int j = 1; j <= 4; j++) {
+ item->setData(j,Qt::CheckStateRole,DataTree->topLevelItem(index)->data(j,Qt::CheckStateRole));
+ }
+
+ //Create the buttons for reload and close
+ qApp->processEvents();
+ QTreePushButton* cButton = new QTreePushButton;
+ cButton->setItem(item);
+ cButton->setColumn(COLUMN_CLOSE_IMAGE);
+ cButton->setToolTip(tr("close image"));
+ cButton->setIcon(QIcon(QString::fromUtf8(":/common/icons/exit.png")));
+ connect(cButton,SIGNAL(clickedInto(QTreeWidgetItem*, int)),
+ vvMainWindow::Instance(),SLOT(CloseImage(QTreeWidgetItem*, int)));
+
+ QTreePushButton* rButton = new QTreePushButton;
+ rButton->setItem(item);
+ rButton->setColumn(COLUMN_RELOAD_IMAGE);
+ rButton->setToolTip(tr("reload image"));
+ rButton->setIcon(QIcon(QString::fromUtf8(":/common/icons/rotateright.png")));
+ //connect(rButton,SIGNAL(clickedInto(QTreeWidgetItem*, int)),
+ // this,SLOT(ReloadImage(QTreeWidgetItem*, int)));
+
+ DataTree->topLevelItem(index)->setExpanded(1);
+ DataTree->topLevelItem(index)->addChild(item);
+ DataTree->setItemWidget(item, COLUMN_CLOSE_IMAGE, cButton);
+ DataTree->setItemWidget(item, COLUMN_RELOAD_IMAGE, rButton);
+
+ //set the id of the image
+ QString id = DataTree->topLevelItem(index)->data(COLUMN_IMAGE_NAME,Qt::UserRole).toString();
+ item->setData(COLUMN_IMAGE_NAME,Qt::UserRole,id.toStdString().c_str());
+ //UpdateTree(DataTree);
+ qApp->processEvents();
+ //ImageInfoChanged();
+ QApplication::restoreOverrideCursor();
+
+ // Update the display to update, e.g., the sliders
+// for(int i=0; i<4; i++)
+// DisplaySliders(index, i);
+/* } else {
+ QApplication::restoreOverrideCursor();
+ QString error = "Cannot import the new image.\n";
+ error += mSlicerManagers[index]->GetLastError().c_str();
+ QMessageBox::information(this,tr("Problem reading image !"),error);
+ } */
+ //WindowLevelChanged();
+ }
+ else
+ QMessageBox::information(NULL,tr("Problem reading wipe Image !"),"File doesn't exist!");
+}
+//------------------------------------------------------------------------------
+
+
--- /dev/null
+/*=========================================================================
+ Program: vv http://www.creatis.insa-lyon.fr/rio/vv
+
+ Authors belong to:
+ - University of LYON http://www.universite-lyon.fr/
+ - Léon Bérard cancer center http://www.centreleonberard.fr
+ - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the copyright notices for more information.
+
+ It is distributed under dual licence
+
+ - BSD See included LICENSE.txt file
+ - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+#ifndef VVWIPEIMAGE_H
+#define VVWIPEIMAGE_H
+
+//qt
+#include <QtGlobal>
+#include <QtDesigner/QDesignerExportWidget>
+#include <QDialog>
+#include <QSlider>
+#include <QMessageBox>
+#include "QTreePushButton.h"
+// vv
+#include "vvImage.h"
+#include "vvImageReader.h"
+#include "vvProgressDialog.h"
+#include "vvSlicerManager.h"
+#include "ui_vvWipeImage.h"
+//vtk
+#include <vtkTransform.h>
+#include <vtkImageRectilinearWipe.h>
+//itk
+#include <itkLightObject.h>
+
+//------------------------------------------------------------------------------
+class vvWipeImage:
+ public QObject,
+ public itk::LightObject,
+ private Ui::vvWipeImage
+{
+ Q_OBJECT
+ public:
+
+ typedef vvWipeImage Self;
+ typedef itk::SmartPointer<Self> Pointer;
+ typedef itk::ProcessObject::Pointer ConverterPointer;
+
+ itkNewMacro(Self);
+ vvWipeImage();
+ ~vvWipeImage();
+
+ void Initialize(QString inputPathName, std::vector<vvSlicerManager*> slicerManagers);
+ void selectWipeImage(int index, QTreeWidget* DataTree);
+ void setInputImage(int number, vvImage::Pointer image);
+ void AddWipeImage(int index, std::vector<std::string> fileNames, vvImageReader::LoadedImageType type, QTreeWidget* DataTree);
+
+public slots:
+ void crossPointerChanged();
+
+ protected:
+ vtkSmartPointer<vtkImageRectilinearWipe> mWipe;
+ void UpdateWipe();
+ vtkSmartPointer<vtkMatrix4x4> mConcatenedTransform;
+ vvImage::Pointer mImage;
+ QString mInputPathName;
+ std::vector<vvSlicerManager*> mSlicerManagers;
+
+}; // end class vvWipeImage
+//------------------------------------------------------------------------------
+
+#endif
+