X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=vv%2FvvToolBinarize.cxx;h=ae067180a5dcf85c2a5cacca54d23e821c1683bb;hb=5a80d16b4dc2ad2d825c443f39ae6276786e72e4;hp=09016f080e8d045f4e272c75bac2fc97c882b2a6;hpb=0410cde2a749710c2659d4c582d9fc0c332aced6;p=clitk.git diff --git a/vv/vvToolBinarize.cxx b/vv/vvToolBinarize.cxx index 09016f0..ae06718 100644 --- a/vv/vvToolBinarize.cxx +++ b/vv/vvToolBinarize.cxx @@ -1,29 +1,20 @@ /*========================================================================= + Program: vv http://www.creatis.insa-lyon.fr/rio/vv - Program: vv - Module: $RCSfile: vvToolBinarize.cxx,v $ - Language: C++ - Date: $Date: 2010/03/05 10:32:33 $ - Version: $Revision: 1.11 $ - Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr) + Authors belong to: + - University of LYON http://www.universite-lyon.fr/ + - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr + - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr - Copyright (C) 2008 - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr - CREATIS-LRMN 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. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, version 3 of the License. + It is distributed under dual licence - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - - =========================================================================*/ + - BSD See included LICENSE.txt file + - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +======================================================================-====*/ #include "vvToolBinarize.h" #include "vvSlicerManager.h" @@ -35,6 +26,7 @@ #include #include #include +#include //------------------------------------------------------------------------------ // Create the tool and automagically (I like this word) insert it in @@ -47,7 +39,7 @@ ADD_TOOL(vvToolBinarize); void vvToolBinarize::Initialize() { SetToolName("Binarize"); SetToolMenuName("Binarize"); - SetToolIconFilename(":/new/prefix1/icons/binarize.png"); + SetToolIconFilename(":/common/icons/binarize.png"); SetToolTip("Image interactive binarization with thresholds."); } //------------------------------------------------------------------------------ @@ -76,7 +68,10 @@ vvToolBinarize::vvToolBinarize(vvMainWindowBase * parent, Qt::WindowFlags f) mBGSlider->SetText("Background value"); // Main filter - mFilter = new clitk::BinarizeImageGenericFilter; //DS PUT IN BASECLASS ? + mFilter = new clitk::BinarizeImageGenericFilter; + + // Set how many inputs are needed for this tool + AddInputSelector("Select one image", mFilter); } //------------------------------------------------------------------------------ @@ -96,7 +91,8 @@ void vvToolBinarize::InteractiveDisplayToggled(bool b) { else { for(unsigned int i=0; ishowActors(); - mImageContourLower[i]->showActors(); + if (mRadioButtonLowerThan->isChecked()) + mImageContourLower[i]->showActors(); } if (mCurrentSlicerManager) mCurrentSlicerManager->Render(); @@ -127,6 +123,7 @@ bool vvToolBinarize::close() { //------------------------------------------------------------------------------ void vvToolBinarize::reject() { + // DD("vvToolBinarize::reject"); RemoveVTKObjects(); return vvToolWidgetBase::reject(); } @@ -163,6 +160,10 @@ void vvToolBinarize::useFGBGtoggled(bool) { //------------------------------------------------------------------------------ +// void vvToolBinarize::InputIsSelected(std::vector & m) { +// DD("vvToolBinarize::InputIsSelected vector in binarize"); +// DD(m.size()); +// } void vvToolBinarize::InputIsSelected(vvSlicerManager * m) { mCurrentSlicerManager = m; @@ -200,15 +201,28 @@ void vvToolBinarize::InputIsSelected(vvSlicerManager * m) { connect(mCurrentSlicerManager,SIGNAL(UpdateSlice(int,int)),this,SLOT(UpdateSlice(int, int))); connect(mCurrentSlicerManager,SIGNAL(UpdateTSlice(int,int)),this,SLOT(UpdateSlice(int, int))); + // connect(mCurrentSlicerManager, SIGNAL(LeftButtonReleaseSignal(int)), SLOT(LeftButtonReleaseEvent(int))); } //------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +// void vvToolBinarize::LeftButtonReleaseEvent(int slicer) { +// DD("LeftButtonReleaseEvent"); +// for(int i=0; iNumberOfSlicers(); i++) { +// if (i == slicer); +// mCurrentSlicerManager->GetSlicer(i)->GetRenderWindow()->Render(); +// } +// } +//------------------------------------------------------------------------------ + + //------------------------------------------------------------------------------ void vvToolBinarize::UpdateSlice(int slicer,int slices) { if (!mInteractiveDisplayIsEnabled) return; if (!mCurrentSlicerManager) close(); for(int i=0;iNumberOfSlicers(); i++) { + // DD(i); mImageContour[i]->update(mThresholdSlider1->GetValue()); if (mRadioButtonLowerThan->isChecked()) mImageContourLower[i]->update(mThresholdSlider2->GetValue()); @@ -218,6 +232,7 @@ void vvToolBinarize::UpdateSlice(int slicer,int slices) { } //------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvToolBinarize::GetArgsInfoFromGUI() { @@ -286,8 +301,9 @@ void vvToolBinarize::apply() { // Main filter clitk::BinarizeImageGenericFilter::Pointer filter = clitk::BinarizeImageGenericFilter::New(); - filter->SetArgsInfo(mArgsInfo); filter->SetInputVVImage(mCurrentImage); + filter->SetArgsInfo(mArgsInfo); + filter->EnableReadOnDisk(false); filter->Update(); // Output @@ -310,7 +326,7 @@ void vvToolBinarize::valueChangedT2(double v) { for(int i=0;iNumberOfSlicers(); i++) { mImageContourLower[i]->update(v); } - mCurrentSlicerManager->Render(); + // mCurrentSlicerManager->Render(); } } //------------------------------------------------------------------------------ @@ -326,6 +342,6 @@ void vvToolBinarize::valueChangedT1(double v) { for(int i=0;iNumberOfSlicers(); i++) { mImageContour[i]->update(v); } - mCurrentSlicerManager->Render(); + // mCurrentSlicerManager->Render(); } //------------------------------------------------------------------------------