From: dsarrut Date: Mon, 12 Jul 2010 06:56:50 +0000 (+0000) Subject: some small correction X-Git-Tag: v1.2.0~539 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=2b4229b2e82be6bd48817b0171afb2d69a9e9758;p=clitk.git some small correction --- diff --git a/vv/CMakeLists.txt b/vv/CMakeLists.txt index 9b1a005..a32e582 100644 --- a/vv/CMakeLists.txt +++ b/vv/CMakeLists.txt @@ -21,6 +21,7 @@ SET(vv_SRCS vvSurfaceViewerDialog.cxx vvMainWindowBase.cxx vvMainWindow.cxx + vvProgressDialog.cxx vvDeformationDialog.cxx vvImageWarp.cxx vvDeformableRegistration.cxx @@ -46,6 +47,7 @@ SET(vv_SRCS vvMidPosition.cxx vvImageMapToWLColors.cxx vvIntensityValueSlider.cxx + vvThreadedFilter.cxx vvToolManager.cxx vvToolCreatorBase.cxx vvToolWidgetBase.cxx @@ -96,6 +98,7 @@ QT4_WRAP_CPP(vv_SRCS vvSlicerManager.h vvStructSelector.h vvIntensityValueSlider.h + vvThreadedFilter.h vvToolCreatorBase.h # vvToolFoo.h # vvToolFooWithWidgetBase.h @@ -135,7 +138,7 @@ QT4_WRAP_UI(vv_UI_CXX qt_ui/vvStructSelector.ui qt_ui/vvDummyWindow.ui #For testing qt_ui/vvIntensityValueSlider.ui - qt_ui/vvToolSimpleInputSelectorWidget.ui +# qt_ui/vvToolSimpleInputSelectorWidget.ui qt_ui/vvToolInputSelectorWidget.ui qt_ui/vvToolWidgetBase.ui # qt_ui/vvToolWidgetWithStepsBase.ui diff --git a/vv/vv.cxx b/vv/vv.cxx index dc9e8b7..b30e97c 100644 --- a/vv/vv.cxx +++ b/vv/vv.cxx @@ -55,6 +55,7 @@ int main( int argc, char** argv ) std::vector filenames; std::vector > overlays; + std::vector > rois; std::vector > vector_fields; if (argc >1) { for (int i = 1; i < argc; i++) { @@ -63,12 +64,24 @@ int main( int argc, char** argv ) assert(filenames.size()>=1); vector_fields.push_back(std::make_pair(filenames.size()-1,argv[i+1])); i++; //skip vf name - } else if (temp=="--overlay") { - assert(filenames.size()>=1); - overlays.push_back(std::make_pair(filenames.size()-1,argv[i+1])); - i++; //skip overlay name - } else - filenames.push_back(temp); + } + else { + if (temp=="--overlay") { + assert(filenames.size()>=1); + overlays.push_back(std::make_pair(filenames.size()-1,argv[i+1])); + i++; //skip overlay name + } + else { + if (temp=="--roi") { + assert(filenames.size()>=1); + rois.push_back(std::make_pair(filenames.size()-1,argv[i+1])); + i++; //skip overlay name + } + else { + filenames.push_back(temp); + } + } + } } window.LoadImages(filenames,IMAGE); for (std::vector >::iterator i=overlays.begin(); @@ -77,6 +90,12 @@ int main( int argc, char** argv ) for (std::vector >::iterator i=vector_fields.begin(); i!=vector_fields.end(); i++) window.AddField((*i).second.c_str(), (*i).first); + for (std::vector >::iterator i=rois.begin(); + i!=rois.end(); i++) { + DD((*i).second.c_str()); + DD((*i).first); + // window.AddROI((*i).second.c_str(), (*i).first); + } } diff --git a/vv/vvLabelImageLoaderWidget.cxx b/vv/vvLabelImageLoaderWidget.cxx index b10f00f..a4b7e41 100644 --- a/vv/vvLabelImageLoaderWidget.cxx +++ b/vv/vvLabelImageLoaderWidget.cxx @@ -15,6 +15,7 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html ======================================================================-====*/ + #ifndef VVTOOLINPUTSELECTORWIDGET_CXX #define VVTOOLINPUTSELECTORWIDGET_CXX @@ -59,6 +60,14 @@ double vvLabelImageLoaderWidget::GetBackgroundValue() //------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +void vvLabelImageLoaderWidget::SetText(QString t) +{ + mOpenLabel->setText(t); +} +//------------------------------------------------------------------------------ + + //------------------------------------------------------------------------------ void vvLabelImageLoaderWidget::OpenImage() { diff --git a/vv/vvLabelImageLoaderWidget.h b/vv/vvLabelImageLoaderWidget.h index 1e0d25b..33b85eb 100644 --- a/vv/vvLabelImageLoaderWidget.h +++ b/vv/vvLabelImageLoaderWidget.h @@ -15,6 +15,7 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html ======================================================================-====*/ + #ifndef VVLABELIMAGELOADERWIDGET_H #define VVLABELIMAGELOADERWIDGET_H @@ -38,6 +39,7 @@ class vvLabelImageLoaderWidget: public QWidget, private Ui::vvLabelImageLoaderWi vvImage::Pointer GetImage(); double GetBackgroundValue(); + void SetText(QString t); signals: void accepted(); diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index 1948e79..bf56a35 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -754,7 +754,7 @@ void vvMainWindow::LoadImages(std::vector files, LoadedImageType fi //open images as 1 or multiples for (int i = 0; i < fileSize; i++) { - progress.Update("Opening " + files[i]); + progress.SetText("Opening " + files[i]); progress.SetProgress(i,fileSize); qApp->processEvents(); diff --git a/vv/vvProgressDialog.h b/vv/vvProgressDialog.h index 7742773..9906041 100644 --- a/vv/vvProgressDialog.h +++ b/vv/vvProgressDialog.h @@ -15,38 +15,25 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html ======================================================================-====*/ -#ifndef vvProgressDialog_h -#define vvProgressDialog_h + +#ifndef VVPROGRESSDIALOG_H +#define VVPROGRESSDIALOG_H + +// vv #include "ui_vvProgressDialog.h" -#include -class vvProgressDialog : public QDialog, private Ui::vvProgressDialog +class vvProgressDialog : + public QDialog, + private Ui::vvProgressDialog { Q_OBJECT public: - vvProgressDialog(std::string message,bool show_progress=false) { - setupUi(this); - textLabel->setText(message.c_str()); - if (show_progress) - progressBar->show(); - else - progressBar->hide(); - this->show(); - } - void Update(std::string message) - { - textLabel->setText(message.c_str()); - } - void SetProgress(unsigned int current,unsigned int max) - { - progressBar->setMaximum(max); - progressBar->setValue(current); - } + vvProgressDialog(std::string message,bool show_progress=false); ~vvProgressDialog() {} - -public slots: - + void SetText(std::string message); + void AddToText(std::string message); + void SetProgress(unsigned int current,unsigned int max); }; #endif diff --git a/vv/vvToolExtractLung.cxx b/vv/vvToolExtractLung.cxx index 7c78a0a..0b29ca9 100644 --- a/vv/vvToolExtractLung.cxx +++ b/vv/vvToolExtractLung.cxx @@ -23,7 +23,7 @@ #include "vvImageReader.h" #include "vvImageWriter.h" #include "vvLabelImageLoaderWidget.h" -#include "vvProgressDialog.h" +#include "vvThreadedFilter.h" // Qt #include @@ -45,6 +45,7 @@ vvToolExtractLung::vvToolExtractLung(vvMainWindowBase * parent, Qt::WindowFlags Ui_vvToolExtractLung::setupUi(mToolWidget); mMaskLoaderBox->setEnabled(false); mOptionsBox->setEnabled(false); + mPatientMaskInputWidget->SetText("Patient mask"); connect(mPatientMaskInputWidget, SIGNAL(accepted()), this, SLOT(PatientMaskInputIsSelected())); // Default values @@ -54,7 +55,7 @@ vvToolExtractLung::vvToolExtractLung(vvMainWindowBase * parent, Qt::WindowFlags mFilter = FilterType::New(); // Add input selector - AddInputSelector("Select image", mFilter); + AddInputSelector("Select CT thorax image", mFilter); } //------------------------------------------------------------------------------ @@ -137,12 +138,15 @@ void vvToolExtractLung::apply() mFilter->SetArgsInfo(mArgsInfo); DD("mfilter->Update"); - // vvThreadedFilter a; - // a->SetFilter(mFilter) + vvThreadedFilter thread; + // thread.SetFilter((clitk::FilterBase*)&(*mFilter)); + // thread.SetFilter((clitk::FilterBase*)&(*mFilter)); + thread.SetFilter(&(*mFilter)); // connect(a, SIGNAL(rejected()), this, SLOT(FilterHasBeenCanceled())); - // a->Update(); + thread.Update(); // if (a->HasError()) { DD(a->GetError()); return; } - mFilter->Update(); + // mFilter->Update(); + DD("after thread"); // Check error if (mFilter->HasError()) { @@ -155,6 +159,12 @@ void vvToolExtractLung::apply() std::vector output = mFilter->GetOutputVVImages(); DD(output.size()); + if (output.size() == 0) { + std::cerr << "Error : no output ?" << std::endl; + close(); + return; + } + // Set Lung into VV DD("lung"); vvImage::Pointer lung = output[0]; diff --git a/vv/vvToolInputSelectorWidget.cxx b/vv/vvToolInputSelectorWidget.cxx index 35de7bf..9495705 100644 --- a/vv/vvToolInputSelectorWidget.cxx +++ b/vv/vvToolInputSelectorWidget.cxx @@ -17,6 +17,7 @@ ======================================================================-====*/ #ifndef VVTOOLINPUTSELECTORWIDGET_CXX #define VVTOOLINPUTSELECTORWIDGET_CXX + #include "vvToolSimpleInputSelectorWidget.h" #include "vvToolInputSelectorWidget.h" #include "vvSlicerManager.h" diff --git a/vv/vvToolPlastimatch.cxx b/vv/vvToolPlastimatch.cxx index 466d43e..fd156f3 100644 --- a/vv/vvToolPlastimatch.cxx +++ b/vv/vvToolPlastimatch.cxx @@ -194,13 +194,18 @@ void vvToolPlastimatch::apply() */ // Get warped output and display it - m_WarpedImage = vvImageFromITK<3, float>(m_WarpedImageITK); - std::ostringstream osstream; - osstream << "plm_warped_" << m_InputSlicerManagers[1]->GetFileName() << ".mhd"; - AddImage(m_WarpedImage, osstream.str()); - - // Get DVF - DD("TODO get and display DVF"); + if (m_WarpedImageITK) { + m_WarpedImage = vvImageFromITK<3, float>(m_WarpedImageITK); + std::ostringstream osstream; + osstream << "plm_warped_" << m_InputSlicerManagers[1]->GetFileName() << ".mhd"; + AddImage(m_WarpedImage, osstream.str()); + + // Get DVF + DD("TODO get and display DVF"); + } + else { + QMessageBox::information(this, "Error", "No result ..."); + } // End QApplication::restoreOverrideCursor(); diff --git a/vv/vvToolRigidReg.cxx b/vv/vvToolRigidReg.cxx index b6525f7..3a533ea 100644 --- a/vv/vvToolRigidReg.cxx +++ b/vv/vvToolRigidReg.cxx @@ -15,23 +15,27 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html ======================================================================-====*/ + +// vv #include "vvToolRigidReg.h" -#include -#include -#include +#include "vvImageReader.h" +#include "vvSlicer.h" + +// vtk #include #include #include -#include -#include "vvImage.h" -#include "vvSlicer.h" -#include + +// clitk #include "clitkTransformUtilities.h" -#include + +// qt #include -#include #include #include +#include +#include + //------------------------------------------------------------------------------ // Create the tool and automagically (I like this word) insert it in // the main window menu. @@ -46,10 +50,10 @@ vvToolRigidReg::vvToolRigidReg(vvMainWindowBase * parent, Qt::WindowFlags f): { // GUI Initialization Ui_vvToolRigidReg::setupUi(mToolWidget); - QSize qsize; - qsize.setHeight(470); - qsize.setWidth(850); - mToolWidget->setFixedSize(qsize); + // QSize qsize; +// qsize.setHeight(470); +// qsize.setWidth(850); +// mToolWidget->setFixedSize(qsize); // Set how many inputs are needed for this tool @@ -389,8 +393,8 @@ void vvToolRigidReg::SaveFile() { //Write the Transformation Matrix QString f1 = QFileDialog::getSaveFileName(this, tr("Save Transformation Matrix File"), - "/home", - tr("Text (*.mat *.txt *.doc *.rtf)")); + mMainWindow->GetInputPathName(), + tr("Text (*.mat *.txt *.doc *.rtf)")); QFile file1(f1); std::vector transparameters; QString line1; @@ -429,7 +433,7 @@ void vvToolRigidReg::ReadFile() QString file1 = QFileDialog::getOpenFileName( this, "Choose the Transformation Parameters file", - "/home", + mMainWindow->GetInputPathName(), "Text (*.mat *.txt *.rtf *.doc)"); if (file1.isEmpty()) return; diff --git a/vv/vvToolWidgetBase.cxx b/vv/vvToolWidgetBase.cxx index 58ff83c..a529b97 100644 --- a/vv/vvToolWidgetBase.cxx +++ b/vv/vvToolWidgetBase.cxx @@ -197,7 +197,10 @@ void vvToolWidgetBase::AddInputSelector(QString s, clitk::ImageToImageGenericFil } } if (mSlicerManagersCompatible.size() == 0) { - QMessageBox::information(this, "No image","Sorry, could not perform operation. No (compatible) image."); + std::ostringstream osstream; + osstream << "Sorry, could not perform operation. No (compatible) image. " + << mFilter->GetAvailableImageTypes(); + QMessageBox::information(this, "No image", osstream.str().c_str()); reject(); return; } @@ -295,6 +298,7 @@ void vvToolWidgetBase::closeEvent(QCloseEvent *event) bool vvToolWidgetBase::close() { // DD("vvToolWidgetBase::close()"); + QApplication::restoreOverrideCursor(); return QWidget::close(); } //------------------------------------------------------------------------------