vvToolSimpleInputSelectorWidget
vvToolInputSelectorWidget
vvRegisterForm
+ vvWipeImage
)
# All others sources
<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>
</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>
</qresource>
</RCC>
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;
+
+ 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()
{
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();
#include <vtkInformation.h>
#include <vtkImageData.h>
#include <vtkSmartPointer.h>
-#include <vtkImageRectilinearWipe.h>
//------------------------------------------------------------------------------
// Create the tool and automagically (I like this word) insert it in
Ui::vvWipeImage()
{
vtkSmartPointer<vtkImageRectilinearWipe> mWipe = vtkSmartPointer<vtkImageRectilinearWipe>::New();
+ mWipe->SetWipe(0);
+ mWipe->SetPosition(256,256);
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
vvWipeImage::~vvWipeImage()
{
- delete [] mReducedExtent;
- delete [] mInitialExtent;
}
//------------------------------------------------------------------------------
-void vvWipeImage::setInput(int number, )
+//------------------------------------------------------------------------------
+void vvWipeImage::setInput(int number, vvImage::Pointer image)
{
- mWipe->SetInputConnection(0,reader1->GetOutputPort());
+ if (image->GetVTKImages().size()) {
+ mImage = image;
+ mWipe->SetInputData(number, mImage->GetVTKImages()[0]); //[0] pour du 4D ?
+ }
}
- wipe->SetInputConnection(0,reader1->GetOutputPort());
- wipe->SetInputConnection(1,reader2->GetOutputPort());
+//------------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
void vvWipeImage::closeEvent(QCloseEvent *event)
{
- if(mCurrentSlicerManager){
-// Reset extends
- for(int i=0; i<6; i++){
- mReducedExtent[i] = mInitialExtent[i];
- }
- for(int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++)
- mCurrentSlicerManager->GetSlicer(i)->EnableReducedExtent(false);
- UpdateExtent();
- }
mCurrentSlicerManager->GetImage()->GetTransform()[0]->SetMatrix(mConcatenedTransform);
for (int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
mCurrentSlicerManager->GetSlicer(i)->ResetCamera();
//------------------------------------------------------------------------------
void vvWipeImage::reject()
{
- for(int i=0; i<mExtentSize; i++)
- mReducedExtent[i] = mInitialExtent[i];
- for(int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++)
- mCurrentSlicerManager->GetSlicer(i)->EnableReducedExtent(false);
- UpdateExtent();
return vvToolWidgetBase::reject();
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvWipeImage::crossPointerChanged()
{
- int dimMin = dim;
- if(dim%2==0){//case we are minimum
- mSliders[dim+1]->setMinimum(mSliders[dim]->value());
- }else {
- mSliders[--dimMin]->setMaximum(mSliders[dim]->value());
- }
- mReducedExtent[dim] = mSliders[dim]->value() + mInitialExtent[dimMin];
+ mWipe->SetPosition(256,256);
UpdateWipe();
}
//------------------------------------------------------------------------------
void vvWipeImage::UpdateWipe()
{
for(int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
- mCurrentSlicerManager->GetSlicer(i)->SetReducedExtent(mReducedExtent);
+ //mCurrentSlicerManager->GetSlicer(i)->SetReducedExtent(mReducedExtent);
mCurrentSlicerManager->GetSlicer(i)->ForceUpdateDisplayExtent();
mCurrentSlicerManager->GetSlicer(i)->Render();
}
}
// Change interface according to number of dimension
- mExtentSize = 2*slicer->GetDimension();
- if (slicer->GetDimension()<4) {
- mTLabel1->setHidden(true);
- mTLabel2->setHidden(true);
- tminSlider->setHidden(true);
- tmaxSlider->setHidden(true);
- spin_tmin->setHidden(true);
- spin_tmax->setHidden(true);
- mLabelTimeCropping->setHidden(true);
- }
- if (slicer->GetDimension()<3) {
- mZLabel1->setHidden(true);
- mZLabel2->setHidden(true);
- zminSlider->setHidden(true);
- zmaxSlider->setHidden(true);
- spin_zmin->setHidden(true);
- spin_zmax->setHidden(true);
- }
#if VTK_MAJOR_VERSION <= 5
int *a = mCurrentImage->GetFirstVTKImageData()->GetWholeExtent();
#else
int *a = mCurrentImage->GetFirstVTKImageData()->GetInformation()->Get(vtkDataObject::DATA_EXTENT());
#endif
- for(int i=0; i<6; i++){
- mInitialExtent[i] = a[i];
- mReducedExtent[i] = a[i];
- }
- for(int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
- mCurrentSlicerManager->GetSlicer(i)->EnableReducedExtent(true);
- mCurrentSlicerManager->GetSlicer(i)->SetReducedExtent(mInitialExtent);
- }
// Set initial sliders values
int w_ext[6], imsize[3];
mCurrentSlicerManager->GetSlicer(0)->GetRegisterExtent(w_ext);
- for(int dim=0; dim<slicer->GetDimension() && dim<3; ++dim){
- imsize[dim] = w_ext[2*dim+1] - w_ext[2*dim] +1;
- mSliders[dim*2]->setMaximum(imsize[dim]-1);
- mSliders[dim*2+1]->setMaximum(imsize[dim]-1);
- mSliders[dim*2+1]->setValue(imsize[dim]-1);
- }
- spin_xmin->setMaximum(imsize[0]-1);
- spin_xmax->setMaximum(imsize[0]-1);
- spin_xmax->setValue(imsize[0]-1);
-
- spin_ymin->setMaximum(imsize[1]-1);
- spin_ymax->setMaximum(imsize[1]-1);
- spin_ymax->setValue(imsize[1]-1);
-
- if (slicer->GetDimension() >2) {
- spin_zmin->setMaximum(imsize[2]-1);
- spin_zmax->setMaximum(imsize[2]-1);
- spin_zmax->setValue(imsize[2]-1);
- }
-
- if (slicer->GetDimension() >3) {
- spin_tmin->setMaximum(imsize[3]-1);
- spin_tmax->setMaximum(imsize[3]-1);
- spin_tmax->setValue(imsize[3]-1);
- }
QSignalMapper* signalMapper = new QSignalMapper(this);
connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(sliderValueChanged(int)));
- for(unsigned int i=0; i<mSliders.size(); ++i){
- signalMapper->setMapping(mSliders[i], i);
- connect(mSliders[i], SIGNAL(valueChanged(int)), signalMapper, SLOT(map()));
- }
- UpdateExtent();
}
//------------------------------------------------------------------------------
mArgsInfo.boundingBox_given = n;
mArgsInfo.boundingBox_arg = new int[n];
- for(int dim=0; dim<mCurrentSlicerManager->GetDimension() && dim<3; ++dim){
- mArgsInfo.boundingBox_arg[dim*2] = mSliders[dim*2]->value();
- mArgsInfo.boundingBox_arg[dim*2+1] = mSliders[dim*2+1]->value();
- }
- if (n>6) { // 4D
- mArgsInfo.boundingBox_arg[6] = 0;
- mArgsInfo.boundingBox_arg[7] = mCurrentImage->GetSize()[3]-1;
- }
// We MUST reset initial extend to input image before using the
- // filter to retrieve the correct image size
- for(int i=0; i<6; i++) {
- mReducedExtent[i] = mInitialExtent[i];
- }
-
- UpdateExtent();
+ // filter to retrieve the correct image size ;
// Main filter
CropFilterType::Pointer filter = CropFilterType::New();
filter->SetInputVVImage(mCurrentImage);
#include "vvToolBase.h"
#include "vvToolWidgetBase.h"
#include "vvMainWindowBase.h"
-//#include "ui_vvWipeImage.h"
+#include "ui_vvWipeImage.h"
//vtk
#include <vtkTransform.h>
+#include <vtkImageRectilinearWipe.h>
//------------------------------------------------------------------------------
class vvWipeImage:
~vvWipeImage();
virtual void InputIsSelected(vvSlicerManager *m);
+ void setInput(int number, vvImage::Pointer image);
public slots:
virtual void apply();
vtkSmartPointer<vtkImageRectilinearWipe> mWipe;
void UpdateWipe();
virtual void closeEvent(QCloseEvent *event);
+ vtkSmartPointer<vtkMatrix4x4> mConcatenedTransform;
+ vvImage::Pointer mImage;
}; // end class vvWipeImage
//------------------------------------------------------------------------------