From: tbaudier Date: Fri, 10 Feb 2017 15:13:21 +0000 (+0100) Subject: Add histogram tool X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=76f43aa4f38939f58b05de5c49399b8ce19076cc;p=clitk.git Add histogram tool --- diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 422d8f9..f2cc79c 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -12,6 +12,9 @@ add_library(clitkBinarizeImageLib clitkBinarizeImageGenericFilter.cxx ${clitkBin WRAP_GGO(clitkProfileImage_GGO_C clitkProfileImage.ggo) add_library(clitkProfileImageLib clitkProfileImageGenericFilter.cxx ${clitkProfileImage_GGO_C}) +WRAP_GGO(clitkHistogramImage_GGO_C clitkHistogramImage.ggo) +add_library(clitkHistogramImageLib clitkHistogramImageGenericFilter.cxx ${clitkHistogramImage_GGO_C}) + WRAP_GGO(clitkImageArithm_GGO_C clitkImageArithm.ggo) add_library(clitkImageArithmImageLib clitkImageArithmGenericFilter.cxx ${clitkImageArithm_GGO_C}) diff --git a/tools/clitkHistogramImage.cxx b/tools/clitkHistogramImage.cxx new file mode 100644 index 0000000..0cb5ac9 --- /dev/null +++ b/tools/clitkHistogramImage.cxx @@ -0,0 +1,41 @@ +/*========================================================================= + 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 +===========================================================================**/ + +// clitk +#include "clitkHistogramImage_ggo.h" +#include "clitkHistogramImageGenericFilter.h" + +//-------------------------------------------------------------------- +int main(int argc, char * argv[]) +{ + + // Init command line + GGO(clitkHistogramImage, args_info); + CLITK_INIT; + + // Filter + typedef clitk::HistogramImageGenericFilter FilterType; + FilterType::Pointer filter = FilterType::New(); + + filter->SetArgsInfo(args_info); + + CLITK_TRY_CATCH_EXIT(filter->Update()); + + return EXIT_SUCCESS; +} // This is the end, my friend +//-------------------------------------------------------------------- diff --git a/tools/clitkHistogramImage.ggo b/tools/clitkHistogramImage.ggo new file mode 100644 index 0000000..6689677 --- /dev/null +++ b/tools/clitkHistogramImage.ggo @@ -0,0 +1,15 @@ +#File clitkHistogramImage.ggo +package "clitkHistogramImage" +version "1.0" +purpose "Save the histogram of the input image in the output text file" + +option "config" - "Config file" string no +option "verbose" v "Verbose" flag off +option "imagetypes" - "Display allowed image types" flag off + +option "input" i "Input image filename" string yes +option "output" o "Output texte filename" string yes +option "size" s "size of the bin" double no + + + diff --git a/tools/clitkHistogramImageGenericFilter.cxx b/tools/clitkHistogramImageGenericFilter.cxx new file mode 100644 index 0000000..49e3fa0 --- /dev/null +++ b/tools/clitkHistogramImageGenericFilter.cxx @@ -0,0 +1,165 @@ +/*========================================================================= + 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 clitkHistogramImageGenericFilter_cxx +#define clitkHistogramImageGenericFilter_cxx + +/* ================================================= + * @file clitkHistogramImageGenericFilter.cxx + * @author Thomas Baudier + * @date 22 dec 2015 + * + * @brief + * + ===================================================*/ + +#include "clitkHistogramImageGenericFilter.h" + +// itk include +#include +#include + +#include + + + +namespace clitk +{ + +//-------------------------------------------------------------------- +HistogramImageGenericFilter::HistogramImageGenericFilter(): + ImageToImageGenericFilter("HistogramImage") +{ + InitializeImageType<2>(); + InitializeImageType<3>(); + InitializeImageType<4>(); + mBinSize = 100; +} +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- +template +void HistogramImageGenericFilter::InitializeImageType() +{ + ADD_DEFAULT_IMAGE_TYPES(Dim); +} +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- +vtkFloatArray* HistogramImageGenericFilter::GetArrayX() +{ + return(mArrayX); +} +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- +vtkFloatArray* HistogramImageGenericFilter::GetArrayY() +{ + return(mArrayY); +} +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- +void HistogramImageGenericFilter::SetArgsInfo(const args_info_type & a) +{ + mArgsInfo=a; + if (mArgsInfo.verbose_given) + SetIOVerbose(mArgsInfo.verbose_flag); + if (mArgsInfo.imagetypes_given && mArgsInfo.imagetypes_flag) + this->PrintAvailableImageTypes(); + + if (mArgsInfo.input_given) { + SetInputFilename(mArgsInfo.input_arg); + } + if (mArgsInfo.output_given) { + SetOutputFilename(mArgsInfo.output_arg); + } + if (mArgsInfo.size_given) { + SetSizeBin(mArgsInfo.size_arg); + } +} +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- +void HistogramImageGenericFilter::SetSizeBin(const double size) +{ + mBinSize = size; +} +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- +// Update with the number of dimensions and the pixeltype +//-------------------------------------------------------------------- +template +void +HistogramImageGenericFilter::UpdateWithInputImageType() +{ + + // Reading input + typename InputImageType::Pointer input = this->template GetInput(0); + typedef typename InputImageType::PixelType PixelType; + typedef typename InputImageType::IndexType IndexType; + typedef typename itk::Statistics::ImageToHistogramFilter HistogramFilterType; + typedef typename itk::StatisticsImageFilter StatisticsImageFilterType; + + //compute range + typename StatisticsImageFilterType::Pointer statisticsImageFilter = StatisticsImageFilterType::New (); + statisticsImageFilter->SetInput(input); + statisticsImageFilter->Update(); + double range = statisticsImageFilter->GetMaximum() - statisticsImageFilter->GetMinimum(); + //compute bin number + typedef typename HistogramFilterType::HistogramSizeType SizeType; + SizeType binNumber(1); + mBinSize = std::log(range); + binNumber[0] = (int)(range/mBinSize); + if (binNumber[0] == 0) + binNumber[0] = 1; + + //compute histogram + typename HistogramFilterType::Pointer histogramFilter = HistogramFilterType::New(); + histogramFilter->SetHistogramSize(binNumber); + histogramFilter->SetAutoMinimumMaximum(true); + typename HistogramFilterType::HistogramMeasurementVectorType lowerBound(1); + typename HistogramFilterType::HistogramMeasurementVectorType upperBound(1); + lowerBound[0] = statisticsImageFilter->GetMinimum(); + upperBound[0] = statisticsImageFilter->GetMaximum(); + histogramFilter->SetHistogramBinMinimum(lowerBound); + histogramFilter->SetHistogramBinMaximum(upperBound); + histogramFilter->SetInput(input); + histogramFilter->Update(); + + mArrayX = vtkSmartPointer::New(); + mArrayY = vtkSmartPointer::New(); + + for(unsigned int i = 0; i < histogramFilter->GetOutput()->GetSize()[0]; ++i) + { + mArrayY->InsertNextTuple1(histogramFilter->GetOutput()->GetFrequency(i)); + mArrayX->InsertNextTuple1(statisticsImageFilter->GetMinimum() + (i+0.5)*mBinSize); + } +} +//-------------------------------------------------------------------- + + +}//end clitk + +#endif //#define clitkHistogramImageGenericFilter_cxx diff --git a/tools/clitkHistogramImageGenericFilter.h b/tools/clitkHistogramImageGenericFilter.h new file mode 100644 index 0000000..d963fbc --- /dev/null +++ b/tools/clitkHistogramImageGenericFilter.h @@ -0,0 +1,79 @@ +/*========================================================================= + 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 clitkHistogramImageGenericFilter_h +#define clitkHistogramImageGenericFilter_h + +#include "clitkIO.h" +#include "clitkImageToImageGenericFilter.h" +#include "clitkHistogramImage_ggo.h" + +#include +#include +#include + +//-------------------------------------------------------------------- +namespace clitk +{ + + class ITK_EXPORT HistogramImageGenericFilter: + public ImageToImageGenericFilter + { + + public: + //-------------------------------------------------------------------- + typedef HistogramImageGenericFilter Self; + typedef itk::SmartPointer Pointer; + typedef itk::SmartPointer ConstPointer; + typedef args_info_clitkHistogramImage args_info_type; + + //-------------------------------------------------------------------- + // Method for creation through the object factory + // and Run-time type information (and related methods) + itkNewMacro(Self); + itkTypeMacro(HistogramImageGenericFilter, LightObject); + + //-------------------------------------------------------------------- + void SetArgsInfo(const args_info_type & a); + void SetSizeBin (const double size); + + //-------------------------------------------------------------------- + // Main function called each time the filter is updated + template + void UpdateWithInputImageType(); + + vtkFloatArray* GetArrayX(); + vtkFloatArray* GetArrayY(); + + protected: + HistogramImageGenericFilter(); + template void InitializeImageType(); + args_info_type mArgsInfo; + + double mBinSize; + + vtkSmartPointer mArrayX; + vtkSmartPointer mArrayY; + + }; // end class + //-------------------------------------------------------------------- + +} // end namespace clitk +//-------------------------------------------------------------------- + +#endif // #define clitkHistogramImageGenericFilter_h diff --git a/vv/CMakeLists.txt b/vv/CMakeLists.txt index f43f41a..1374745 100644 --- a/vv/CMakeLists.txt +++ b/vv/CMakeLists.txt @@ -22,6 +22,7 @@ set(vv_TOOLS vvToolROIManager vvToolSegmentation vvToolProfile + vvToolHistogram ## these ones are for tests (not working) # vvToolTest # vvToolFoo @@ -38,6 +39,7 @@ set(vv_TOOLS # >> add the relevant $_LIBS variable to the tool that has dependencies? set(vvToolBinarize_LIBS clitkBinarizeImageLib) set(vvToolProfile_LIBS clitkProfileImageLib) +set(vvToolHistogram_LIBS clitkHistogramImageLib) set(vvToolResample_LIBS clitkResampleImageLib) set(vvToolConvert_LIBS clitkImageConvertLib) set(vvToolExtractPatient_LIBS clitkSegmentationGgoLib) diff --git a/vv/icons/histogram.png b/vv/icons/histogram.png new file mode 100644 index 0000000..2690413 Binary files /dev/null and b/vv/icons/histogram.png differ diff --git a/vv/qt_ui/vvToolHistogram.ui b/vv/qt_ui/vvToolHistogram.ui new file mode 100644 index 0000000..01851e0 --- /dev/null +++ b/vv/qt_ui/vvToolHistogram.ui @@ -0,0 +1,106 @@ + + + vvToolHistogram + + + + 0 + 0 + 506 + 452 + + + + Histogram image + + + + + + + + 6 + + + + + + + + 0 + 0 + + + + Save Histogram + + + + + + + + + + + + 0 + 0 + + + + + 200 + 0 + + + + + + + + + + + + + + + + + + + + + + Qt::Horizontal + + + + + + + + 0 + 300 + + + + true + + + + + + + + + + QVTKWidget + QWidget +
QVTKWidget.h
+
+
+ + +
diff --git a/vv/vvIcons.qrc b/vv/vvIcons.qrc index a5e31cc..6bb8c93 100644 --- a/vv/vvIcons.qrc +++ b/vv/vvIcons.qrc @@ -13,6 +13,7 @@ icons/1b.png icons/binarize.png icons/profile.png + icons/histogram.png icons/resample.png icons/crop.png icons/splashscreen2.png diff --git a/vv/vvToolHistogram.cxx b/vv/vvToolHistogram.cxx new file mode 100644 index 0000000..e9418c4 --- /dev/null +++ b/vv/vvToolHistogram.cxx @@ -0,0 +1,327 @@ +/*========================================================================= + 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 + ===========================================================================**/ + +#include +#include + +#include + +// vv +#include "vvToolHistogram.h" +#include "vvProgressDialog.h" +#include "vvSlicerManager.h" +#include "vvSlicer.h" +#include "vvToolInputSelectorWidget.h" + +// vtk +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#ifdef Q_OS_OSX +# include "vvOSXHelper.h" +#endif + +//------------------------------------------------------------------------------ +// Create the tool and automagically (I like this word) insert it in +// the main window menu. +ADD_TOOL(vvToolHistogram); +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +void vvToolHistogram::Initialize() +{ + SetToolName("Histogram"); + SetToolMenuName("Intensity Histogram"); + SetToolIconFilename(":/common/icons/histogram.png"); + SetToolTip("Display the histogram of the image."); + SetToolExperimental(false); +} +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +vvToolHistogram::vvToolHistogram(vvMainWindowBase * parent, Qt::WindowFlags f) + :vvToolWidgetBase(parent,f), + vvToolBase(parent), + Ui::vvToolHistogram() +{ + // GUI Initialization + Ui_vvToolHistogram::setupUi(mToolWidget); + + // Connect signals & slots + connect(mSaveHistogramButton, SIGNAL(clicked()), this, SLOT(SaveAs())); + + // Initialize some widget + HistogramWidget->hide(); + + mView = vtkSmartPointer::New(); + vtkSmartPointer chart = vtkSmartPointer::New(); + chart->SetAutoSize(false); + chart->SetRenderEmpty(true); + mView->GetScene()->AddItem(chart); + this->HistogramWidget->GetRenderWindow()->GetRenderers()->RemoveAllItems(); + this->HistogramWidget->GetRenderWindow()->AddRenderer(mView->GetRenderer()); + HistogramWidget->show(); + +#ifdef Q_OS_OSX + disableGLHiDPI(HistogramWidget->winId()); +#endif + + // Main filter + mFilter = clitk::HistogramImageGenericFilter::New(); + + // Set how many inputs are needed for this tool + AddInputSelector("Select one image", mFilter); +} +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +vvToolHistogram::~vvToolHistogram() +{ +} +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +void vvToolHistogram::computeHistogram() +{ + if (!mCurrentSlicerManager) close(); + QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); + GetArgsInfoFromGUI(); + HistogramWidget->hide(); + + // Main filter + mFilter->SetInputVVImage(mCurrentImage); + mFilter->SetArgsInfo(mArgsInfo); + mFilter->Update(); + + //Creation of the XY chart + vtkSmartPointer table = vtkSmartPointer::New(); + vtkSmartPointer arrX = vtkSmartPointer::New(); + vtkSmartPointer arrY = vtkSmartPointer::New(); + arrX = mFilter->GetArrayX(); + arrY = mFilter->GetArrayY(); + arrX->SetName("Intensity"); + arrY->SetName("#Voxels"); + + table->AddColumn(arrX); + table->AddColumn(arrY); + + mView->GetRenderer()->SetBackground(1.0, 1.0, 1.0); + + vtkSmartPointer chart = vtkSmartPointer::New(); + chart->SetAutoSize(true); + mView->GetScene()->ClearItems(); + mView->GetScene()->AddItem(chart); + vtkPlot *line = chart->AddPlot(vtkChart::LINE); +#if VTK_MAJOR_VERSION <= 5 + line->SetInput(table, 0, 1); +#else + line->SetInputData(table, 0, 1); +#endif + line->SetColor(0, 255, 0, 255); + line->SetWidth(1.0); + chart->GetAxis(vtkAxis::LEFT)->SetTitle("#Voxels"); + chart->GetAxis(vtkAxis::BOTTOM)->SetTitle("Intensity"); + + this->HistogramWidget->GetRenderWindow()->GetRenderers()->RemoveAllItems(); + this->HistogramWidget->GetRenderWindow()->AddRenderer(mView->GetRenderer()); + HistogramWidget->show(); + + QApplication::restoreOverrideCursor(); +} +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +void vvToolHistogram::RemoveVTKObjects() +{ + if (mCurrentSlicerManager) + { + connect(mCurrentSlicerManager, SIGNAL(callAddLandmark(float,float,float,float)), mCurrentSlicerManager, SLOT(AddLandmark(float,float,float,float))); + + mCurrentSlicerManager->Render(); + } +} +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +bool vvToolHistogram::close() +{ + //RemoveVTKObjects(); + + return vvToolWidgetBase::close(); +} +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +void vvToolHistogram::closeEvent(QCloseEvent *event) +{ + RemoveVTKObjects(); + event->accept(); +} +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +void vvToolHistogram::reject() +{ + // DD("vvToolHistogram::reject"); + RemoveVTKObjects(); + return vvToolWidgetBase::reject(); +} +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +void vvToolHistogram::InputIsSelected(vvSlicerManager * m) +{ + mCurrentSlicerManager = m; + + mSaveHistogramButton->setEnabled(true); + mTextFileName = "Histogram.txt"; + + computeHistogram(); + + disconnect(mCurrentSlicerManager, SIGNAL(callAddLandmark(float,float,float,float)), mCurrentSlicerManager, SLOT(AddLandmark(float,float,float,float))); +} +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +void vvToolHistogram::GetArgsInfoFromGUI() +{ + + /* //KEEP THIS FOR READING GGO FROM FILE + int argc=1; + std::string a = "toto"; + char * const* argv = new char*; + //a.c_str(); + struct cmdline_parser_params p; + p.check_required = 0; + int good = cmdline_parser_ext(argc, argv, &args_info, &p); + DD(good); + */ + cmdline_parser_clitkHistogramImage_init(&mArgsInfo); // Initialisation to default + + mArgsInfo.verbose_flag = false; + + // Required (even if not used) + mArgsInfo.input_given = 0; + mArgsInfo.output_given = 0; + + mArgsInfo.input_arg = new char; + mArgsInfo.output_arg = new char; + +} +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +void vvToolHistogram::apply() +{ + close(); +} +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +void vvToolHistogram::SaveAs() +{ + QStringList OutputListeFormat; + OutputListeFormat.clear(); + OutputListeFormat.push_back(".txt"); + + QString Extensions = "AllFiles(*.*)"; + for (int i = 0; i < OutputListeFormat.count(); i++) { + Extensions += ";;Text File ( *"; + Extensions += OutputListeFormat[i]; + Extensions += ")"; + } + QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), mTextFileName.c_str(), Extensions); + if (!fileName.isEmpty()) { + std::string fileformat = itksys::SystemTools::GetFilenameLastExtension(fileName.toStdString()); + QString fileQFormat = fileformat.c_str(); + if (OutputListeFormat.contains(fileformat.c_str()) || fileQFormat.isEmpty()) { + QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); + std::string action = "Saving"; + vvProgressDialog progress("Saving "+fileName.toStdString()); + qApp->processEvents(); + + if (!mCurrentSlicerManager) { + close(); + return; + } + + // Output + mTextFileName = fileName.toStdString(); + if (fileQFormat.isEmpty()) + mTextFileName += ".txt"; + ofstream fileOpen(mTextFileName.c_str(), std::ofstream::trunc); + + if(!fileOpen) { + cerr << "Error during saving" << endl; + QApplication::restoreOverrideCursor(); + close(); + return; + } + + vtkSmartPointer arrX = vtkSmartPointer::New(); + vtkSmartPointer arrY = vtkSmartPointer::New(); + vtkSmartPointer coords = vtkSmartPointer::New(); + arrX = mFilter->GetArrayX(); + arrY = mFilter->GetArrayY(); + int i(0); + fileOpen << "Value represents the number of voxels around the corresponding intensity (by default the windows size around intensity is log(range))" << endl; + fileOpen << "Intensity" << "\t" << "Value" << endl; + + while (iGetNumberOfTuples()) { + fileOpen << arrX->GetTuple(i)[0] << "\t" << arrY->GetTuple(i)[0] << endl; + ++i; + } + + fileOpen.close(); + QApplication::restoreOverrideCursor(); + } else { + QString error = fileformat.c_str(); + error += " format unknown !!!\n"; + QMessageBox::information(this,tr("Saving Problem"),error); + SaveAs(); + } + } +} +//------------------------------------------------------------------------------ diff --git a/vv/vvToolHistogram.h b/vv/vvToolHistogram.h new file mode 100644 index 0000000..c567862 --- /dev/null +++ b/vv/vvToolHistogram.h @@ -0,0 +1,75 @@ +/*========================================================================= + 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 VVTOOLHISTOGRAM_H +#define VVTOOLHISTOGRAM_H + +#include +#include + +#include "vvToolBase.h" +#include "vvToolWidgetBase.h" +#include "ui_vvToolHistogram.h" + +#include "clitkHistogramImage_ggo.h" +#include "clitkHistogramImageGenericFilter.h" +#include +#include +#include + +//------------------------------------------------------------------------------ +class vvToolHistogram: + public vvToolWidgetBase, + public vvToolBase, + private Ui::vvToolHistogram +{ + Q_OBJECT + public: + vvToolHistogram(vvMainWindowBase * parent=0, Qt::WindowFlags f=0); + ~vvToolHistogram(); + + //----------------------------------------------------- + static void Initialize(); + void GetArgsInfoFromGUI(); + virtual void InputIsSelected(vvSlicerManager * m); + + void computeHistogram(); + void SetPoints(); + + //----------------------------------------------------- + public slots: + virtual void apply(); + virtual bool close(); + virtual void reject(); + + void SaveAs(); + + protected: + void RemoveVTKObjects(); + virtual void closeEvent(QCloseEvent *event); + Ui::vvToolHistogram ui; + args_info_clitkHistogramImage mArgsInfo; + + vtkSmartPointer mView; + clitk::HistogramImageGenericFilter::Pointer mFilter; + std::string mTextFileName; + +}; // end class vvToolHistogram +//------------------------------------------------------------------------------ + +#endif +