template<class args_info_type>
BinarizeImageGenericFilter<args_info_type>::BinarizeImageGenericFilter():
ImageToImageGenericFilter<Self>("Binarize") {
- // InitializeImageType<2>();
+ InitializeImageType<2>();
InitializeImageType<3>();
InitializeImageType<4>();
}
template<class args_info_type>
template<unsigned int Dim>
void BinarizeImageGenericFilter<args_info_type>::InitializeImageType() {
- //ADD_IMAGE_TYPE(Dim, char);
+ ADD_IMAGE_TYPE(Dim, char);
ADD_IMAGE_TYPE(Dim, short);
- //ADD_IMAGE_TYPE(Dim, int);
+ ADD_IMAGE_TYPE(Dim, int);
//ADD_IMAGE_TYPE(Dim, float);
}
//--------------------------------------------------------------------
#File clitkSignalMeanPositionTracking.ggo
-Package "clitkSignalMeanPositionTracking"
+package "clitkSignalMeanPositionTracking"
version "1.0"
purpose "See Ruan 2008, compute mean position from a signal"
vvToolCreatorBase.cxx
vvToolWidgetBase.cxx
vvToolFoo.cxx
+ vvToolFooWithWidgetBase.cxx
vvToolCropImage.cxx
vvToolBinarize.cxx
vvToolInputSelectorWidget.cxx
vvIntensityValueSlider.h
vvToolCreatorBase.h
vvToolFoo.h
+ vvToolFooWithWidgetBase.h
vvToolBinarize.h
vvToolInputSelectorWidget.h
vvToolWidgetBase.h
</widget>
</item>
<item>
- <widget class="QCheckBox" name="checkBox_2">
+ <widget class="QCheckBox" name="mCheckBoxInteractiveDisplay">
<property name="enabled">
- <bool>false</bool>
+ <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>
<rect>
<x>0</x>
<y>0</y>
- <width>192</width>
- <height>169</height>
+ <width>394</width>
+ <height>220</height>
</rect>
</property>
<property name="windowTitle">
</layout>
</widget>
<resources/>
- <connections/>
+ <connections>
+ <connection>
+ <sender>xminSlider</sender>
+ <signal>sliderMoved(int)</signal>
+ <receiver>spin_xmin</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>83</x>
+ <y>23</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>334</x>
+ <y>25</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>spin_xmin</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>xminSlider</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>334</x>
+ <y>25</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>86</x>
+ <y>19</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>xmaxSlider</sender>
+ <signal>sliderMoved(int)</signal>
+ <receiver>spin_xmax</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>99</x>
+ <y>54</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>334</x>
+ <y>61</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>spin_xmax</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>xmaxSlider</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>334</x>
+ <y>60</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>97</x>
+ <y>54</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>yminSlider</sender>
+ <signal>sliderMoved(int)</signal>
+ <receiver>spin_ymin</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>102</x>
+ <y>89</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>334</x>
+ <y>95</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>spin_ymin</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>yminSlider</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>334</x>
+ <y>82</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>111</x>
+ <y>84</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>ymaxSlider</sender>
+ <signal>sliderMoved(int)</signal>
+ <receiver>spin_ymax</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>72</x>
+ <y>121</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>334</x>
+ <y>125</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>spin_ymax</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>ymaxSlider</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>334</x>
+ <y>123</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>86</x>
+ <y>117</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>zminSlider</sender>
+ <signal>sliderMoved(int)</signal>
+ <receiver>spin_zmin</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>64</x>
+ <y>156</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>334</x>
+ <y>159</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>spin_zmin</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>zminSlider</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>334</x>
+ <y>158</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>85</x>
+ <y>159</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>zmaxSlider</sender>
+ <signal>sliderMoved(int)</signal>
+ <receiver>spin_zmax</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>75</x>
+ <y>188</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>334</x>
+ <y>189</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>spin_zmax</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>zmaxSlider</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>334</x>
+ <y>188</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>80</x>
+ <y>192</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
</ui>
<rect>
<x>0</x>
<y>0</y>
- <width>400</width>
- <height>300</height>
+ <width>472</width>
+ <height>292</height>
</rect>
</property>
<property name="windowTitle">
</property>
</widget>
</item>
- <item row="0" column="1">
- <widget class="QSlider" name="xminSlider">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<item row="5" column="2">
<widget class="QSpinBox" name="spin_zmax"/>
</item>
+ <item row="0" column="1">
+ <widget class="QSlider" name="xminSlider">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
</layout>
</widget>
<resources/>
- <connections/>
+ <connections>
+ <connection>
+ <sender>spin_xmin</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>xminSlider</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>412</x>
+ <y>37</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>308</x>
+ <y>37</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>xminSlider</sender>
+ <signal>sliderMoved(int)</signal>
+ <receiver>spin_xmin</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>227</x>
+ <y>38</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>418</x>
+ <y>39</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>xmaxSlider</sender>
+ <signal>sliderMoved(int)</signal>
+ <receiver>spin_xmax</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>311</x>
+ <y>82</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>412</x>
+ <y>85</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>yminSlider</sender>
+ <signal>sliderMoved(int)</signal>
+ <receiver>spin_ymin</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>321</x>
+ <y>126</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>412</x>
+ <y>128</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>ymaxSlider</sender>
+ <signal>sliderMoved(int)</signal>
+ <receiver>spin_ymax</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>246</x>
+ <y>171</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>417</x>
+ <y>167</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>zminSlider</sender>
+ <signal>sliderMoved(int)</signal>
+ <receiver>spin_zmin</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>291</x>
+ <y>214</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>412</x>
+ <y>213</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>zmaxSlider</sender>
+ <signal>sliderMoved(int)</signal>
+ <receiver>spin_zmax</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>250</x>
+ <y>257</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>415</x>
+ <y>253</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>spin_xmax</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>xmaxSlider</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>412</x>
+ <y>83</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>285</x>
+ <y>84</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>spin_ymin</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>yminSlider</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>412</x>
+ <y>126</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>304</x>
+ <y>127</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>spin_ymax</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>ymaxSlider</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>412</x>
+ <y>165</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>305</x>
+ <y>169</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>spin_zmin</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>zminSlider</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>412</x>
+ <y>213</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>319</x>
+ <y>210</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>spin_zmax</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>zmaxSlider</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>413</x>
+ <y>259</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>308</x>
+ <y>254</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
</ui>
<property name="windowTitle">
<string>Form</string>
</property>
- <widget class="QPushButton" name="pushButton">
- <property name="geometry">
- <rect>
- <x>150</x>
- <y>90</y>
- <width>75</width>
- <height>23</height>
- </rect>
- </property>
- <property name="text">
- <string>Foo !</string>
- </property>
- </widget>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QPushButton" name="mButton">
+ <property name="text">
+ <string>Foo !</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</widget>
<resources/>
- <connections>
- <connection>
- <sender>pushButton</sender>
- <signal>clicked()</signal>
- <receiver>vvToolFoo</receiver>
- <slot>close()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>220</x>
- <y>135</y>
- </hint>
- <hint type="destinationlabel">
- <x>100</x>
- <y>-18</y>
- </hint>
- </hints>
- </connection>
- </connections>
+ <connections/>
</ui>
Program: vv
Module: $RCSfile: vvImageContour.cxx,v $
Language: C++
- Date: $Date: 2010/02/24 11:42:42 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2010/03/01 07:37:25 $
+ Version: $Revision: 1.4 $
Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr)
Copyright (C) 2010
#include "vvImageContour.h"
#include <vtkImageActor.h>
#include <vtkCamera.h>
+#include <vtkRenderer.h>
#include <vtkMarchingSquares.h>
#include <vtkImageClip.h>
#include <vtkImageData.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkProperty.h>
//------------------------------------------------------------------------------
vvImageContour::vvImageContour() {
mSlicer = slicer;
for (unsigned int numImage = 0; numImage < mSlicer->GetImage()->GetVTKImages().size(); numImage++) {
- // DD(numImage);
vtkImageClip * mClipper = vtkImageClip::New();
vtkMarchingSquares * mSquares = vtkMarchingSquares::New();
vtkPolyDataMapper * mSquaresMapper = vtkPolyDataMapper::New();
mSquaresList.push_back(mSquares);
mClipperList.push_back(mClipper);
}
- //mSquares->Update();
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-void vvImageContour::removeActors() {
- // DD("removeActors");
+void vvImageContour::hideActors() {
if (!mSlicer) return;
mSlice = mSlicer->GetSlice();
- // DD(mSlice);
for(unsigned int i=0; i<mSquaresActorList.size(); i++) {
mSquaresActorList[i]->VisibilityOff();
- //mSquaresActorList[i]->Update();
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-void vvImageContour::update(int value) {
- // DD(value);
+void vvImageContour::showActors() {
if (!mSlicer) return;
mSlice = mSlicer->GetSlice();
+ mTSlice = mSlicer->GetTSlice();
+ // for(unsigned int i=0; i<mSquaresActorList.size(); i++) {
+ mSquaresActorList[mTSlice]->VisibilityOn();
+ update(mValue);
+ //}
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvImageContour::update(int value) {
+ mValue= value;
+ if (!mSlicer) return;
+ // how to not update if not visible ?
+
+ mSlice = mSlicer->GetSlice();
// Only change actor visibility if tslice change
if (mTSlice != mSlicer->GetTSlice()) {
if (mTSlice != -1)
if (mSlicer->GetRenderer()->GetActiveCamera()->GetPosition()[0] > mSlice)
{
mSquaresActor->SetPosition(1,0,0);
- // mSquaresActor2->SetPosition(1,0,0);
}
else
{
mSquaresActor->SetPosition(-1,0,0);
- // mSquaresActor2->SetPosition(-1,0,0);
}
break;
case 2:
if (mSlicer->GetRenderer()->GetActiveCamera()->GetPosition()[1] > mSlice)
{
mSquaresActor->SetPosition(0,1,0);
- // mSquaresActor2->SetPosition(0,1,0);
}
else
{
mSquaresActor->SetPosition(0,-1,0);
- // mSquaresActor2->SetPosition(0,-1,0);
}
break;
case 4:
if (mSlicer->GetRenderer()->GetActiveCamera()->GetPosition()[2] > mSlice)
{
mSquaresActor->SetPosition(0,0,1);
- // mSquaresActor2->SetPosition(0,0,1);
}
else
{
mSquaresActor->SetPosition(0,0,-1);
- // mSquaresActor2->SetPosition(0,0,-1);
}
break;
}
Program: vv
Module: $RCSfile: vvImageContour.h,v $
Language: C++
- Date: $Date: 2010/02/24 11:42:42 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2010/03/01 07:37:25 $
+ Version: $Revision: 1.4 $
Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr)
Copyright (C) 2010
#ifndef VVIMAGECONTOUR_H
#define VVIMAGECONTOUR_H
-#include <vtkMarchingCubes.h>
-#include <vtkPolyData.h>
-#include <vtkPolyDataMapper.h>
-#include <vtkActor.h>
-#include <vtkProperty.h>
-#include <vtkRenderer.h>
-#include <vtkImageClip.h>
-
#include "clitkCommon.h"
#include "vvSlicer.h"
+class vtkImageClip;
+class vtkMarchingSquares;
+class vtkActor;
//------------------------------------------------------------------------------
class vvImageContour
{
// Q_OBJECT
- public:
+ public:
vvImageContour();
~vvImageContour();
void setSlicer(vvSlicer * slicer);
- // vtkActor * getActor() { return mSquaresActor;}
void update(int value);
- void removeActors();
+ void hideActors();
+ void showActors();
protected:
vvSlicer * mSlicer;
int mSlice;
int mTSlice;
+ int mValue;
std::vector<vtkImageClip*> mClipperList;
std::vector<vtkMarchingSquares*> mSquaresList;
Program: vv
Module: $RCSfile: vvIntensityValueSlider.cxx,v $
Language: C++
- Date: $Date: 2010/02/24 11:42:42 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2010/03/01 07:37:25 $
+ Version: $Revision: 1.4 $
Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr)
Copyright (C) 2008
=========================================================================*/
#include "vvIntensityValueSlider.h"
-#include "clitkCommon.h"
//------------------------------------------------------------------------------
vvIntensityValueSlider::vvIntensityValueSlider(QWidget * parent, Qt::WindowFlags f)
//------------------------------------------------------------------------------
vvIntensityValueSlider::~vvIntensityValueSlider() {
- // DD("Delete vvIntensityValueSlider");
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvIntensityValueSlider::valueChangedFromSpinBox(double v) {
- // DD("valueChangedFromSpinBox");
- // DD(v);
mSlider->setValue(v);
mValue = v;
emit valueChanged(v);
//------------------------------------------------------------------------------
void vvIntensityValueSlider::valueChangedFromSlider(int v) {
- // DD("valueChangedFromSlider");
- // DD(v);
- // DD(v*mSliderFactor);
mSpinBox->setValue(v*mSliderFactor);
- // emit valueChanged(v*mSliderFactor);
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvIntensityValueSlider::Update() {
- // DD(mImage->GetScalarTypeAsString());
-// DD(mImage->GetFirstVTKImageData()->GetScalarTypeMax());
-// DD(mImage->GetFirstVTKImageData()->GetScalarTypeMin());
-
- // double max = mImage->GetFirstVTKImageData()->GetScalarTypeMax();
-// double min = mImage->GetFirstVTKImageData()->GetScalarTypeMin();
-
if (mImage->IsScalarTypeInteger()) {
mSpinBox->setSingleStep(1.0);
mImage->GetFirstVTKImageData()->GetScalarRange(range);
mMin = range[0];
mMax = range[1];
- // DD(mMax);
-// DD(mMin);
mSlider->setMaximum(mMax);
mSlider->setMinimum(mMin);
mSpinBox->setMaximum(mMax);
Program: vv
Module: $RCSfile: vvMainWindow.cxx,v $
Language: C++
- Date: $Date: 2010/02/24 11:42:42 $
- Version: $Revision: 1.12 $
+ Date: $Date: 2010/03/01 07:37:25 $
+ Version: $Revision: 1.13 $
Author : Pierre Seroul (pierre.seroul@gmail.com)
Copyright (C) 200COLUMN_IMAGE_NAME
if (DataTree->topLevelItem(i)->data(COLUMN_UL_VIEW,Qt::CheckStateRole).toInt() > 1)
{
mSlicerManagers[i]->GetSlicer(0)->SetSlice(value);
- //mSlicerManagers[i]->UpdateSlice(0); // <-- NO ! too much update...
+ mSlicerManagers[i]->UpdateSlice(0); // <-- DS add this. Not too much update ?
break;
}
}
{
mImage = NULL;
mCurrentTSlice = 0;
+ mUseReducedExtent = false;
mCurrent[0] = -VTK_DOUBLE_MAX;
mCurrent[1] = -VTK_DOUBLE_MAX;
return ca.GetPointer();
}
+//------------------------------------------------------------------------------
+void vvSlicer::EnableReducedExtent(bool b) {
+ mUseReducedExtent = b;
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvSlicer::SetReducedExtent(int * ext) {
+ mReducedExtent = ext;
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
void vvSlicer::AddContour(vvMesh::Pointer contour,bool propagate)
{
return;
}
input->UpdateInformation();
- int *w_ext = input->GetWholeExtent();
+ int *w_ext;// = input->GetWholeExtent();
+
+ if (mUseReducedExtent) {
+ w_ext = mReducedExtent;
+ }
+ else w_ext = input->GetWholeExtent();
+
+ DD(w_ext[0]);
+ DD(w_ext[1]);
+ DD(w_ext[2]);
switch (this->SliceOrientation)
{
//----------------------------------------------------------------------------
void vvSlicer::SetSlice(int slice)
{
+ DD("vvSlicer::SetSlice");
+ DD(slice);
int *range = this->GetSliceRange();
+ DD(range[0]);
+ DD(range[1]);
if (range)
{
if (slice < range[0])
virtual void SetColorWindow(double s);
virtual void SetColorLevel(double s);
+ void EnableReducedExtent(bool b);
+ void SetReducedExtent(int * ext);
+
protected:
vvSlicer();
~vvSlicer();
int mSubSampling;
int mScale;
int mVFLog;
+ bool mUseReducedExtent;
+ int * mReducedExtent;
private:
void UpdateOrientation();
Program: vv
Module: $RCSfile: vvToolBase.h,v $
Language: C++
- Date: $Date: 2010/02/24 11:42:42 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2010/03/01 07:37:25 $
+ Version: $Revision: 1.4 $
Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr)
Copyright (C) 2008
static void SetToolIconFilename(QString n) { vvToolCreator<ToolType>::mSingleton->mToolIconFilename = n; }
static void SetToolTip(QString n) { vvToolCreator<ToolType>::mSingleton->mToolTip = n; }
+ void AddImage(vvImage::Pointer image,std::string filename) {
+ CREATOR(ToolType)->GetMainWindow()->AddImage(image,filename);
+ }
+
};
//------------------------------------------------------------------------------
Program: vv
Module: $RCSfile: vvToolBinarize.cxx,v $
Language: C++
- Date: $Date: 2010/02/24 11:42:42 $
- Version: $Revision: 1.8 $
+ Date: $Date: 2010/03/01 07:37:25 $
+ Version: $Revision: 1.9 $
Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr)
Copyright (C) 2008
{
// GUI Initialization
Ui_vvToolBinarize::setupUi(mToolWidget);
+ mInteractiveDisplayIsEnabled = mCheckBoxInteractiveDisplay->isChecked();
// Connect signals & slots
connect(mThresholdSlider1, SIGNAL(valueChanged(double)), this, SLOT(valueChangedT1(double)));
connect(mRadioButtonLowerThan, SIGNAL(toggled(bool)), this, SLOT(enableLowerThan(bool)));
connect(mCheckBoxUseFG, SIGNAL(toggled(bool)), this, SLOT(useFGBGtoggled(bool)));
connect(mCheckBoxUseBG, SIGNAL(toggled(bool)), this, SLOT(useFGBGtoggled(bool)));
+ connect(mCheckBoxInteractiveDisplay, SIGNAL(toggled(bool)), this, SLOT(InteractiveDisplayToggled(bool)));
// Initialize some widget
mThresholdSlider1->SetText("");
//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+void vvToolBinarize::InteractiveDisplayToggled(bool b) {
+ mInteractiveDisplayIsEnabled = b;
+ if (!mInteractiveDisplayIsEnabled) {
+ RemoveVTKObjects();
+ }
+ else {
+ for(unsigned int i=0; i<mImageContour.size(); i++)
+ mImageContour[i]->showActors();
+ if (mCurrentSlicerManager)
+ mCurrentSlicerManager->Render();
+ }
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolBinarize::RemoveVTKObjects() {
+ for(unsigned int i=0; i<mImageContour.size(); i++)
+ mImageContour[i]->hideActors();
+ if (mCurrentSlicerManager)
+ mCurrentSlicerManager->Render();
+}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+bool vvToolBinarize::close() {
+ RemoveVTKObjects();
+ return vvToolWidgetBase::close();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolBinarize::reject() {
+ RemoveVTKObjects();
+ return vvToolWidgetBase::reject();
+}
+//------------------------------------------------------------------------------
+
+
//------------------------------------------------------------------------------
void vvToolBinarize::enableLowerThan(bool b) {
if (!b) {
//------------------------------------------------------------------------------
void vvToolBinarize::UpdateSlice(int slicer,int slices) {
+ if (!mInteractiveDisplayIsEnabled) return;
if (!mCurrentSlicerManager) close();
for(int i=0;i<mCurrentSlicerManager->NumberOfSlicers(); i++) {
mImageContour[i]->update(mThresholdSlider1->GetValue());
mArgsInfo.fg_arg = mFGSlider->GetValue();
mArgsInfo.bg_arg = mBGSlider->GetValue();
- // DD(inverseBGandFG);
if (inverseBGandFG) {
mArgsInfo.fg_arg = mFGSlider->GetValue();
mArgsInfo.bg_arg = mBGSlider->GetValue();
// Output ???
vvImage::Pointer output = filter->GetOutputVVImage();
std::ostringstream osstream;
- osstream << "Binarized_" << mCurrentSlicerManager->GetSlicer(0)->GetFileName();
- CREATOR(vvToolBinarize)->GetMainWindow()->AddImage(output,osstream.str());
+ osstream << "Binarized_" << mCurrentSlicerManager->GetSlicer(0)->GetFileName() << ".mhd";
+ AddImage(output,osstream.str());
close();
}
//------------------------------------------------------------------------------
// DD(mCurrentSlicerManager->GetSlicer(0));
mThresholdSlider2->SetMinimum(v);
int m1 = (int)lrint(v);
-
+
+ if (!mInteractiveDisplayIsEnabled) return;
for(int i=0;i<mCurrentSlicerManager->NumberOfSlicers(); i++) {
mImageContour[i]->update(m1);
}
Program: vv
Module: $RCSfile: vvToolBinarize.h,v $
Language: C++
- Date: $Date: 2010/02/24 11:42:42 $
- Version: $Revision: 1.6 $
+ Date: $Date: 2010/03/01 07:37:25 $
+ Version: $Revision: 1.7 $
Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr)
Copyright (C) 2010
#define VVTOOLBINARIZE_H
#include <QtDesigner/QDesignerExportWidget>
-//#include <QDialog>
#include "vvToolBase.h"
#include "vvToolWidgetBase.h"
#include "ui_vvToolBinarize.h"
#include "clitkBinarizeImage_ggo.h"
-#include "vtkMarchingSquares.h"
-#include "vtkImageClip.h"
-#include "vtkMarchingCubes.h"
-#include "vtkPolyData.h"
-#include "vtkPolyDataMapper.h"
-#include "vtkActor.h"
-#include "vtkProperty.h"
-#include "vtkRenderer.h"
-
//------------------------------------------------------------------------------
class vvToolBinarize:
public vvToolWidgetBase,
//-----------------------------------------------------
public slots:
- void apply();
+ virtual void apply();
+ virtual bool close();
+ virtual void reject();
void valueChangedT1(double v);
void valueChangedT2(double v);
void UpdateSlice(int slicer,int slices);
void InputIsSelected(vvSlicerManager * m);
void enableLowerThan(bool b);
void useFGBGtoggled(bool);
- virtual bool close() { DD("vvToolBinarize::close");
- for(unsigned int i=0; i<mImageContour.size(); i++)
- mImageContour[i]->removeActors();
- if (mCurrentSlicerManager)
- mCurrentSlicerManager->Render();
- return vvToolWidgetBase::close(); }
-
- virtual void reject() { DD("vvToolBinarize::reject");
- for(unsigned int i=0; i<mImageContour.size(); i++)
- mImageContour[i]->removeActors();
- if (mCurrentSlicerManager)
- mCurrentSlicerManager->Render();
- return vvToolWidgetBase::reject(); }
-
+ void InteractiveDisplayToggled(bool b);
protected:
+ void RemoveVTKObjects();
Ui::vvToolBinarize ui;
args_info_clitkBinarizeImage mArgsInfo;
std::vector<vvImageContour*> mImageContour;
+ bool mInteractiveDisplayIsEnabled;
}; // end class vvToolBinarize
//------------------------------------------------------------------------------
Program: vv
Module: $RCSfile: vvToolCropImage.cxx,v $
Language: C++
- Date: $Date: 2010/02/24 11:43:37 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2010/03/01 07:37:25 $
+ Version: $Revision: 1.2 $
Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr)
Copyright (C) 2008
=========================================================================*/
#include "vvToolCropImage.h"
+#include <QComboBox>
+#include <QCursor>
+#include <QApplication>
+#include <vtkImageClip.h>
+#include <vtkImageTranslateExtent.h>
+#include <vtkImageData.h>
+#include <vtkSmartPointer.h>
+#include "vvSlicer.h"
//------------------------------------------------------------------------------
// Create the tool and automagically (I like this word) insert it in
vvToolWidgetBase(parent, f),
vvToolBase<vvToolCropImage>(parent),
Ui::vvToolCropImage() {
+
// GUI Initialization
Ui_vvToolCropImage::setupUi(mToolWidget);
+ mReducedExtent = new int[6]; // TO CHANGE !! nb dim
- // Initialize the input selection
- //UpdateInfoFromMainWindow();
- // InitializeListOfInputImages(*mMainWindowToolInfo->mSlicerManagers,
-// mMainWindowToolInfo->mSlicerManagerCurrentIndex);
+ // Connect
+ connect(xminSlider, SIGNAL(sliderMoved(int)), this, SLOT(sliderMoved(int)));
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+void vvToolCropImage::sliderMoved(int s) {
+ DD(s);
+ mReducedExtent[0] = xminSlider->value();
+ for(int i=0; i<mCurrentSlicerManager->NumberOfSlicers(); i++) {
+ mCurrentSlicerManager->GetSlicer(i)->SetReducedExtent(mReducedExtent);
+ }
+}
+//------------------------------------------------------------------------------
+
+
//------------------------------------------------------------------------------
void vvToolCropImage::InputIsSelected(vvSlicerManager * slicer) {
- DD("InputIsSelected");
+ DD("InputIsSelected");
+
+ mReducedExtent = mCurrentSlicerManager->GetImage()->GetFirstVTKImageData()->GetWholeExtent();
+ DD(mReducedExtent[0]);
+ DD(mReducedExtent[1]);
+
+
+ // TODO : set min/max
+ std::vector<int> imsize = mCurrentSlicerManager->GetImage()->GetSize();
+ xminSlider->setMaximum(imsize[0]-1);
+ xmaxSlider->setMaximum(imsize[0]-1);
+ xmaxSlider->setValue(imsize[0]-1);
+ yminSlider->setMaximum(imsize[1]-1);
+ ymaxSlider->setMaximum(imsize[1]-1);
+ ymaxSlider->setValue(imsize[1]-1);
+ zminSlider->setMaximum(imsize[2]-1);
+ zmaxSlider->setMaximum(imsize[2]-1);
+ zmaxSlider->setValue(imsize[2]-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);
+ spin_zmin->setMaximum(imsize[2]-1);
+ spin_zmax->setMaximum(imsize[2]-1);
+ spin_zmax->setValue(imsize[2]-1);
}
//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolCropImage::apply() {
+ DD("apply");
+
+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
+ vvImage::Pointer mResult=vvImage::New();
+ //vvSlicerManager * current=mSlicerManagers[inputSequenceBox->currentIndex()];
+ vvImage::Pointer image= mCurrentSlicerManager->GetImage();
+ for (std::vector<vtkImageData*>::const_iterator i=image->GetVTKImages().begin();
+ i!=image->GetVTKImages().end();i++)
+ {
+ vtkSmartPointer<vtkImageClip> filter=vtkSmartPointer<vtkImageClip>::New();
+ ///Vtk is very weird, you need to "translate the extent" to get the correct origin
+ //http://markmail.org/message/vndc2tr6kcabiakp#query:vtkImageClip%20origin+page:1+mid:6na7y57floutklvz+state:results
+ vtkSmartPointer<vtkImageTranslateExtent> translate=vtkSmartPointer<vtkImageTranslateExtent>::New();
+ filter->SetInput(*i);
+ filter->SetOutputWholeExtent(xminSlider->value(),xmaxSlider->value(),
+ yminSlider->value(),ymaxSlider->value(),
+ zminSlider->value(),zmaxSlider->value());
+ translate->SetTranslation(-xminSlider->value(),-yminSlider->value(),-zminSlider->value());
+ translate->SetInput(filter->GetOutput());
+ filter->ClipDataOn(); //Really create a cropped copy of the image
+ translate->Update();
+ vtkImageData* output=vtkImageData::New();
+ output->ShallowCopy(translate->GetOutput());
+ mResult->AddImage(output);
+ }
+ QApplication::restoreOverrideCursor();
+
+ AddImage(mResult,"crop.mhd");
+
+ close();
+}
+//------------------------------------------------------------------------------
+
Program: vv
Module: $RCSfile: vvToolCropImage.h,v $
Language: C++
- Date: $Date: 2010/02/24 11:43:37 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2010/03/01 07:37:25 $
+ Version: $Revision: 1.2 $
Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr)
Copyright (C) 2010
vvToolCropImage(vvMainWindowBase * parent=0, Qt::WindowFlags f=0);
~vvToolCropImage();
- //-----------------------------------------------------
- typedef vvToolCropImage Self;
- bool close() { return QWidget::close(); }
virtual void InputIsSelected(vvSlicerManager *m);
- //void AnImageIsBeingClosed(vvSlicerManager * m) { vvToolWidgetBase::TTAnImageIsBeingClosed(m); }
-
- void bar() { DD("crop::bar"); }
-
public slots:
- void apply() { DD("Apply"); }
+ virtual void apply();
+ void sliderMoved(int s);
//-----------------------------------------------------
static void Initialize() {
protected:
Ui::vvToolCropImage ui;
-
+ int * mReducedExtent;
}; // end class vvToolCropImage
//------------------------------------------------------------------------------
Program: vv
Module: $RCSfile: vvToolWidgetBase.h,v $
Language: C++
- Date: $Date: 2010/02/24 11:43:37 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2010/03/01 07:37:25 $
+ Version: $Revision: 1.2 $
Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr)
Copyright (C) 2010
public slots:
virtual void apply() = 0;
+ virtual bool close();
void InputIsSelected();
void AnImageIsBeingClosed(vvSlicerManager * m);
void show();
- virtual bool close();
protected:
void InitializeInputs();