#include <vtkProperty.h>
#include <vtkImageMapToRGBA.h>
#include <vtkLookupTable.h>
+#include <vtkImageMapper3D.h>
//------------------------------------------------------------------------------
vvBinaryImageOverlayActor::vvBinaryImageOverlayActor()
#if VTK_MAJOR_VERSION <= 5
mOverlayActor->SetInput(mOverlayMapper->GetOutput());
#else
- mOverlayActor->SetInputData(mOverlayMapper->GetOutput());
+ mOverlayActor->GetMapper()->SetInputConnection(mOverlayMapper->GetOutputPort());
#endif
mOverlayActor->SetPickable(0);
mOverlayActor->SetVisibility(IsVisible);
#include <vtkImageData.h>
#include <vtkPolyDataMapper.h>
#include <vtkProperty.h>
+#include <vtkInformation.h>
//------------------------------------------------------------------------------
vvImageContour::vvImageContour()
vtkActor * mSquaresActor = mSquaresActorList[mTSlice];
int orientation = ComputeCurrentOrientation();
- //UpdateActor(mSquaresActor, mapper, mSquares, mClipper, mValue, orientation, mSlice);
+ UpdateActor(mSquaresActor, mapper, mSquares, mClipper, mValue, orientation, mSlice);
if (mPreviousTslice != mTSlice) {
if (mPreviousTslice != -1) mSquaresActorList[mPreviousTslice]->VisibilityOff();
}
-
+
mSlicer->Render();
}
//------------------------------------------------------------------------------
clipper->SetInputData(mSlicer->GetImage()->GetVTKImages()[numImage]);
#endif
}
-clipper->Update();
#if VTK_MAJOR_VERSION <= 5
squares->SetInput(clipper->GetOutput());
squaresMapper->SetInput(squares->GetOutput());
#else
- squares->SetInputData(clipper->GetOutput());
- squaresMapper->SetInputData(squares->GetOutput());
+ squares->SetInputConnection(clipper->GetOutputPort(0));
+ squaresMapper->SetInputConnection(squares->GetOutputPort(0));
#endif
-squares->Update();
-squaresMapper->Update();
squaresMapper->ScalarVisibilityOff();
squaresActor->SetMapper(squaresMapper);
squaresActor->GetProperty()->SetColor(1.0,0,0);
clipper->SetOutputWholeExtent(extent2[0],extent2[1],extent2[2],
extent2[3],extent2[4],extent2[5]);
- clipper->Update();
- clipper->Print(cout);
-
+
if (mHiddenImageIsUsed) delete extent2;
// Move the actor to be visible
ShowLastImage();
InitDisplay();
qApp->processEvents();
-
// End
ImageInfoChanged();
return slicer_manager;
}
if (mLandMapper)
UpdateLandmarks();
-
this->GetRenderWindow()->Render();
}
//----------------------------------------------------------------------------
#include <vtkImageClip.h>
#include <vtkRenderWindow.h>
+
//------------------------------------------------------------------------------
// Create the tool and automagically (I like this word) insert it in
// the main window menu.
} else {
for(unsigned int i=0; i<mImageContour.size(); i++) {
mImageContour[i]->ShowActors();
- mImageContour[i]->Print(cout);
if (mRadioButtonLowerThan->isChecked())
mImageContourLower[i]->ShowActors();
}
mImageContourLower[i]->SetSlicer(mCurrentSlicerManager->GetSlicer(i));
mImageContourLower[i]->SetColor(0.0, 0.0, 1.0);
mImageContourLower[i]->SetDepth(100); // to be in front of (whe used with ROI tool)
- mImageContour[i]->Print(cout);
}
valueChangedT1(mThresholdSlider1->GetValue());
connect(mCurrentSlicerManager,SIGNAL(UpdateOrientation(int,int)),this,SLOT(UpdateOrientation(int, int)));
// connect(mCurrentSlicerManager, SIGNAL(LeftButtonReleaseSignal(int)), SLOT(LeftButtonReleaseEvent(int)));
- cout << mInteractiveDisplayIsEnabled << endl;
InteractiveDisplayToggled(mInteractiveDisplayIsEnabled);
}
//------------------------------------------------------------------------------
{ cout << __func__ << endl;
if (!mCurrentSlicerManager) close();
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
- GetArgsInfoFromGUI();
-
+ GetArgsInfoFromGUI();
+
// Main filter
clitk::BinarizeImageGenericFilter::Pointer filter =
clitk::BinarizeImageGenericFilter::New();
filter->SetArgsInfo(mArgsInfo);
filter->Update();
+
// Output
- vvImage::Pointer output = filter->GetOutputVVImage();
+ vvImage::Pointer output = filter->GetOutputVVImage();
std::ostringstream osstream;
osstream << "Binarized_" << mCurrentSlicerManager->GetSlicer(0)->GetFileName() << ".mhd";
AddImage(output,osstream.str());
#include "vvImageWriter.h"
#include "vvROIActor.h"
#include "vvSlicer.h"
-#include "vvROIActor.h"
#include "vvMeshReader.h"
#include "vvStructSelector.h"
#include "vvToolManager.h"
QWidget(parent->GetTab()),
vvToolBase<vvToolROIManager>(parent),
Ui::vvToolROIManager()
-{
+{ //out << __func__ << endl;
// Store parent
mMainWindow = parent;
//------------------------------------------------------------------------------
vvToolROIManager::~vvToolROIManager()
-{
+{ //out << __func__ << endl;
mROIActorsList.clear();
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// STATIC
-void vvToolROIManager::Initialize() {
+void vvToolROIManager::Initialize()
+{ //out << __func__ << endl;
SetToolName("ROIManager");
SetToolMenuName("Open ROI (binary image or RT-STRUCT)");
SetToolIconFilename(":/common/icons/tool-roi.png");
//------------------------------------------------------------------------------
void vvToolROIManager::InitializeNewTool(bool ReadStateFlag)
-{
+{ //out << __func__ << endl;
// Check if we need to start a new tool or read in the state file to load
if (ReadStateFlag == false) {
// Select the current image as the target
//------------------------------------------------------------------------------
void vvToolROIManager::InputIsSelected(vvSlicerManager *m)
-{
+{ //out << __func__ << endl;
// Initialization
mCurrentSlicerManager = m;
mCurrentImage = mCurrentSlicerManager->GetImage();
//------------------------------------------------------------------------------
void vvToolROIManager::AnImageIsBeingClosed(vvSlicerManager * m)
-{
+{ //out << __func__ << endl;
if (m == mCurrentSlicerManager) {
close();
return;
//------------------------------------------------------------------------------
void vvToolROIManager::close()
-{
+{ //out << __func__ << endl;
disconnect(mTree, SIGNAL(itemSelectionChanged()), this, SLOT(SelectedItemChangedInTree()));
disconnect(mCheckBoxShow, SIGNAL(toggled(bool)), this, SLOT(VisibleROIToggled(bool)));
disconnect(mOpacitySlider, SIGNAL(valueChanged(int)), this, SLOT(OpacityChanged(int)));
//------------------------------------------------------------------------------
-void vvToolROIManager::SelectedImageHasChanged(vvSlicerManager * m) {
-
+void vvToolROIManager::SelectedImageHasChanged(vvSlicerManager * m)
+{ //out << __func__ << endl;
if (mCurrentSlicerManager == NULL) return;
if (m == NULL) return;
if (m != mCurrentSlicerManager) hide();
//------------------------------------------------------------------------------
void vvToolROIManager::Open()
-{
+{ //out << __func__ << endl;
// Open images
QString Extensions = "Images or Dicom-Struct files ( *.mha *.mhd *.hdr *.his *.dcm RS*)";
Extensions += ";;All Files (*)";
//------------------------------------------------------------------------------
void vvToolROIManager::OpenBinaryImage(QStringList & filename)
-{
+{ //out << __func__ << endl;
if (filename.size() == 0) return;
vvProgressDialog p("Reading ROI ...", true);
//------------------------------------------------------------------------------
void vvToolROIManager::OpenDicomImage(std::string filename)
-{
+{ //out << __func__ << endl;
// GUI selector of roi
vvMeshReader reader;
reader.SetFilename(filename);
std::string name,
std::string filename,
double BG, bool modeBG)
-{
+{ //out << __func__ << endl;
// Check Dimension
int dim = mCurrentImage->GetNumberOfDimensions();
int bin_dim = binaryImage->GetNumberOfDimensions();
//------------------------------------------------------------------------------
void vvToolROIManager::UpdateAllContours()
-{
+{ //out << __func__ << endl;
if (mCurrentSlicerManager == NULL) return;
// Render loaded ROIs (the first is sufficient)
for(unsigned int i=0; i<mROIList.size(); i++) {
//------------------------------------------------------------------------------
-void vvToolROIManager::UpdateAllROIStatus() {
+void vvToolROIManager::UpdateAllROIStatus()
+{ //out << __func__ << endl;
int nbVisible = 0;
int nb = mROIList.size();
for(int i=0; i<nb; i++) {
//------------------------------------------------------------------------------
-void vvToolROIManager::SelectedItemChangedInTree() {
+void vvToolROIManager::SelectedItemChangedInTree()
+{ //out << __func__ << endl;
// Search which roi is selected
QList<QTreeWidgetItem *> l = mTree->selectedItems();
if (l.size() == 0) {
//------------------------------------------------------------------------------
-void vvToolROIManager::VisibleROIToggled(bool b) {
+void vvToolROIManager::VisibleROIToggled(bool b)
+{ //out << __func__ << endl;
if (mCurrentROIActor == NULL) return;
if (b == mCurrentROIActor->IsVisible()) return; // nothing to do
mCurrentROIActor->SetVisible(b);
//------------------------------------------------------------------------------
-void vvToolROIManager::VisibleContourROIToggled(bool b) {
+void vvToolROIManager::VisibleContourROIToggled(bool b)
+{ //out << __func__ << endl;
if (mCurrentROIActor == NULL) return;
if (mCurrentROIActor->IsContourVisible() == b) return; // nothing to do
mCurrentROIActor->SetContourVisible(b);
//------------------------------------------------------------------------------
-void vvToolROIManager::OpacityChanged(int v) {
+void vvToolROIManager::OpacityChanged(int v)
+{ //out << __func__ << endl;
if (mCurrentROIActor == NULL) return;
mCurrentROIActor->SetOpacity((double)v/100.0);
mCurrentROIActor->UpdateColor();
//------------------------------------------------------------------------------
-void vvToolROIManager::AllVisibleROIToggled(int b) {
+void vvToolROIManager::AllVisibleROIToggled(int b)
+{ //out << __func__ << endl;
bool status = false;
if ((mCheckBoxShowAll->checkState() == Qt::Checked) ||
(mCheckBoxShowAll->checkState() == Qt::PartiallyChecked)) status = true;
//------------------------------------------------------------------------------
-void vvToolROIManager::AllVisibleContourROIToggled(bool b) {
+void vvToolROIManager::AllVisibleContourROIToggled(bool b)
+{ //out << __func__ << endl;
bool status = false;
if ((mContourCheckBoxShowAll->checkState() == Qt::Checked) ||
(mContourCheckBoxShowAll->checkState() == Qt::PartiallyChecked)) status = true;
//------------------------------------------------------------------------------
-void vvToolROIManager::ChangeColor() {
+void vvToolROIManager::ChangeColor()
+{ //out << __func__ << endl;
if (mCurrentROIActor == NULL) return;
QColor color;
color.setRgbF(mCurrentROIActor->GetROI()->GetDisplayColor()[0],
//------------------------------------------------------------------------------
-void vvToolROIManager::ChangeContourColor() {
+void vvToolROIManager::ChangeContourColor()
+{ //out << __func__ << endl;
if (mCurrentROIActor == NULL) return;
QColor color;
color.setRgbF(mCurrentROIActor->GetContourColor()[0],
//------------------------------------------------------------------------------
-void vvToolROIManager::ChangeContourWidth(int n) {
+void vvToolROIManager::ChangeContourWidth(int n)
+{ //out << __func__ << endl;
if (mCurrentROIActor == NULL) return;
mCurrentROIActor->SetContourWidth(n);
mCurrentROIActor->UpdateColor();
//------------------------------------------------------------------------------
-void vvToolROIManager::ChangeDepth(int n) {
+void vvToolROIManager::ChangeDepth(int n)
+{ //out << __func__ << endl;
if (mCurrentROIActor == NULL) return;
mCurrentROIActor->SetDepth(n);
// mCurrentROIActor->UpdateImage(); // FIXME
//------------------------------------------------------------------------------
-void vvToolROIManager::ReloadCurrentROI() {
+void vvToolROIManager::ReloadCurrentROI()
+{ //out << __func__ << endl;
if (mCurrentROI->GetFilename() == "") {
return; // do nothing (contour from rt struct do not reload)
}
//------------------------------------------------------------------------------
void vvToolROIManager::SaveState(std::auto_ptr<QXmlStreamWriter> & m_XmlWriter)
-{
+{ //out << __func__ << endl;
// Get index of the image
int n = mMainWindow->GetSlicerManagers().size();
int index=-1;
//------------------------------------------------------------------------------
void vvToolROIManager::ReadXMLInformation()
-{
+{ //out << __func__ << endl;
std::string value="";
mInitialImageIndex = -1;
while (!(m_XmlReader->isEndElement() && value == GetToolName().toStdString())) {
//------------------------------------------------------------------------------
void vvToolROIManager::ReadXMLInformation_ROI()
-{
+{ //out << __func__ << endl;
QString s;
std::string value="";
QSharedPointer<vvROIActor> param = QSharedPointer<vvROIActor>(new vvROIActor);
vvToolWidgetBase::vvToolWidgetBase(vvMainWindowBase * parent, Qt::WindowFlags f, bool initialize):
QWidget(parent, f),
Ui::vvToolWidgetBase()
-{
+{ //out << __func__ << endl;
mMainWindow = parent;
setAttribute(Qt::WA_DeleteOnClose);
if (initialize) Initialization();
//------------------------------------------------------------------------------
void vvToolWidgetBase::Initialization()
-{
+{ //out << __func__ << endl;
mCurrentSlicerManager = 0;
mIsInitialized = false;
mFilter = 0;
//------------------------------------------------------------------------------
vvToolWidgetBase::~vvToolWidgetBase()
-{
+{ //out << __func__ << endl;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvToolWidgetBase::keyPressEvent(QKeyEvent *event)
-{
+{ //out << __func__ << endl;
if (event->key() == Qt::Key_Escape) {
reject();
event->accept();
//------------------------------------------------------------------------------
void vvToolWidgetBase::accept()
-{
+{ //out << __func__ << endl;
apply();
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvToolWidgetBase::reject()
-{
+{ //out << __func__ << endl;
close();
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvToolWidgetBase::AddInputSelector(QString s, clitk::ImageToImageGenericFilterBase * f, bool allowSkip)
-{
+{ //out << __func__ << endl;
int j=0;
mFilter = f;
mSlicerManagersCompatible.clear();
//------------------------------------------------------------------------------
void vvToolWidgetBase::AddInputSelector(QString s, bool allowSkip)
-{
+{ //out << __func__ << endl;
mSlicerManagersCompatible.clear();
for(unsigned int i=0; i<mMainWindow->GetSlicerManagers().size(); i++) {
mSlicerManagersCompatible.push_back(mMainWindow->GetSlicerManagers()[i]);
//------------------------------------------------------------------------------
void vvToolWidgetBase::HideInputSelector()
-{
+{ //out << __func__ << endl;
mToolInputSelectionWidget->hide();
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvToolWidgetBase::show()
-{
+{ //out << __func__ << endl;
if (!mIsInitialized) {
mToolInputSelectionWidget->Initialize();
mIsInitialized = true;
//------------------------------------------------------------------------------
void vvToolWidgetBase::closeEvent(QCloseEvent *event)
-{
+{ //out << __func__ << endl;
mIsAnotherToolWaitInput = false;
if (isWindow()) {
event->accept();//return QWidget::close();
//------------------------------------------------------------------------------
bool vvToolWidgetBase::close()
-{
+{ //out << __func__ << endl;
QApplication::restoreOverrideCursor();
return QWidget::close();
}
//------------------------------------------------------------------------------
void vvToolWidgetBase::AnImageIsBeingClosed(vvSlicerManager * m)
-{
+{ //out << __func__ << endl;
mToolInputSelectionWidget->AnImageIsBeingClosed(m);
if (m == mCurrentSlicerManager) {
close();
//------------------------------------------------------------------------------
void vvToolWidgetBase::SwapCurrentWidget()
-{
+{ //out << __func__ << endl;
mStaticWidgetForTab->setUpdatesEnabled(false);
QList<QObject*> l =mStaticWidgetForTab->children();
for(int i=1; i<l.size(); i++) {
//------------------------------------------------------------------------------
void vvToolWidgetBase::SelectedImageHasChanged(vvSlicerManager * m)
-{
+{ //out << __func__ << endl;
if (!isWindow()) { // When the tool is not in a window, it is in a tab : we only display if needed
if (mCurrentSlicerManager == NULL) return;
if (mToolWidget == NULL) return;
//------------------------------------------------------------------------------
void vvToolWidgetBase::InitializeInputs()
-{
+{ //out << __func__ << endl;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvToolWidgetBase::InputIsSelected()
-{
+{ //out << __func__ << endl;
mMainButtonBox->setEnabled(true);
std::vector<vvSlicerManager*> & l = mToolInputSelectionWidget->GetSelectedInputs();
mCurrentSlicerManager = l[0];
//------------------------------------------------------------------------------
void vvToolWidgetBase::InputIsSelected(vvSlicerManager * m)
-{
+{ //out << __func__ << endl;
std::cerr << "You MUST overwrite this method vvToolWidgetBase::InputIsSelected(vvSlicerManager * m) if you use one single input" << std::endl;
exit(0);
}
//------------------------------------------------------------------------------
void vvToolWidgetBase::InputIsSelected(std::vector<vvSlicerManager*> & l)
-{
+{ //out << __func__ << endl;
mMainButtonBox->setEnabled(true);
if (l.size() == 1) InputIsSelected(l[0]);
else {