diff --git a/.clang-format b/.clang-format index 9f7a0d31..dba60d76 100644 --- a/.clang-format +++ b/.clang-format @@ -7,7 +7,7 @@ AllowShortFunctionsOnASingleLine: true AllowShortIfStatementsOnASingleLine: false AllowShortLoopsOnASingleLine: false AlignEscapedNewlines: Right -AlignAfterOpenBracket: Align +AlignAfterOpenBracket: DontAlign AlwaysBreakAfterReturnType: None BreakBeforeBinaryOperators: None BreakBeforeBraces: Custom @@ -23,7 +23,9 @@ BraceWrapping: BeforeElse: true IndentBraces: false SplitEmptyFunction: true -BreakBeforeInheritanceComma: false +BreakBeforeInheritanceComma: true +BreakConstructorInitializers: BeforeColon +PointerAlignment: Left CompactNamespaces: true Cpp11BracedListStyle: true FixNamespaceComments: true @@ -32,7 +34,7 @@ SortIncludes: true IndentCaseLabels: false IndentPPDirectives: AfterHash IndentWrappedFunctionNames: true -KeepEmptyLinesAtTheStartOfBlocks: false +KeepEmptyLinesAtTheStartOfBlocks: true NamespaceIndentation: None ReflowComments: false IndentWidth: 2 @@ -47,3 +49,4 @@ SpaceBeforeParens: ControlStatements SpaceInEmptyParentheses: false SpacesInAngles: false MaxEmptyLinesToKeep: 1 +ColumnLimit: 0 \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index febccc57..38660077 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,8 +70,8 @@ INCLUDE_DIRECTORIES( ) ADD_SUBDIRECTORY(Thirdparty) +ADD_SUBDIRECTORY(Interface) ADD_SUBDIRECTORY(Core) -ADD_SUBDIRECTORY(Plugin) ADD_SUBDIRECTORY(iSeg) ADD_SUBDIRECTORY(Plugins) diff --git a/Core/BranchItem.h b/Core/BranchItem.h index 274f47da..126087e6 100755 --- a/Core/BranchItem.h +++ b/Core/BranchItem.h @@ -11,9 +11,10 @@ #include "iSegCore.h" -#include "Point.h" #include "Vec3.h" +#include "Interface/Point.h" + #include #include #include diff --git a/Core/Contour.h b/Core/Contour.h index 3e4634af..21cf2004 100755 --- a/Core/Contour.h +++ b/Core/Contour.h @@ -11,7 +11,7 @@ #include "iSegCore.h" -#include "Point.h" +#include "Interface/Point.h" #include #include diff --git a/Core/FeatureExtractor.h b/Core/FeatureExtractor.h index c5397978..e35602d4 100755 --- a/Core/FeatureExtractor.h +++ b/Core/FeatureExtractor.h @@ -12,7 +12,8 @@ #include "iSegCore.h" #include "Pair.h" -#include "Point.h" + +#include "Interface/Point.h" namespace iseg { diff --git a/Core/ImageForestingTransform.h b/Core/ImageForestingTransform.h index 15669634..4476e068 100755 --- a/Core/ImageForestingTransform.h +++ b/Core/ImageForestingTransform.h @@ -9,8 +9,9 @@ */ #pragma once +#include "Interface/Point.h" + #include "Core/IndexPriorityQueue.h" -#include "Core/Point.h" #include #include diff --git a/Core/LoadPlugin.cpp b/Core/LoadPlugin.cpp index df1771a3..4a264a00 100755 --- a/Core/LoadPlugin.cpp +++ b/Core/LoadPlugin.cpp @@ -179,6 +179,8 @@ bool LoadPlugin(const std::string& plugin_file_path) bool LoadPlugins(const std::string& directory_path) { + std::cerr << "LoadPlugins: " << directory_path << std::endl; + bool ok = true; try { diff --git a/Core/Mark.h b/Core/Mark.h index 6be0fc0d..3d7ceb01 100755 --- a/Core/Mark.h +++ b/Core/Mark.h @@ -11,7 +11,8 @@ #include "iSegCore.h" -#include "Point.h" +#include "Interface/Point.h" + #include namespace iseg { diff --git a/Core/Outline.h b/Core/Outline.h index 6a440977..3237cfe1 100755 --- a/Core/Outline.h +++ b/Core/Outline.h @@ -9,10 +9,12 @@ */ #pragma once +#include "iSegCore.h" + #include "Pair.h" -#include "Point.h" #include "Types.h" -#include "iSegCore.h" + +#include "Interface/Point.h" #include #include diff --git a/Core/sliceprovider.cpp b/Core/SliceProvider.cpp similarity index 100% rename from Core/sliceprovider.cpp rename to Core/SliceProvider.cpp diff --git a/Core/sliceprovider.h b/Core/SliceProvider.h similarity index 100% rename from Core/sliceprovider.h rename to Core/SliceProvider.h diff --git a/Core/UndoElem.h b/Core/UndoElem.h index c9909d89..27e29a72 100755 --- a/Core/UndoElem.h +++ b/Core/UndoElem.h @@ -11,11 +11,12 @@ #include "iSegCore.h" -#include "DataSelection.h" #include "Mark.h" -#include "Point.h" #include "Types.h" +#include "Interface/Point.h" +#include "Interface/DataSelection.h" + #include namespace iseg { diff --git a/Core/VTIreader.cpp b/Core/VTIreader.cpp index a03936b8..f940f481 100755 --- a/Core/VTIreader.cpp +++ b/Core/VTIreader.cpp @@ -616,7 +616,6 @@ bool VTIwriter::writeVolumeAll(const char* filename, float** slicesbmp, << endl; return false; } - //BL? input->Update(); int info = input->GetPointData()->SetActiveScalars("Source"); for (int k = 0; k < nrslices; k++) diff --git a/Core/vec3.h b/Core/Vec3.h similarity index 100% rename from Core/vec3.h rename to Core/Vec3.h diff --git a/Core/addLine.h b/Core/addLine.h index d4db7d00..f2f9fb7c 100755 --- a/Core/addLine.h +++ b/Core/addLine.h @@ -11,7 +11,7 @@ #include "iSegCore.h" -#include "Point.h" +#include "Interface/Point.h" #include diff --git a/Plugin/CMakeLists.txt b/Interface/CMakeLists.txt similarity index 75% rename from Plugin/CMakeLists.txt rename to Interface/CMakeLists.txt index 661f4725..06178668 100755 --- a/Plugin/CMakeLists.txt +++ b/Interface/CMakeLists.txt @@ -15,13 +15,12 @@ USE_ITK() SET(SOURCES Plugin.cpp Plugin.h - PluginApi.h + InterfaceApi.h SlicesHandlerInterface.h WidgetInterface.h WidgetInterface.cpp ) QT4_WRAP_CPP(MOCSrcs WidgetInterface.h) -ADD_LIBRARY(Plugin SHARED ${SOURCES} ${MOCSrcs}) -TARGET_LINK_LIBRARIES(Plugin ${MY_EXTERNAL_LINK_LIBRARIES} ) -VS_SET_PROPERTY(Plugin "Plugins") +ADD_LIBRARY(iSegInterface SHARED ${SOURCES} ${MOCSrcs}) +TARGET_LINK_LIBRARIES(iSegInterface ${MY_EXTERNAL_LINK_LIBRARIES} ) diff --git a/Core/DataSelection.h b/Interface/DataSelection.h similarity index 100% rename from Core/DataSelection.h rename to Interface/DataSelection.h diff --git a/Plugin/PluginApi.h b/Interface/InterfaceApi.h old mode 100755 new mode 100644 similarity index 68% rename from Plugin/PluginApi.h rename to Interface/InterfaceApi.h index 404e808c..3331794c --- a/Plugin/PluginApi.h +++ b/Interface/InterfaceApi.h @@ -10,11 +10,11 @@ #pragma once #if defined(WIN32) -# ifdef Plugin_EXPORTS -# define ISEG_PLUGIN_API __declspec(dllexport) +# ifdef iSegInterface_EXPORTS +# define ISEG_INTERFACE_API __declspec(dllexport) # else -# define ISEG_PLUGIN_API __declspec(dllimport) +# define ISEG_INTERFACE_API __declspec(dllimport) # endif #else -# define ISEG_PLUGIN_API +# define ISEG_INTERFACE_API #endif diff --git a/Plugin/Plugin.cpp b/Interface/Plugin.cpp similarity index 100% rename from Plugin/Plugin.cpp rename to Interface/Plugin.cpp diff --git a/Plugin/Plugin.h b/Interface/Plugin.h similarity index 80% rename from Plugin/Plugin.h rename to Interface/Plugin.h index 9cccdd67..2b215f0f 100755 --- a/Plugin/Plugin.h +++ b/Interface/Plugin.h @@ -9,7 +9,7 @@ */ #pragma once -#include "PluginApi.h" +#include "InterfaceApi.h" #include "SlicesHandlerInterface.h" #include "WidgetInterface.h" @@ -23,7 +23,7 @@ class SliceHandlerInterface; namespace iseg { namespace plugin { -class ISEG_PLUGIN_API Plugin +class ISEG_INTERFACE_API Plugin { public: Plugin(); @@ -36,16 +36,17 @@ class ISEG_PLUGIN_API Plugin virtual std::string description() const = 0; - virtual WidgetInterface* create_widget(QWidget* parent, const char* name, - Qt::WindowFlags wFlags) const = 0; + virtual WidgetInterface* create_widget(QWidget* parent, + const char* name, Qt::WindowFlags wFlags) const = 0; private: SliceHandlerInterface* _slice_handler; }; -class ISEG_PLUGIN_API PluginRegistry +class ISEG_INTERFACE_API PluginRegistry { public: static std::vector registered_plugins(); }; + }} // namespace iseg::plugin diff --git a/Core/Point.h b/Interface/Point.h similarity index 100% rename from Core/Point.h rename to Interface/Point.h diff --git a/Plugin/SlicesHandlerInterface.h b/Interface/SlicesHandlerInterface.h similarity index 96% rename from Plugin/SlicesHandlerInterface.h rename to Interface/SlicesHandlerInterface.h index 3101cca4..905315b9 100755 --- a/Plugin/SlicesHandlerInterface.h +++ b/Interface/SlicesHandlerInterface.h @@ -9,7 +9,7 @@ */ #pragma once -#include "PluginApi.h" +#include "InterfaceApi.h" #include // BL TODO get rid of this #include @@ -20,7 +20,7 @@ class SliceHandlerInterface { public: typedef unsigned short tissue_type; - typedef float pixel_type; + typedef float pixel_type; virtual unsigned short return_startslice() = 0; virtual unsigned short return_endslice() = 0; diff --git a/Plugin/WidgetInterface.cpp b/Interface/WidgetInterface.cpp similarity index 66% rename from Plugin/WidgetInterface.cpp rename to Interface/WidgetInterface.cpp index ba7e85ca..d0fd4ae2 100755 --- a/Plugin/WidgetInterface.cpp +++ b/Interface/WidgetInterface.cpp @@ -12,4 +12,11 @@ namespace iseg { bool WidgetInterface::hideparams = false; + +WidgetInterface::WidgetInterface(QWidget* parent, const char* name, Qt::WindowFlags wFlags) + : QWidget(parent, name, wFlags) +{ + m_cursor = new QCursor(Qt::CrossCursor); } + +} // namespace iseg diff --git a/Interface/WidgetInterface.h b/Interface/WidgetInterface.h new file mode 100755 index 00000000..558009a5 --- /dev/null +++ b/Interface/WidgetInterface.h @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2018 The Foundation for Research on Information Technologies in Society (IT'IS). + * + * This file is part of iSEG + * (see https://github.com/ITISFoundation/osparc-iseg). + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ +#pragma once + +#include "InterfaceApi.h" + +#include "DataSelection.h" +#include "Point.h" + +#include +#include +#include +#include + +namespace iseg { + +class ISEG_INTERFACE_API WidgetInterface : public QWidget +{ + Q_OBJECT +public: + WidgetInterface(QWidget* parent, const char* name, Qt::WindowFlags wFlags); + virtual void init() {} + virtual void newloaded() {} + virtual void cleanup() {} + virtual FILE* SaveParams(FILE* fp, int version) { return fp; }; + virtual FILE* LoadParams(FILE* fp, int version) { return fp; }; + virtual void hideparams_changed() {} + static void set_hideparams(bool hide) { hideparams = hide; } + static bool get_hideparams() { return hideparams; } + virtual std::string GetName() { return std::string(""); } + virtual QIcon GetIcon(QDir picdir) = 0; + + virtual void on_tissuenr_changed(int i) {} + virtual void on_slicenr_changed() {} + + virtual void on_mouse_clicked(Point p) {} + virtual void on_mouse_released(Point p) {} + virtual void on_mouse_moved(Point p) {} + + QCursor* get_cursor() { return m_cursor; } + +signals: + void begin_datachange(iseg::DataSelection& dataSelection, + QWidget* sender = NULL, bool beginUndo = true); + void end_datachange(QWidget* sender = NULL, + iseg::EndUndoAction undoAction = iseg::EndUndo); + +private slots: + void tissuenr_changed(int i) { on_tissuenr_changed(i); } + void slicenr_changed() { on_slicenr_changed(); } + + // \todo duplicate slots (and connections) and pass argument source_or_target to callbacks + void mouse_clicked(Point p) { on_mouse_clicked(p); } + void mouse_released(Point p) { on_mouse_released(p); } + void mouse_moved(Point p) { on_mouse_moved(p); } + +protected: + QCursor* m_cursor; + + static bool hideparams; +}; + +} // namespace iseg diff --git a/Plugin/testsuite/CMakeLists.txt b/Interface/testsuite/CMakeLists.txt similarity index 72% rename from Plugin/testsuite/CMakeLists.txt rename to Interface/testsuite/CMakeLists.txt index bbf9aca6..7299a855 100755 --- a/Plugin/testsuite/CMakeLists.txt +++ b/Interface/testsuite/CMakeLists.txt @@ -18,10 +18,10 @@ IF(ISEG_BUILD_TESTING) test_iSegImageAdaptor.cpp ) - ADD_LIBRARY(TestSuite_Plugin ${SOURCES} ${HEADERS}) - TARGET_LINK_LIBRARIES(TestSuite_Plugin - Plugin + ADD_LIBRARY(TestSuite_iSegInterface ${SOURCES} ${HEADERS}) + TARGET_LINK_LIBRARIES(TestSuite_iSegInterface + iSegInterface ${MY_EXTERNAL_LINK_LIBRARIES} ) - VS_SET_PROPERTY(TestSuite_Plugin "TestSuite") + VS_SET_PROPERTY(TestSuite_iSegInterface "TestSuite") ENDIF() diff --git a/Plugin/testsuite/test_PluginMain.cpp b/Interface/testsuite/test_PluginMain.cpp similarity index 84% rename from Plugin/testsuite/test_PluginMain.cpp rename to Interface/testsuite/test_PluginMain.cpp index e087ceb6..5773afd1 100755 --- a/Plugin/testsuite/test_PluginMain.cpp +++ b/Interface/testsuite/test_PluginMain.cpp @@ -7,8 +7,8 @@ * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ -#define BOOST_TEST_MODULE Plugin +#define BOOST_TEST_MODULE Interface #define BOOST_TEST_NO_MAIN #include -#include "../PluginApi.h" +#include "../InterfaceApi.h" diff --git a/Plugin/testsuite/test_iSegImageAdaptor.cpp b/Interface/testsuite/test_iSegImageAdaptor.cpp similarity index 100% rename from Plugin/testsuite/test_iSegImageAdaptor.cpp rename to Interface/testsuite/test_iSegImageAdaptor.cpp diff --git a/Plugin/WidgetInterface.h b/Plugin/WidgetInterface.h deleted file mode 100755 index 61721704..00000000 --- a/Plugin/WidgetInterface.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2018 The Foundation for Research on Information Technologies in Society (IT'IS). - * - * This file is part of iSEG - * (see https://github.com/ITISFoundation/osparc-iseg). - * - * This software is released under the MIT License. - * https://opensource.org/licenses/MIT - */ -#pragma once - -#include "PluginApi.h" - -#include -#include -#include -#include - -#define UNREFERENCED_PARAMETER(P) (P) - -namespace iseg { - -class ISEG_PLUGIN_API WidgetInterface : public QWidget -{ - Q_OBJECT -public: - WidgetInterface(QWidget* parent, const char* name, Qt::WindowFlags wFlags) - : QWidget(parent, name, wFlags) - { - m_cursor = new QCursor(Qt::CrossCursor); - }; - virtual void init() {} - virtual void newloaded() {} - QCursor* m_cursor; - virtual FILE* SaveParams(FILE* fp, int version) - { - UNREFERENCED_PARAMETER(version); - return fp; - } - virtual FILE* LoadParams(FILE* fp, int version) - { - UNREFERENCED_PARAMETER(version); - return fp; - } - virtual void hideparams_changed() {} - static void set_hideparams(bool hide) { hideparams = hide; } - static bool get_hideparams() { return hideparams; } - virtual std::string GetName() { return std::string(""); } - virtual QIcon GetIcon(QDir picdir) = 0; - -protected: - static bool hideparams; - -public slots: - virtual void slicenr_changed(){}; -}; - -} // namespace iseg diff --git a/Plugins/BiasCorrection/BiasCorrection.cpp b/Plugins/BiasCorrection/BiasCorrection.cpp index b7fd7097..4b32a8ab 100755 --- a/Plugins/BiasCorrection/BiasCorrection.cpp +++ b/Plugins/BiasCorrection/BiasCorrection.cpp @@ -40,7 +40,7 @@ class CommandIterationUpdate : public itk::Command public: void SetProgressObject(QProgressDialog* progress, - const std::vector& num_iterations) + const std::vector& num_iterations) { m_NumberOfIterations = num_iterations; m_Progress = progress; @@ -52,7 +52,7 @@ class CommandIterationUpdate : public itk::Command } void Execute(const itk::Object* object, - const itk::EventObject& event) ITK_OVERRIDE + const itk::EventObject& event) ITK_OVERRIDE { const TFilter* filter = dynamic_cast(object); @@ -64,9 +64,9 @@ class CommandIterationUpdate : public itk::Command double current_level = filter->GetCurrentLevel(); double current_iteration = filter->GetElapsedIterations(); int percent = static_cast( - (current_level + - current_iteration / m_NumberOfIterations.at(current_level)) * - 100.0 / m_NumberOfIterations.size()); + (current_level + + current_iteration / m_NumberOfIterations.at(current_level)) * + 100.0 / m_NumberOfIterations.size()); m_Progress->setValue(std::min(percent, 100)); if (m_Progress->wasCanceled()) @@ -83,7 +83,7 @@ class CommandIterationUpdate : public itk::Command template typename ImageType::Pointer AllocImage( - const typename itk::ImageBase* exemplar) + const typename itk::ImageBase* exemplar) { typename ImageType::Pointer rval = ImageType::New(); // it may be the case that the output image might have a different @@ -110,17 +110,17 @@ inline QString Format(const char* tooltip) } // namespace BiasCorrectionWidget::BiasCorrectionWidget(iseg::SliceHandlerInterface* hand3D, - QWidget* parent, const char* name, - Qt::WindowFlags wFlags) - : WidgetInterface(parent, name, wFlags), handler3D(hand3D), - m_CurrentFilter(nullptr) + QWidget* parent, const char* name, + Qt::WindowFlags wFlags) + : WidgetInterface(parent, name, wFlags), handler3D(hand3D), + m_CurrentFilter(nullptr) { setToolTip(Format( - "Correct non-uniformity (especially in MRI) using the N4 Bias Correction " - "algorithm by " - "
" - "Tustison et al., 'N4ITK: Improved N3 Bias Correction', IEEE " - "Transactions on Medical Imaging, 29(6) : 1310 - 1320, June 2010")); + "Correct non-uniformity (especially in MRI) using the N4 Bias Correction " + "algorithm by " + "
" + "Tustison et al., 'N4ITK: Improved N3 Bias Correction', IEEE " + "Transactions on Medical Imaging, 29(6) : 1310 - 1320, June 2010")); activeslice = handler3D->get_activeslice(); @@ -147,8 +147,6 @@ BiasCorrectionWidget::BiasCorrectionWidget(iseg::SliceHandlerInterface* hand3D, vbox1->setMinimumWidth(std::max(300, vbox1->sizeHint().width())); QObject::connect(bias_exec, SIGNAL(clicked()), this, SLOT(do_work())); - - return; } void BiasCorrectionWidget::do_work() @@ -170,15 +168,16 @@ void BiasCorrectionWidget::do_work() try { auto output = DoBiasCorrection( - input, ITK_NULLPTR, - std::vector(num_levels, num_iterations), shrink_factor, - conv_threshold); + input, ITK_NULLPTR, + std::vector(num_levels, num_iterations), shrink_factor, + conv_threshold); if (output) { handler3D->ModifyWorkFloat(output); // BL: todo // BL: todo signal to 2D view to refresh display + // -> begin/end_data_change ... } } catch (itk::ExceptionObject&) @@ -204,14 +203,14 @@ QSize BiasCorrectionWidget::sizeHint() const { return vbox1->sizeHint(); } BiasCorrectionWidget::~BiasCorrectionWidget() { delete vbox1; } -void BiasCorrectionWidget::slicenr_changed() +void BiasCorrectionWidget::on_slicenr_changed() { activeslice = handler3D->get_activeslice(); } void BiasCorrectionWidget::init() { - slicenr_changed(); + on_slicenr_changed(); hideparams_changed(); } @@ -232,9 +231,9 @@ QIcon BiasCorrectionWidget::GetIcon(QDir picdir) template ImagePointer BiasCorrectionWidget::DoBiasCorrection( - ImagePointer inputImage, ImagePointer maskImage, - const std::vector& numIters, int shrinkFactor, - double convergenceThreshold) + ImagePointer inputImage, ImagePointer maskImage, + const std::vector& numIters, int shrinkFactor, + double convergenceThreshold) { bool verbose = false; @@ -243,13 +242,13 @@ ImagePointer BiasCorrectionWidget::DoBiasCorrection( static const int ImageDimension = ImageType::ImageDimension; typedef itk::N4BiasFieldCorrectionImageFilter - CorrecterType; + ImageType> + CorrecterType; typename CorrecterType::Pointer correcter = CorrecterType::New(); m_CurrentFilter = correcter; QProgressDialog progress("Performing bias correction...", "Cancel", 0, 101, - this); + this); progress.setWindowModality(Qt::WindowModal); progress.setModal(true); progress.show(); @@ -266,22 +265,22 @@ ImagePointer BiasCorrectionWidget::DoBiasCorrection( if (verbose) { std::cout << "Mask not read. Using the entire image as the mask." - << std::endl - << std::endl; + << std::endl + << std::endl; } maskImage = MaskImageType::New(); maskImage->CopyInformation(inputImage); maskImage->SetRegions(inputImage->GetRequestedRegion()); maskImage->Allocate(false); maskImage->FillBuffer( - itk::NumericTraits::OneValue()); + itk::NumericTraits::OneValue()); } /** * convergence options */ typename CorrecterType::VariableSizeArrayType maximumNumberOfIterations( - numIters.size()); + numIters.size()); for (unsigned int d = 0; d < numIters.size(); d++) { maximumNumberOfIterations[d] = numIters[d]; @@ -360,9 +359,9 @@ ImagePointer BiasCorrectionWidget::DoBiasCorrection( * corrected image. */ typedef itk::BSplineControlPointImageFilter< - typename CorrecterType::BiasFieldControlPointLatticeType, - typename CorrecterType::ScalarImageType> - BSplinerType; + typename CorrecterType::BiasFieldControlPointLatticeType, + typename CorrecterType::ScalarImageType> + BSplinerType; typename BSplinerType::Pointer bspliner = BSplinerType::New(); bspliner->SetInput(correcter->GetLogBiasFieldControlPointLattice()); bspliner->SetSplineOrder(correcter->GetSplineOrder()); @@ -375,9 +374,9 @@ ImagePointer BiasCorrectionWidget::DoBiasCorrection( typename ImageType::Pointer logField = AllocImage(inputImage); itk::ImageRegionIterator ItB( - bspliner->GetOutput(), bspliner->GetOutput()->GetLargestPossibleRegion()); + bspliner->GetOutput(), bspliner->GetOutput()->GetLargestPossibleRegion()); itk::ImageRegionIterator ItF(logField, - logField->GetLargestPossibleRegion()); + logField->GetLargestPossibleRegion()); for (ItB.GoToBegin(), ItF.GoToBegin(); !ItB.IsAtEnd(); ++ItB, ++ItF) { ItF.Set(ItB.Get()[0]); @@ -397,13 +396,13 @@ ImagePointer BiasCorrectionWidget::DoBiasCorrection( if (isMaskImageSpecified) { itk::ImageRegionIteratorWithIndex ItD( - divider->GetOutput(), divider->GetOutput()->GetLargestPossibleRegion()); + divider->GetOutput(), divider->GetOutput()->GetLargestPossibleRegion()); itk::ImageRegionIterator ItI( - inputImage, inputImage->GetLargestPossibleRegion()); + inputImage, inputImage->GetLargestPossibleRegion()); for (ItD.GoToBegin(), ItI.GoToBegin(); !ItD.IsAtEnd(); ++ItD, ++ItI) { if (maskImage->GetPixel(ItD.GetIndex()) == - itk::NumericTraits::ZeroValue()) + itk::NumericTraits::ZeroValue()) { ItD.Set(ItI.Get()); } diff --git a/Plugins/BiasCorrection/BiasCorrection.h b/Plugins/BiasCorrection/BiasCorrection.h index dd5436ab..444e2c39 100755 --- a/Plugins/BiasCorrection/BiasCorrection.h +++ b/Plugins/BiasCorrection/BiasCorrection.h @@ -11,8 +11,8 @@ #include -#include "Plugin/SlicesHandlerInterface.h" -#include "Plugin/WidgetInterface.h" +#include "Interface/SlicesHandlerInterface.h" +#include "Interface/WidgetInterface.h" #include #include @@ -30,7 +30,7 @@ class BiasCorrectionWidget : public iseg::WidgetInterface Q_OBJECT public: BiasCorrectionWidget(iseg::SliceHandlerInterface* hand3D, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0); + const char* name = 0, Qt::WindowFlags wFlags = 0); ~BiasCorrectionWidget(); QSize sizeHint() const override; @@ -39,14 +39,14 @@ class BiasCorrectionWidget : public iseg::WidgetInterface std::string GetName() override; QIcon GetIcon(QDir picdir) override; -protected: +private: + void on_slicenr_changed() override; + template - ImagePointer - DoBiasCorrection(ImagePointer inputImage, ImagePointer maskImage, - const std::vector& numIters, - int shrinkFactor, double convergenceThreshold); + ImagePointer DoBiasCorrection(ImagePointer inputImage, ImagePointer maskImage, + const std::vector& numIters, + int shrinkFactor, double convergenceThreshold); -private: iseg::SliceHandlerInterface* handler3D; unsigned short activeslice; Q3VBox* vbox1; @@ -64,9 +64,6 @@ class BiasCorrectionWidget : public iseg::WidgetInterface itk::ProcessObject* m_CurrentFilter; -public slots: - void slicenr_changed(); - private slots: void do_work(); void cancel(); diff --git a/Plugins/BiasCorrection/BiasCorrectionAddon.cpp b/Plugins/BiasCorrection/BiasCorrectionPlugin.cpp old mode 100755 new mode 100644 similarity index 90% rename from Plugins/BiasCorrection/BiasCorrectionAddon.cpp rename to Plugins/BiasCorrection/BiasCorrectionPlugin.cpp index 5b5ef6d9..d7048ce2 --- a/Plugins/BiasCorrection/BiasCorrectionAddon.cpp +++ b/Plugins/BiasCorrection/BiasCorrectionPlugin.cpp @@ -7,7 +7,7 @@ * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ -#include "BiasCorrectionAddon.h" +#include "BiasCorrectionPlugin.h" #include "BiasCorrection.h" @@ -22,7 +22,7 @@ BiasCorrectionPlugin::BiasCorrectionPlugin() {} BiasCorrectionPlugin::~BiasCorrectionPlugin() {} WidgetInterface* BiasCorrectionPlugin::create_widget(QWidget* parent, const char* name, - Qt::WindowFlags wFlags) const + Qt::WindowFlags wFlags) const { return new BiasCorrectionWidget(slice_handler(), parent, name, wFlags); } diff --git a/Plugins/BiasCorrection/BiasCorrectionAddon.h b/Plugins/BiasCorrection/BiasCorrectionPlugin.h old mode 100755 new mode 100644 similarity index 63% rename from Plugins/BiasCorrection/BiasCorrectionAddon.h rename to Plugins/BiasCorrection/BiasCorrectionPlugin.h index 00f69fa2..59695c9e --- a/Plugins/BiasCorrection/BiasCorrectionAddon.h +++ b/Plugins/BiasCorrection/BiasCorrectionPlugin.h @@ -9,7 +9,7 @@ */ #pragma once -#include "Plugin/Plugin.h" +#include "Interface/Plugin.h" namespace iseg { namespace plugin { @@ -19,11 +19,9 @@ class BiasCorrectionPlugin : public Plugin BiasCorrectionPlugin(); ~BiasCorrectionPlugin(); - virtual std::string name() const { return "Bias Addon "; } - - virtual std::string description() const { return "Bias Plugin"; } - - virtual WidgetInterface* create_widget(QWidget* parent, const char* name, - Qt::WindowFlags wFlags) const; + std::string name() const override { return "Bias Addon "; } + std::string description() const override { return "Bias Plugin"; } + WidgetInterface* create_widget(QWidget* parent, const char* name, + Qt::WindowFlags wFlags) const override; }; }} // namespace iseg::plugin diff --git a/Plugins/BiasCorrection/CMakeLists.txt b/Plugins/BiasCorrection/CMakeLists.txt index 12391048..6e948057 100755 --- a/Plugins/BiasCorrection/CMakeLists.txt +++ b/Plugins/BiasCorrection/CMakeLists.txt @@ -12,16 +12,18 @@ IF(PLUGIN_BIAS) QT4_WRAP_CPP(MOCSrcsbias BiasCorrection.h) ADD_LIBRARY(BiasCorrection.ext SHARED - BiasCorrectionAddon.cpp - BiasCorrectionAddon.h + BiasCorrectionPlugin.cpp + BiasCorrectionPlugin.h BiasCorrection.cpp BiasCorrection.h ${MOCSrcsbias} ) TARGET_LINK_LIBRARIES( BiasCorrection.ext - Plugin + iSegInterface ${MY_EXTERNAL_LINK_LIBRARIES} ) VS_SET_PROPERTY(BiasCorrection.ext "Plugins") + + SET(PLUGIN_NAMES ${PLUGIN_NAMES};BiasCorrection.ext CACHE INTERNAL "") ENDIF() \ No newline at end of file diff --git a/Plugins/CMakeLists.txt b/Plugins/CMakeLists.txt index 1136f372..9ecf1a2a 100755 --- a/Plugins/CMakeLists.txt +++ b/Plugins/CMakeLists.txt @@ -14,6 +14,8 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/iSeg) USE_QT4() USE_ITK() +SET(PLUGIN_NAMES "" CACHE INTERNAL "") + FOREACH(dir ${subdirs}) ADD_SUBDIRECTORY(${dir}) ENDFOREACH() diff --git a/Plugins/ConfidenceConnected/CMakeLists.txt b/Plugins/ConfidenceConnected/CMakeLists.txt index 686e9ad0..0707c25e 100755 --- a/Plugins/ConfidenceConnected/CMakeLists.txt +++ b/Plugins/ConfidenceConnected/CMakeLists.txt @@ -12,16 +12,18 @@ IF(PLUGIN_CONFIDENCE) QT4_WRAP_CPP(MOCSrcscon Confidence.h) ADD_LIBRARY(Confidence.ext SHARED - ConfidenceAddon.cpp - ConfidenceAddon.h + ConfidencePlugin.cpp + ConfidencePlugin.h Confidence.cpp Confidence.h ${MOCSrcscon} ) TARGET_LINK_LIBRARIES( Confidence.ext - Plugin + iSegInterface ${MY_EXTERNAL_LINK_LIBRARIES} ) VS_SET_PROPERTY(Confidence.ext "Plugins") + + SET(PLUGIN_NAMES ${PLUGIN_NAMES};Confidence.ext CACHE INTERNAL "") ENDIF() \ No newline at end of file diff --git a/Plugins/ConfidenceConnected/Confidence.cpp b/Plugins/ConfidenceConnected/Confidence.cpp index 8c3fa1cb..709b3770 100755 --- a/Plugins/ConfidenceConnected/Confidence.cpp +++ b/Plugins/ConfidenceConnected/Confidence.cpp @@ -24,8 +24,8 @@ #include ConfidenceWidget::ConfidenceWidget(iseg::SliceHandlerInterface* hand3D, QWidget* parent, - const char* name, Qt::WindowFlags wFlags) - : WidgetInterface(parent, name, wFlags), handler3D(hand3D) + const char* name, Qt::WindowFlags wFlags) + : WidgetInterface(parent, name, wFlags), handler3D(hand3D) { activeslice = handler3D->get_activeslice(); @@ -33,8 +33,8 @@ ConfidenceWidget::ConfidenceWidget(iseg::SliceHandlerInterface* hand3D, QWidget* vbox1 = new Q3VBox(this); bias_header = new QLabel("ConfidenceConnected Algorithm:(Pick with OLC " - "Foreground 1 pixel to start) ", - vbox1); + "Foreground 1 pixel to start) ", + vbox1); hbox2 = new Q3HBox(vbox1); hbox3 = new Q3HBox(vbox1); hbox4 = new Q3HBox(vbox1); @@ -71,11 +71,11 @@ void ConfidenceWidget::do_work() typedef TMask TOutput; typedef itk::CurvatureFlowImageFilter - CurvatureFlowImageFilterType; + CurvatureFlowImageFilterType; CurvatureFlowImageFilterType::Pointer smoothing; smoothing = CurvatureFlowImageFilterType::New(); typedef itk::ConfidenceConnectedImageFilter - ConnectedFilterType; + ConnectedFilterType; ConnectedFilterType::Pointer confidenceConnected; confidenceConnected = ConnectedFilterType::New(); @@ -111,14 +111,14 @@ ConfidenceWidget::~ConfidenceWidget() free(usp); } -void ConfidenceWidget::slicenr_changed() +void ConfidenceWidget::on_slicenr_changed() { activeslice = handler3D->get_activeslice(); } void ConfidenceWidget::init() { - slicenr_changed(); + on_slicenr_changed(); hideparams_changed(); } diff --git a/Plugins/ConfidenceConnected/Confidence.h b/Plugins/ConfidenceConnected/Confidence.h index 54fef9c9..f2f1bc5c 100755 --- a/Plugins/ConfidenceConnected/Confidence.h +++ b/Plugins/ConfidenceConnected/Confidence.h @@ -9,8 +9,8 @@ */ #pragma once -#include "Plugin/SlicesHandlerInterface.h" -#include "Plugin/WidgetInterface.h" +#include "Interface/SlicesHandlerInterface.h" +#include "Interface/WidgetInterface.h" #include #include @@ -23,16 +23,16 @@ class ConfidenceWidget : public iseg::WidgetInterface Q_OBJECT public: ConfidenceWidget(iseg::SliceHandlerInterface* hand3D, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0); + const char* name = 0, Qt::WindowFlags wFlags = 0); ~ConfidenceWidget(); - QSize sizeHint() const; - void init(); - void newloaded(); - std::string GetName() { return std::string("ConfidenceFilter"); }; - virtual QIcon GetIcon(QDir picdir) - { - return QIcon(picdir.absFilePath(QString("Confidence.png")).ascii()); - }; + void init() override; + void newloaded() override; + QSize sizeHint() const override; + std::string GetName() override { return std::string("ConfidenceFilter"); } + QIcon GetIcon(QDir picdir) override { return QIcon(picdir.absFilePath(QString("Confidence.png"))); } + +protected: + void on_slicenr_changed() override; private: unsigned int* usp; @@ -56,9 +56,6 @@ class ConfidenceWidget : public iseg::WidgetInterface QSpinBox* sl_h6; QSpinBox* sl_h7; -public slots: - void slicenr_changed(); - private slots: void do_work(); }; diff --git a/Plugins/ConfidenceConnected/ConfidenceAddon.cpp b/Plugins/ConfidenceConnected/ConfidencePlugin.cpp old mode 100755 new mode 100644 similarity index 90% rename from Plugins/ConfidenceConnected/ConfidenceAddon.cpp rename to Plugins/ConfidenceConnected/ConfidencePlugin.cpp index 46e38ec7..3a71f4f3 --- a/Plugins/ConfidenceConnected/ConfidenceAddon.cpp +++ b/Plugins/ConfidenceConnected/ConfidencePlugin.cpp @@ -7,7 +7,7 @@ * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ -#include "ConfidenceAddon.h" +#include "ConfidencePlugin.h" #include "Confidence.h" @@ -22,7 +22,7 @@ ConfidencePlugin::ConfidencePlugin() {} ConfidencePlugin::~ConfidencePlugin() {} WidgetInterface* ConfidencePlugin::create_widget(QWidget* parent, const char* name, - Qt::WindowFlags wFlags) const + Qt::WindowFlags wFlags) const { return new ConfidenceWidget(slice_handler(), parent, name, wFlags); } diff --git a/Plugins/ConfidenceConnected/ConfidenceAddon.h b/Plugins/ConfidenceConnected/ConfidencePlugin.h old mode 100755 new mode 100644 similarity index 62% rename from Plugins/ConfidenceConnected/ConfidenceAddon.h rename to Plugins/ConfidenceConnected/ConfidencePlugin.h index aa26a26d..b41188c5 --- a/Plugins/ConfidenceConnected/ConfidenceAddon.h +++ b/Plugins/ConfidenceConnected/ConfidencePlugin.h @@ -9,7 +9,7 @@ */ #pragma once -#include "Plugin/Plugin.h" +#include "Interface/Plugin.h" namespace iseg { namespace plugin { @@ -19,11 +19,9 @@ class ConfidencePlugin : public Plugin ConfidencePlugin(); ~ConfidencePlugin(); - virtual std::string name() const { return "Example Addon 1"; } - - virtual std::string description() const { return "Hello World"; } - - virtual WidgetInterface* create_widget(QWidget* parent, const char* name, - Qt::WindowFlags wFlags) const; + std::string name() const override { return "Example Addon 1"; } + std::string description() const override { return "Hello World"; } + WidgetInterface* create_widget(QWidget* parent, const char* name, + Qt::WindowFlags wFlags) const override; }; }} // namespace iseg::plugin diff --git a/Plugins/GraphCut/CMakeLists.txt b/Plugins/GraphCut/CMakeLists.txt index 7a9005f8..f9eaf190 100755 --- a/Plugins/GraphCut/CMakeLists.txt +++ b/Plugins/GraphCut/CMakeLists.txt @@ -19,8 +19,8 @@ IF(PLUGIN_GRAPHCUT) ) ADD_LIBRARY(GraphCut.ext SHARED - GraphCutAddon.cpp - GraphCutAddon.h + GraphCutPlugin.cpp + GraphCutPlugin.h GraphCutBoneSegmentation.cpp GraphCutBoneSegmentation.h GraphCutTissueSeparator.cpp @@ -31,9 +31,11 @@ IF(PLUGIN_GRAPHCUT) # todo check libs in linker command TARGET_LINK_LIBRARIES( GraphCut.ext - Plugin + iSegInterface Gc ${MY_EXTERNAL_LINK_LIBRARIES} ) VS_SET_PROPERTY(GraphCut.ext "Plugins") + + SET(PLUGIN_NAMES ${PLUGIN_NAMES};GraphCut.ext CACHE INTERNAL "") ENDIF() diff --git a/Plugins/GraphCut/GraphCutBoneSegmentation.cpp b/Plugins/GraphCut/GraphCutBoneSegmentation.cpp index 817b9d13..1554c03f 100755 --- a/Plugins/GraphCut/GraphCutBoneSegmentation.cpp +++ b/Plugins/GraphCut/GraphCutBoneSegmentation.cpp @@ -45,7 +45,7 @@ class CommandProgressUpdate : public itk::Command } void Execute(const itk::Object* object, - const itk::EventObject& event) ITK_OVERRIDE + const itk::EventObject& event) ITK_OVERRIDE { auto filter = dynamic_cast(object); @@ -72,18 +72,18 @@ inline QString Format(const char* tooltip) } // namespace BoneSegmentationWidget::BoneSegmentationWidget( - iseg::SliceHandlerInterface* hand3D, QWidget* parent, const char* name, - Qt::WindowFlags wFlags) - : WidgetInterface(parent, name, wFlags), m_Handler3D(hand3D), - m_CurrentFilter(nullptr) + iseg::SliceHandlerInterface* hand3D, QWidget* parent, const char* name, + Qt::WindowFlags wFlags) + : WidgetInterface(parent, name, wFlags), m_Handler3D(hand3D), + m_CurrentFilter(nullptr) { setToolTip( - Format("A fully-automatic method for segmenting the femur from 3D CT " - "scans, based on the graph-cut segmentation framework and bone " - "enhancement filters " - "
" - "Krcah et al., 'Fully automatic and fast segmentation of the " - "femur bone from 3D-CT images with no shape prior', IEEE, 2011")); + Format("A fully-automatic method for segmenting the femur from 3D CT " + "scans, based on the graph-cut segmentation framework and bone " + "enhancement filters " + "
" + "Krcah et al., 'Fully automatic and fast segmentation of the " + "femur bone from 3D-CT images with no shape prior', IEEE, 2011")); m_CurrentSlice = m_Handler3D->get_activeslice(); @@ -93,7 +93,7 @@ BoneSegmentationWidget::BoneSegmentationWidget( m_LabelMaxFlowAlgorithm = new QLabel("Max-Flow Algorithm: ", m_HGrid1); m_MaxFlowAlgorithm = new QComboBox(m_HGrid1); m_MaxFlowAlgorithm->setToolTip( - QString("Choose Max-Flow algorithm used to perform Graph-Cut.")); + QString("Choose Max-Flow algorithm used to perform Graph-Cut.")); m_MaxFlowAlgorithm->insertItem(QString("Kohli")); m_MaxFlowAlgorithm->insertItem(QString("PushLabel-Fifo")); m_MaxFlowAlgorithm->insertItem(QString("PushLabel-H_PRF")); @@ -101,7 +101,7 @@ BoneSegmentationWidget::BoneSegmentationWidget( m_6Connectivity = new QCheckBox(QString("6-Connectivity"), m_VGrid); m_6Connectivity->setToolTip(QString("Use fully connected neighborhood or " - "only city-block neighbors (26 vs 6).")); + "only city-block neighbors (26 vs 6).")); // TODO: this should re-use active-slices m_UseSliceRange = new QCheckBox(QString("Use Slice Range"), m_VGrid); @@ -123,7 +123,7 @@ BoneSegmentationWidget::BoneSegmentationWidget( QObject::connect(m_Execute, SIGNAL(clicked()), this, SLOT(do_work())); QObject::connect(m_UseSliceRange, SIGNAL(clicked()), this, - SLOT(showsliders())); + SLOT(showsliders())); } void BoneSegmentationWidget::showsliders() @@ -157,7 +157,7 @@ void BoneSegmentationWidget::do_work() typedef itk::Image TOutput; typedef itk::Image TIntImage; typedef itk::ImageGraphCutFilter - GraphCutFilterType; + GraphCutFilterType; // get input image auto input = TInput::New(); @@ -173,8 +173,8 @@ void BoneSegmentationWidget::do_work() graphCutFilter->SetNumberOfRequiredInputs(1); graphCutFilter->SetInputImage(input); graphCutFilter->SetMaxFlowAlgorithm( - static_cast( - m_MaxFlowAlgorithm->currentItem())); + static_cast( + m_MaxFlowAlgorithm->currentItem())); graphCutFilter->SetForegroundPixelValue(255); graphCutFilter->SetBackgroundPixelValue(0); graphCutFilter->SetSigma(0.2); @@ -189,7 +189,7 @@ void BoneSegmentationWidget::do_work() auto observer = CommandProgressUpdate::New(); auto observer_id = - graphCutFilter->AddObserver(itk::ProgressEvent(), observer); + graphCutFilter->AddObserver(itk::ProgressEvent(), observer); observer->SetProgressObject(&progress); try @@ -226,14 +226,14 @@ QSize BoneSegmentationWidget::sizeHint() const BoneSegmentationWidget::~BoneSegmentationWidget() { delete m_VGrid; } -void BoneSegmentationWidget::slicenr_changed() +void BoneSegmentationWidget::on_slicenr_changed() { m_CurrentSlice = m_Handler3D->get_activeslice(); } void BoneSegmentationWidget::init() { - slicenr_changed(); + on_slicenr_changed(); hideparams_changed(); } diff --git a/Plugins/GraphCut/GraphCutBoneSegmentation.h b/Plugins/GraphCut/GraphCutBoneSegmentation.h index 79bb0232..2842508a 100755 --- a/Plugins/GraphCut/GraphCutBoneSegmentation.h +++ b/Plugins/GraphCut/GraphCutBoneSegmentation.h @@ -9,8 +9,8 @@ */ #pragma once -#include "Plugin/SlicesHandlerInterface.h" -#include "Plugin/WidgetInterface.h" +#include "Interface/SlicesHandlerInterface.h" +#include "Interface/WidgetInterface.h" #include #include @@ -24,19 +24,17 @@ class BoneSegmentationWidget : public iseg::WidgetInterface Q_OBJECT public: BoneSegmentationWidget(iseg::SliceHandlerInterface* hand3D, - QWidget* parent = 0, const char* name = 0, - Qt::WindowFlags wFlags = 0); + QWidget* parent = 0, const char* name = 0, Qt::WindowFlags wFlags = 0); ~BoneSegmentationWidget(); - QSize sizeHint() const; - void init(); - void newloaded(); - std::string GetName() { return std::string("CT Auto-Bone"); }; - virtual QIcon GetIcon(QDir picdir) - { - return QIcon(picdir.absFilePath(QString("graphcut.png")).ascii()); - }; + QSize sizeHint() const override; + void init() override; + void newloaded() override; + std::string GetName() override { return std::string("CT Auto-Bone"); } + QIcon GetIcon(QDir picdir) override { return QIcon(picdir.absFilePath(QString("graphcut.png"))); } private: + void on_slicenr_changed() override; + iseg::SliceHandlerInterface* m_Handler3D; unsigned short m_CurrentSlice; Q3VBox* m_VGrid; @@ -55,9 +53,6 @@ class BoneSegmentationWidget : public iseg::WidgetInterface itk::ProcessObject* m_CurrentFilter; -public slots: - void slicenr_changed(); - private slots: void do_work(); void cancel(); diff --git a/Plugins/GraphCut/GraphCutAddon.cpp b/Plugins/GraphCut/GraphCutPlugin.cpp old mode 100755 new mode 100644 similarity index 88% rename from Plugins/GraphCut/GraphCutAddon.cpp rename to Plugins/GraphCut/GraphCutPlugin.cpp index ed9a2a4b..9c356b39 --- a/Plugins/GraphCut/GraphCutAddon.cpp +++ b/Plugins/GraphCut/GraphCutPlugin.cpp @@ -7,7 +7,7 @@ * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ -#include "GraphCutAddon.h" +#include "GraphCutPlugin.h" #include "GraphCutBoneSegmentation.h" #include "GraphCutTissueSeparator.h" @@ -29,8 +29,8 @@ std::string GCBoneSegmentationPlugin::description() const } WidgetInterface* GCBoneSegmentationPlugin::create_widget(QWidget* parent, - const char* name, - Qt::WindowFlags wFlags) const + const char* name, + Qt::WindowFlags wFlags) const { return new BoneSegmentationWidget(slice_handler(), parent, name, wFlags); } @@ -46,8 +46,8 @@ std::string CGCTissueSeparatorPlugin::description() const } WidgetInterface* CGCTissueSeparatorPlugin::create_widget(QWidget* parent, - const char* name, - Qt::WindowFlags wFlags) const + const char* name, + Qt::WindowFlags wFlags) const { return new TissueSeparatorWidget(slice_handler(), parent, name, wFlags); } diff --git a/Plugins/GraphCut/GraphCutAddon.h b/Plugins/GraphCut/GraphCutPlugin.h old mode 100755 new mode 100644 similarity index 56% rename from Plugins/GraphCut/GraphCutAddon.h rename to Plugins/GraphCut/GraphCutPlugin.h index 2e711312..a50d37ac --- a/Plugins/GraphCut/GraphCutAddon.h +++ b/Plugins/GraphCut/GraphCutPlugin.h @@ -9,7 +9,7 @@ */ #pragma once -#include "Plugin/Plugin.h" +#include "Interface/Plugin.h" namespace iseg { namespace plugin { @@ -19,12 +19,10 @@ class GCBoneSegmentationPlugin : public Plugin GCBoneSegmentationPlugin(); ~GCBoneSegmentationPlugin(); - virtual std::string name() const { return "CT Auto-Bone"; } - - virtual std::string description() const; - - virtual WidgetInterface* create_widget(QWidget* parent, const char* name, - Qt::WindowFlags wFlags) const; + std::string name() const override { return "CT Auto-Bone"; } + std::string description() const override; + WidgetInterface* create_widget(QWidget* parent, const char* name, + Qt::WindowFlags wFlags) const override; }; class CGCTissueSeparatorPlugin : public Plugin @@ -33,12 +31,10 @@ class CGCTissueSeparatorPlugin : public Plugin CGCTissueSeparatorPlugin(); ~CGCTissueSeparatorPlugin(); - virtual std::string name() const { return "Tissue Separator"; } - - virtual std::string description() const; - - virtual WidgetInterface* create_widget(QWidget* parent, const char* name, - Qt::WindowFlags wFlags) const; + std::string name() const override { return "Tissue Separator"; } + std::string description() const override; + WidgetInterface* create_widget(QWidget* parent, const char* name, + Qt::WindowFlags wFlags) const override; }; }} // namespace iseg::plugin diff --git a/Plugins/GraphCut/GraphCutTissueSeparator.cpp b/Plugins/GraphCut/GraphCutTissueSeparator.cpp index 862c85dd..ff185680 100755 --- a/Plugins/GraphCut/GraphCutTissueSeparator.cpp +++ b/Plugins/GraphCut/GraphCutTissueSeparator.cpp @@ -22,9 +22,9 @@ #include TissueSeparatorWidget::TissueSeparatorWidget( - iseg::SliceHandlerInterface* hand3D, QWidget* parent, const char* name, - Qt::WindowFlags wFlags) - : WidgetInterface(parent, name, wFlags), m_Handler3D(hand3D) + iseg::SliceHandlerInterface* hand3D, QWidget* parent, const char* name, + Qt::WindowFlags wFlags) + : WidgetInterface(parent, name, wFlags), m_Handler3D(hand3D) { m_CurrentSlice = m_Handler3D->get_activeslice(); @@ -75,7 +75,7 @@ TissueSeparatorWidget::TissueSeparatorWidget( QObject::connect(m_Execute, SIGNAL(clicked()), this, SLOT(do_work())); QObject::connect(m_UseSliceRange, SIGNAL(clicked()), this, - SLOT(showsliders())); + SLOT(showsliders())); /* activeslice = handler3D->get_activeslice(); @@ -155,7 +155,7 @@ void TissueSeparatorWidget::do_work() //Code for special GC for division typedef TMask TOutput; typedef itk::Image TIntImage; typedef itk::ImageGraphCutFilter - GraphCutFilterType; + GraphCutFilterType; auto graphCutFilter = GraphCutFilterType::New(); auto input = TInput::New(); @@ -173,9 +173,9 @@ void TissueSeparatorWidget::do_work() //Code for special GC for division if (m_UseSliceRange->isChecked() == true) { m_Handler3D->GetITKImageFB(foreground, m_Start->value() - 1, - m_End->value()); + m_End->value()); m_Handler3D->GetITKImageFB(background, m_Start->value() - 1, - m_End->value()); + m_End->value()); } else { @@ -189,8 +189,8 @@ void TissueSeparatorWidget::do_work() //Code for special GC for division graphCutFilter->SetBackgroundImage(background); // set parameters graphCutFilter->SetMaxFlowAlgorithm( - static_cast( - m_MaxFlowAlgorithm->currentItem())); + static_cast( + m_MaxFlowAlgorithm->currentItem())); graphCutFilter->SetForegroundPixelValue(255); graphCutFilter->SetBackgroundPixelValue(-255); graphCutFilter->SetSigma(0.2); @@ -219,7 +219,7 @@ void TissueSeparatorWidget::do_work() //Code for special GC for division IteratorType iterator(rad, output, output->GetLargestPossibleRegion()); IteratorType2 iterator2(rad, foreground, - foreground->GetLargestPossibleRegion()); + foreground->GetLargestPossibleRegion()); iterator.ClearActiveList(); iterator.ActivateOffset(center); iterator2.ClearActiveList(); @@ -245,7 +245,7 @@ void TissueSeparatorWidget::do_work() //Code for special GC for division output->Update(); if (m_UseSliceRange->isChecked() == true) m_Handler3D->ModifyWorkFloat(output, m_Start->value() - 1, - m_End->value()); + m_End->value()); else m_Handler3D->ModifyWorkFloat(output); } @@ -258,14 +258,14 @@ QSize TissueSeparatorWidget::sizeHint() const TissueSeparatorWidget::~TissueSeparatorWidget() { delete m_VerticalGrid; } -void TissueSeparatorWidget::slicenr_changed() +void TissueSeparatorWidget::on_slicenr_changed() { m_CurrentSlice = m_Handler3D->get_activeslice(); } void TissueSeparatorWidget::init() { - slicenr_changed(); + on_slicenr_changed(); hideparams_changed(); } diff --git a/Plugins/GraphCut/GraphCutTissueSeparator.h b/Plugins/GraphCut/GraphCutTissueSeparator.h index aee18fc6..b13f7f01 100755 --- a/Plugins/GraphCut/GraphCutTissueSeparator.h +++ b/Plugins/GraphCut/GraphCutTissueSeparator.h @@ -9,8 +9,8 @@ */ #pragma once -#include "Plugin/SlicesHandlerInterface.h" -#include "Plugin/WidgetInterface.h" +#include "Interface/SlicesHandlerInterface.h" +#include "Interface/WidgetInterface.h" #include #include @@ -24,19 +24,18 @@ class TissueSeparatorWidget : public iseg::WidgetInterface Q_OBJECT public: TissueSeparatorWidget(iseg::SliceHandlerInterface* hand3D, - QWidget* parent = 0, const char* name = 0, - Qt::WindowFlags wFlags = 0); + QWidget* parent = 0, const char* name = 0, + Qt::WindowFlags wFlags = 0); ~TissueSeparatorWidget(); - QSize sizeHint() const; - void init(); - void newloaded(); - std::string GetName() { return std::string("Separate Tissue"); } - virtual QIcon GetIcon(QDir picdir) - { - return QIcon(picdir.absFilePath(QString("graphcut.png")).ascii()); - } + QSize sizeHint() const override; + void init() override; + void newloaded() override; + std::string GetName() override { return std::string("Separate Tissue"); } + QIcon GetIcon(QDir picdir) override { return QIcon(picdir.absFilePath(QString("graphcut.png"))); } private: + void on_slicenr_changed() override; + iseg::SliceHandlerInterface* m_Handler3D; unsigned short m_CurrentSlice; Q3VBox* m_VerticalGrid; @@ -61,9 +60,6 @@ class TissueSeparatorWidget : public iseg::WidgetInterface QSpinBox* m_End; QPushButton* m_Execute; -public slots: - void slicenr_changed(); - private slots: void do_work(); void showsliders(); diff --git a/Plugins/Levelset/CMakeLists.txt b/Plugins/Levelset/CMakeLists.txt index 3d97c486..a36f1ad5 100755 --- a/Plugins/Levelset/CMakeLists.txt +++ b/Plugins/Levelset/CMakeLists.txt @@ -12,16 +12,18 @@ IF(PLUGIN_LEVELSET) QT4_WRAP_CPP(MOCSrcslevel Levelset.h) ADD_LIBRARY(Levelset.ext SHARED - LevelsetAddon.cpp - LevelsetAddon.h + LevelsetPlugin.cpp + LevelsetPlugin.h Levelset.cpp Levelset.h ${MOCSrcslevel} ) TARGET_LINK_LIBRARIES( Levelset.ext - Plugin + iSegInterface ${MY_EXTERNAL_LINK_LIBRARIES} ) VS_SET_PROPERTY(Levelset.ext "Plugins") + + SET(PLUGIN_NAMES ${PLUGIN_NAMES};Levelset.ext CACHE INTERNAL "") ENDIF() \ No newline at end of file diff --git a/Plugins/Levelset/Levelset.cpp b/Plugins/Levelset/Levelset.cpp index 912f164b..c6eac7ef 100755 --- a/Plugins/Levelset/Levelset.cpp +++ b/Plugins/Levelset/Levelset.cpp @@ -19,8 +19,8 @@ #include LevelsetWidget::LevelsetWidget(iseg::SliceHandlerInterface* hand3D, QWidget* parent, - const char* name, Qt::WindowFlags wFlags) - : WidgetInterface(parent, name, wFlags), handler3D(hand3D) + const char* name, Qt::WindowFlags wFlags) + : WidgetInterface(parent, name, wFlags), handler3D(hand3D) { activeslice = handler3D->get_activeslice(); @@ -28,8 +28,8 @@ LevelsetWidget::LevelsetWidget(iseg::SliceHandlerInterface* hand3D, QWidget* par vbox1 = new Q3VBox(this); bias_header = new QLabel( - "LevelSetSegmentation: (Pick with OLC Foreground 1 pixel to start)", - vbox1); + "LevelSetSegmentation: (Pick with OLC Foreground 1 pixel to start)", + vbox1); hbox2 = new Q3HBox(vbox1); hbox3 = new Q3HBox(vbox1); hbox4 = new Q3HBox(vbox1); @@ -58,7 +58,7 @@ void LevelsetWidget::do_work() typedef itk::Image TMask; typedef TMask TOutput; typedef itk::ThresholdSegmentationLevelSetImageFilter - ThresholdSegmentationLevelSetImageFilterType; + ThresholdSegmentationLevelSetImageFilterType; ThresholdSegmentationLevelSetImageFilterType::Pointer thresholdSegmentation; thresholdSegmentation = ThresholdSegmentationLevelSetImageFilterType::New(); @@ -93,7 +93,7 @@ void LevelsetWidget::do_work() fastMarching->SetOutputDirection(input->GetDirection()); typedef itk::BinaryThresholdImageFilter - ThresholdingFilterType; + ThresholdingFilterType; ThresholdingFilterType::Pointer thresholder; thresholder = ThresholdingFilterType::New(); thresholder->SetLowerThreshold(-5000.0); @@ -128,14 +128,14 @@ LevelsetWidget::~LevelsetWidget() free(usp); } -void LevelsetWidget::slicenr_changed() +void LevelsetWidget::on_slicenr_changed() { activeslice = handler3D->get_activeslice(); } void LevelsetWidget::init() { - slicenr_changed(); + on_slicenr_changed(); hideparams_changed(); } diff --git a/Plugins/Levelset/Levelset.h b/Plugins/Levelset/Levelset.h index d01b0644..1ae5aa2e 100755 --- a/Plugins/Levelset/Levelset.h +++ b/Plugins/Levelset/Levelset.h @@ -9,8 +9,8 @@ */ #pragma once -#include "Plugin/SlicesHandlerInterface.h" -#include "Plugin/WidgetInterface.h" +#include "Interface/SlicesHandlerInterface.h" +#include "Interface/WidgetInterface.h" #include #include @@ -22,18 +22,17 @@ class LevelsetWidget : public iseg::WidgetInterface Q_OBJECT public: LevelsetWidget(iseg::SliceHandlerInterface* hand3D, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0); + const char* name = 0, Qt::WindowFlags wFlags = 0); ~LevelsetWidget(); - QSize sizeHint() const; - void init(); - void newloaded(); - std::string GetName() { return std::string("LevelSet"); }; - virtual QIcon GetIcon(QDir picdir) - { - return QIcon(picdir.absFilePath(QString("LevelSet.png")).ascii()); - }; + QSize sizeHint() const override; + void init() override; + void newloaded() override; + std::string GetName() override { return std::string("LevelSet"); }; + QIcon GetIcon(QDir picdir) override { return QIcon(picdir.absFilePath(QString("LevelSet.png"))); }; private: + void on_slicenr_changed() override; + unsigned int* usp; iseg::SliceHandlerInterface* handler3D; unsigned short activeslice; @@ -53,9 +52,6 @@ class LevelsetWidget : public iseg::WidgetInterface QLabel* txt_h5; QSpinBox* sl_h5; -public slots: - void slicenr_changed(); - private slots: void do_work(); }; diff --git a/Plugins/Levelset/LevelsetAddon.cpp b/Plugins/Levelset/LevelsetPlugin.cpp old mode 100755 new mode 100644 similarity index 90% rename from Plugins/Levelset/LevelsetAddon.cpp rename to Plugins/Levelset/LevelsetPlugin.cpp index 298e3c0f..7e37faa1 --- a/Plugins/Levelset/LevelsetAddon.cpp +++ b/Plugins/Levelset/LevelsetPlugin.cpp @@ -7,7 +7,7 @@ * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ -#include "LevelsetAddon.h" +#include "LevelsetPlugin.h" #include "Levelset.h" @@ -22,7 +22,7 @@ LevelsetPlugin::LevelsetPlugin() {} LevelsetPlugin::~LevelsetPlugin() {} WidgetInterface* LevelsetPlugin::create_widget(QWidget* parent, const char* name, - Qt::WindowFlags wFlags) const + Qt::WindowFlags wFlags) const { return new LevelsetWidget(slice_handler(), parent, name, wFlags); } diff --git a/Plugins/Levelset/LevelsetAddon.h b/Plugins/Levelset/LevelsetPlugin.h old mode 100755 new mode 100644 similarity index 62% rename from Plugins/Levelset/LevelsetAddon.h rename to Plugins/Levelset/LevelsetPlugin.h index 980ca66a..fc6519f3 --- a/Plugins/Levelset/LevelsetAddon.h +++ b/Plugins/Levelset/LevelsetPlugin.h @@ -9,7 +9,7 @@ */ #pragma once -#include "Plugin/Plugin.h" +#include "Interface/Plugin.h" namespace iseg { namespace plugin { @@ -19,11 +19,9 @@ class LevelsetPlugin : public Plugin LevelsetPlugin(); ~LevelsetPlugin(); - virtual std::string name() const { return "Levelset"; } - - virtual std::string description() const { return "LevelSet Plugin"; } - - virtual WidgetInterface* create_widget(QWidget* parent, const char* name, - Qt::WindowFlags wFlags) const; + std::string name() const override { return "Levelset"; } + std::string description() const override { return "LevelSet Plugin"; } + WidgetInterface* create_widget(QWidget* parent, const char* name, + Qt::WindowFlags wFlags) const override; }; }} // namespace iseg::plugin diff --git a/iSeg/AtlasViewer.h b/iSeg/AtlasViewer.h index df835b94..96cdf00d 100755 --- a/iSeg/AtlasViewer.h +++ b/iSeg/AtlasViewer.h @@ -7,13 +7,11 @@ * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ -#ifndef ATLAS_VIEWER -#define ATLAS_VIEWER +#pragma once -#include "Plugin/WidgetInterface.h" +#include "Interface/Point.h" #include "Core/Pair.h" -#include "Core/Point.h" #include "Core/Types.h" #include @@ -98,4 +96,3 @@ public slots: }; } // namespace iseg -#endif //ATLAS_VIEWER diff --git a/iSeg/AtlasWidget.cpp b/iSeg/AtlasWidget.cpp index d9c95249..7be263d3 100755 --- a/iSeg/AtlasWidget.cpp +++ b/iSeg/AtlasWidget.cpp @@ -32,9 +32,9 @@ using namespace iseg; -AtlasWidget::AtlasWidget(const char* filename, QDir picpath, QWidget* parent, - const char* name, Qt::WindowFlags wFlags) - : QWidget(parent, name, wFlags) +AtlasWidget::AtlasWidget(const char *filename, QDir picpath, QWidget *parent, + const char *name, Qt::WindowFlags wFlags) + : QWidget(parent, name, wFlags) { isOK = false; QString title("Atlas - "); @@ -49,10 +49,10 @@ AtlasWidget::AtlasWidget(const char* filename, QDir picpath, QWidget* parent, isOK = true; m_picpath = picpath; - QVBoxLayout* vbox1 = new QVBoxLayout; - QHBoxLayout* hbox1 = new QHBoxLayout; - QHBoxLayout* hbox2 = new QHBoxLayout; - QHBoxLayout* hbox3 = new QHBoxLayout; + QVBoxLayout *vbox1 = new QVBoxLayout; + QHBoxLayout *hbox1 = new QHBoxLayout; + QHBoxLayout *hbox2 = new QHBoxLayout; + QHBoxLayout *hbox3 = new QHBoxLayout; sl_contrast = new QSlider(Qt::Horizontal, this); sl_contrast->setRange(0, 99); @@ -62,12 +62,12 @@ AtlasWidget::AtlasWidget(const char* filename, QDir picpath, QWidget* parent, sl_brightness->setValue(50); lb_contrast = new QLabel("C:", this); lb_contrast->setPixmap( - QIcon(m_picpath.absFilePath(QString("icon-contrast.png")).ascii()) - .pixmap()); + QIcon(m_picpath.absFilePath(QString("icon-contrast.png")).ascii()) + .pixmap()); lb_brightness = new QLabel("B:", this); lb_brightness->setPixmap( - QIcon(m_picpath.absFilePath(QString("icon-brightness.png")).ascii()) - .pixmap()); + QIcon(m_picpath.absFilePath(QString("icon-brightness.png")).ascii()) + .pixmap()); hbox1->addWidget(lb_contrast); hbox1->addWidget(sl_contrast); hbox1->addWidget(lb_brightness); @@ -78,7 +78,7 @@ AtlasWidget::AtlasWidget(const char* filename, QDir picpath, QWidget* parent, vbox1->addLayout(hbox1); sa_viewer = new QScrollArea(this); atlasViewer = new AtlasViewer(image, tissue, 2, dimx, dimy, dimz, dx, dy, - dz, &color_r, &color_g, &color_b, this); + dz, &color_r, &color_g, &color_b, this); sa_viewer->setWidget(atlasViewer); vbox1->addWidget(sa_viewer); scb_slicenr = new QScrollBar(0, dimz - 1, 1, 5, 0, Qt::Horizontal, this); @@ -106,7 +106,7 @@ AtlasWidget::AtlasWidget(const char* filename, QDir picpath, QWidget* parent, vbox1->addLayout(hbox2); vbox1->addLayout(hbox3); - zoomer = new zoomer_widget(1.0, m_picpath, this); + zoomer = new ZoomWidget(1.0, m_picpath, this); zoomer->setFixedSize(zoomer->sizeHint()); vbox1->addWidget(zoomer); lb_name = new QLabel(QString("jljlfds"), this); @@ -114,20 +114,20 @@ AtlasWidget::AtlasWidget(const char* filename, QDir picpath, QWidget* parent, setLayout(vbox1); QObject::connect(scb_slicenr, SIGNAL(valueChanged(int)), this, - SLOT(scb_slicenr_changed())); + SLOT(scb_slicenr_changed())); QObject::connect(sl_transp, SIGNAL(valueChanged(int)), this, - SLOT(sl_transp_changed())); + SLOT(sl_transp_changed())); QObject::connect(bg_orient, SIGNAL(buttonClicked(int)), this, - SLOT(xyz_changed())); + SLOT(xyz_changed())); QObject::connect(zoomer, SIGNAL(set_zoom(double)), atlasViewer, - SLOT(set_zoom(double))); + SLOT(set_zoom(double))); QObject::connect(sl_brightness, SIGNAL(valueChanged(int)), this, - SLOT(sl_brightcontr_moved())); + SLOT(sl_brightcontr_moved())); QObject::connect(sl_contrast, SIGNAL(valueChanged(int)), this, - SLOT(sl_brightcontr_moved())); + SLOT(sl_brightcontr_moved())); QObject::connect(atlasViewer, SIGNAL(mousemoved_sign(tissues_size_t)), this, - SLOT(pt_moved(tissues_size_t))); + SLOT(pt_moved(tissues_size_t))); atlasViewer->setMouseTracking(true); } @@ -137,7 +137,7 @@ AtlasWidget::~AtlasWidget() delete[] image; } -bool AtlasWidget::loadfile(const char* filename) +bool AtlasWidget::loadfile(const char *filename) { dimx = dimy = dimz = 10; dx = dy = dz = 1.0; @@ -200,17 +200,17 @@ bool AtlasWidget::loadfile(const char* filename) { for (unsigned short i = 0; i < dimz; i++) { - in.readRawData((char*)&(image[area * i]), area * sizeof(float)); - in.readRawData((char*)&(tissue[area * i]), - area * sizeof(tissues_size_t)); + in.readRawData((char *)&(image[area * i]), area * sizeof(float)); + in.readRawData((char *)&(tissue[area * i]), + area * sizeof(tissues_size_t)); } } else { - char* charBuffer = new char[area]; + char *charBuffer = new char[area]; for (unsigned short i = 0; i < dimz; i++) { - in.readRawData((char*)&(image[area * i]), area * sizeof(float)); + in.readRawData((char *)&(image[area * i]), area * sizeof(float)); in.readRawData(charBuffer, area); for (int j = 0; j < area; j++) { @@ -321,7 +321,7 @@ void AtlasWidget::sl_brightcontr_moved() float factor, offset; factor = 255.0f * (1 + sl_contrast->value()) / (maxval - minval); offset = - (127.5f - maxval * factor) * (1.0f - sl_brightness->value() * 0.01f) + - 0.01f * (127.5f - minval * factor) * sl_brightness->value(); + (127.5f - maxval * factor) * (1.0f - sl_brightness->value() * 0.01f) + + 0.01f * (127.5f - minval * factor) * sl_brightness->value(); atlasViewer->set_scale(offset, factor); } diff --git a/iSeg/AtlasWidget.h b/iSeg/AtlasWidget.h index 17b72bcf..97731b84 100755 --- a/iSeg/AtlasWidget.h +++ b/iSeg/AtlasWidget.h @@ -12,8 +12,9 @@ #include "WidgetCollection.h" +#include "Interface/Point.h" + #include "Core/Pair.h" -#include "Core/Point.h" #include #include @@ -42,36 +43,36 @@ class AtlasWidget : public QWidget { Q_OBJECT public: - AtlasWidget(const char* filename, QDir picpath, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0); + AtlasWidget(const char *filename, QDir picpath, QWidget *parent = 0, + const char *name = 0, Qt::WindowFlags wFlags = 0); ~AtlasWidget(); bool isOK; private: - QLabel* lb_contrast; - QLabel* lb_brightness; - QLabel* lb_transp; - QLabel* lb_name; - QSlider* sl_contrast; - QSlider* sl_brightness; - QSlider* sl_transp; - AtlasViewer* atlasViewer; - QScrollArea* sa_viewer; - zoomer_widget* zoomer; - QScrollBar* scb_slicenr; - QButtonGroup* bg_orient; - QRadioButton* rb_x; - QRadioButton* rb_y; - QRadioButton* rb_z; - QHBoxLayout* hbox1; - QHBoxLayout* hbox2; - QHBoxLayout* hbox3; - QVBoxLayout* vbox1; + QLabel *lb_contrast; + QLabel *lb_brightness; + QLabel *lb_transp; + QLabel *lb_name; + QSlider *sl_contrast; + QSlider *sl_brightness; + QSlider *sl_transp; + AtlasViewer *atlasViewer; + QScrollArea *sa_viewer; + ZoomWidget *zoomer; + QScrollBar *scb_slicenr; + QButtonGroup *bg_orient; + QRadioButton *rb_x; + QRadioButton *rb_y; + QRadioButton *rb_z; + QHBoxLayout *hbox1; + QHBoxLayout *hbox2; + QHBoxLayout *hbox3; + QVBoxLayout *vbox1; - bool loadfile(const char* filename); + bool loadfile(const char *filename); - float* image; - tissues_size_t* tissue; + float *image; + tissues_size_t *tissue; float minval, maxval; float dx, dy, dz; unsigned short dimx, dimy, dimz; diff --git a/iSeg/CMakeLists.txt b/iSeg/CMakeLists.txt index eb11dd14..69605fe1 100755 --- a/iSeg/CMakeLists.txt +++ b/iSeg/CMakeLists.txt @@ -162,8 +162,8 @@ ENDIF() ADD_EXECUTABLE(iSeg WIN32 MACOSX_BUNDLE ${ViewerSrcs} ${MOCSrcs} ${ViewerHeaders} ${RCCSrcs} ${CMAKE_BINARY_DIR}/config.h iSeg.rc ${ICON_FILES}) TARGET_COMPILE_DEFINITIONS(iSeg PRIVATE ${ISEG_DEFINITIONS}) TARGET_LINK_LIBRARIES(iSeg + iSegInterface iSegCore - Plugin QVTK predicates vtkGDCM @@ -190,3 +190,19 @@ IF(ISEG_BUILD_PRECOMPILED_HEADER) ENDFOREACH() ENDIF() ENDIF() + + +IF(APPLE) + # copy plugins to bundle + FOREACH(plugin ${PLUGIN_NAMES}) + LIST(APPEND PLUGIN_FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/lib${plugin}.dylib) + ADD_DEPENDENCIES(iSeg ${plugin}) + ENDFOREACH() + + ADD_CUSTOM_COMMAND( + TARGET iSeg + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + ${PLUGIN_FILES} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/iSeg.app/Contents/MacOS + ) +ENDIF() \ No newline at end of file diff --git a/iSeg/DicomReader.h b/iSeg/DicomReader.h index 593a509a..e95caccd 100755 --- a/iSeg/DicomReader.h +++ b/iSeg/DicomReader.h @@ -10,8 +10,9 @@ #ifndef dicomread_22Juli05 #define dicomread_22Juli05 +#include "Interface/Point.h" + #include "Core/Pair.h" -#include "Core/Point.h" #include #include diff --git a/iSeg/EdgeWidget.cpp b/iSeg/EdgeWidget.cpp index 8c1ac3be..880fb3bd 100755 --- a/iSeg/EdgeWidget.cpp +++ b/iSeg/EdgeWidget.cpp @@ -14,7 +14,7 @@ #include "SlicesHandler.h" #include "bmp_read_1.h" -#include "Core/Point.h" +#include "Interface/Point.h" #include #include @@ -31,12 +31,12 @@ using namespace iseg; EdgeWidget::EdgeWidget(SlicesHandler* hand3D, QWidget* parent, - const char* name, Qt::WindowFlags wFlags) - : WidgetInterface(parent, name, wFlags), handler3D(hand3D) + const char* name, Qt::WindowFlags wFlags) + : WidgetInterface(parent, name, wFlags), handler3D(hand3D) { setToolTip( - Format("Various edge extraction routines. These are mostly useful " - "as part of other segmentation techniques.")); + Format("Various edge extraction routines. These are mostly useful " + "as part of other segmentation techniques.")); activeslice = handler3D->get_activeslice(); bmphand = handler3D->get_activebmphandler(); @@ -102,16 +102,14 @@ EdgeWidget::EdgeWidget(SlicesHandler* hand3D, QWidget* parent, method_changed(0); QObject::connect(modegroup, SIGNAL(buttonClicked(int)), this, - SLOT(method_changed(int))); + SLOT(method_changed(int))); QObject::connect(btn_exec, SIGNAL(clicked()), this, SLOT(execute())); QObject::connect(sl_sigma, SIGNAL(valueChanged(int)), this, - SLOT(slider_changed(int))); + SLOT(slider_changed(int))); QObject::connect(sl_thresh1, SIGNAL(valueChanged(int)), this, - SLOT(slider_changed(int))); + SLOT(slider_changed(int))); QObject::connect(sl_thresh2, SIGNAL(valueChanged(int)), this, - SLOT(slider_changed(int))); - - return; + SLOT(slider_changed(int))); } EdgeWidget::~EdgeWidget() @@ -120,18 +118,15 @@ EdgeWidget::~EdgeWidget() delete modegroup; } -void EdgeWidget::slicenr_changed() +void EdgeWidget::on_slicenr_changed() { - // if(activeslice!=handler3D->get_activeslice()){ activeslice = handler3D->get_activeslice(); bmphand_changed(handler3D->get_activebmphandler()); - // } } void EdgeWidget::bmphand_changed(bmphandler* bmph) { bmphand = bmph; - return; } void EdgeWidget::execute() @@ -164,13 +159,13 @@ void EdgeWidget::execute() else if (rb_canny->isOn()) { bmphand->canny_line(sl_sigma->value() * 0.05f, - sl_thresh1->value() * 1.5f, - sl_thresh2->value() * 1.5f); + sl_thresh1->value() * 1.5f, + sl_thresh2->value() * 1.5f); } else { bmphand->laplacian_zero(sl_sigma->value() * 0.05f, - sl_thresh1->value() * 0.5f, false); + sl_thresh1->value() * 0.5f, false); } emit end_datachange(this); @@ -301,7 +296,7 @@ void EdgeWidget::newloaded() void EdgeWidget::init() { - slicenr_changed(); + on_slicenr_changed(); hideparams_changed(); } @@ -340,13 +335,13 @@ FILE* EdgeWidget::LoadParams(FILE* fp, int version) if (version >= 2) { QObject::disconnect(modegroup, SIGNAL(buttonClicked(int)), this, - SLOT(method_changed(int))); + SLOT(method_changed(int))); QObject::disconnect(sl_sigma, SIGNAL(valueChanged(int)), this, - SLOT(slider_changed(int))); + SLOT(slider_changed(int))); QObject::disconnect(sl_thresh1, SIGNAL(valueChanged(int)), this, - SLOT(slider_changed(int))); + SLOT(slider_changed(int))); QObject::disconnect(sl_thresh2, SIGNAL(valueChanged(int)), this, - SLOT(slider_changed(int))); + SLOT(slider_changed(int))); int dummy; fread(&dummy, sizeof(int), 1, fp); @@ -373,13 +368,13 @@ FILE* EdgeWidget::LoadParams(FILE* fp, int version) method_changed(0); QObject::connect(modegroup, SIGNAL(buttonClicked(int)), this, - SLOT(method_changed(int))); + SLOT(method_changed(int))); QObject::connect(sl_sigma, SIGNAL(valueChanged(int)), this, - SLOT(slider_changed(int))); + SLOT(slider_changed(int))); QObject::connect(sl_thresh1, SIGNAL(valueChanged(int)), this, - SLOT(slider_changed(int))); + SLOT(slider_changed(int))); QObject::connect(sl_thresh2, SIGNAL(valueChanged(int)), this, - SLOT(slider_changed(int))); + SLOT(slider_changed(int))); } return fp; } diff --git a/iSeg/EdgeWidget.h b/iSeg/EdgeWidget.h index f9f7d7c1..678a03a4 100755 --- a/iSeg/EdgeWidget.h +++ b/iSeg/EdgeWidget.h @@ -13,7 +13,7 @@ #include "SlicesHandler.h" #include "bmp_read_1.h" -#include "Plugin/WidgetInterface.h" +#include "Interface/WidgetInterface.h" #include #include @@ -37,22 +37,20 @@ class EdgeWidget : public WidgetInterface Q_OBJECT public: EdgeWidget(SlicesHandler* hand3D, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0); + const char* name = 0, Qt::WindowFlags wFlags = 0); ~EdgeWidget(); - QSize sizeHint() const; - void init(); - void newloaded(); - FILE* SaveParams(FILE* fp, int version); - FILE* LoadParams(FILE* fp, int version); - void hideparams_changed(); - std::string GetName() { return std::string("Edge"); }; - //virtual QIcon GetIcon() {return QIcon("images/edge.png");}; - virtual QIcon GetIcon(QDir picdir) - { - return QIcon(picdir.absFilePath(QString("edge.png")).ascii()); - }; + QSize sizeHint() const override; + void init() override; + void newloaded() override; + FILE* SaveParams(FILE* fp, int version) override; + FILE* LoadParams(FILE* fp, int version) override; + void hideparams_changed() override; + std::string GetName() override { return std::string("Edge"); } + QIcon GetIcon(QDir picdir) override { return QIcon(picdir.absFilePath(QString("edge.png"))); } private: + void on_slicenr_changed() override; + bmphandler* bmphand; SlicesHandler* handler3D; unsigned short activeslice; @@ -81,15 +79,6 @@ class EdgeWidget : public WidgetInterface QRadioButton* rb_laplacianzero; QButtonGroup* modegroup; -signals: - void begin_datachange(iseg::DataSelection& dataSelection, - QWidget* sender = NULL, bool beginUndo = true); - void end_datachange(QWidget* sender = NULL, - iseg::EndUndoAction undoAction = iseg::EndUndo); - -public slots: - void slicenr_changed(); - private slots: void bmphand_changed(bmphandler* bmph); void execute(); diff --git a/iSeg/FastmarchingFuzzyWidget.cpp b/iSeg/FastmarchingFuzzyWidget.cpp index 8f05d15e..d7d5d42e 100755 --- a/iSeg/FastmarchingFuzzyWidget.cpp +++ b/iSeg/FastmarchingFuzzyWidget.cpp @@ -33,17 +33,17 @@ using namespace iseg; FastmarchingFuzzyWidget::FastmarchingFuzzyWidget(SlicesHandler* hand3D, - QWidget* parent, const char* name, - Qt::WindowFlags wFlags) - : WidgetInterface(parent, name, wFlags), handler3D(hand3D) + QWidget* parent, const char* name, + Qt::WindowFlags wFlags) + : WidgetInterface(parent, name, wFlags), handler3D(hand3D) { setToolTip( - Format("The Fuzzy tab actually provides access to two different " - "segmentation techniques that have a very different " - "background but a similar user and interaction interface : " - "1) Fuzzy connectedness and 2) a Fast Marching " - "implementation of a levelset technique. Both methods " - "require a seed point to be specified.")); + Format("The Fuzzy tab actually provides access to two different " + "segmentation techniques that have a very different " + "background but a similar user and interaction interface : " + "1) Fuzzy connectedness and 2) a Fast Marching " + "implementation of a levelset technique. Both methods " + "require a seed point to be specified.")); activeslice = handler3D->get_activeslice(); bmphand = handler3D->get_activebmphandler(); @@ -78,35 +78,35 @@ FastmarchingFuzzyWidget::FastmarchingFuzzyWidget(SlicesHandler* hand3D, sl_m1 = new QSlider(Qt::Horizontal, hbox3); sl_m1->setRange(0, 100); sl_m1->setToolTip( - Format("The average gray value of the region to be segmented.")); + Format("The average gray value of the region to be segmented.")); sl_s1 = new QSlider(Qt::Horizontal, hbox4); sl_s1->setRange(0, 100); sl_s1->setToolTip( - Format("A measure of how much the gray values are expected " - "to deviate from m1 (standard deviation).")); + Format("A measure of how much the gray values are expected " + "to deviate from m1 (standard deviation).")); sl_s2 = new QSlider(Qt::Horizontal, hbox5); sl_s2->setRange(0, 100); sl_s2->setToolTip(Format("Sudden changes larger than s2 are considered to " - "indicate boundaries.")); + "indicate boundaries.")); rb_fastmarch = new QRadioButton(QString("Fast Marching"), vboxmethods); rb_fastmarch->setToolTip(Format( - "Fuzzy connectedness computes for each image " - "point the likelihood of its belonging to the same region as the " - "starting " - "point. It achieves this by looking at each possible connecting path " - "between the two points and assigning the image point probability as " - "identical to the probability of this path lying entirely in the same " - "tissue " - "as the start point.")); + "Fuzzy connectedness computes for each image " + "point the likelihood of its belonging to the same region as the " + "starting " + "point. It achieves this by looking at each possible connecting path " + "between the two points and assigning the image point probability as " + "identical to the probability of this path lying entirely in the same " + "tissue " + "as the start point.")); rb_fuzzy = new QRadioButton(QString("Fuzzy Connect."), vboxmethods); rb_fuzzy->setToolTip( - Format("This tool simulates the evolution of a line (boundary) on a 2D " - "image in time. " - "The boundary is continuously expanding. The Sigma parameter " - "(Gaussian smoothing) controls the impact of noise.")); + Format("This tool simulates the evolution of a line (boundary) on a 2D " + "image in time. " + "The boundary is continuously expanding. The Sigma parameter " + "(Gaussian smoothing) controls the impact of noise.")); bg_method = new QButtonGroup(this); bg_method->insert(rb_fastmarch); @@ -117,10 +117,10 @@ FastmarchingFuzzyWidget::FastmarchingFuzzyWidget(SlicesHandler* hand3D, rb_drag = new QRadioButton(QString("Drag"), hbox7); rb_drag->setToolTip( - Format("Drag allows the user to drag the mouse (after clicking on " - "the start point and keeping the mouse button pressed down) " - "specifying the " - "extent of the region on the image.")); + Format("Drag allows the user to drag the mouse (after clicking on " + "the start point and keeping the mouse button pressed down) " + "specifying the " + "extent of the region on the image.")); rb_drag->setChecked(TRUE); rb_drag->show(); rb_slider = new QRadioButton(QString("Slider"), hbox7); @@ -168,35 +168,35 @@ FastmarchingFuzzyWidget::FastmarchingFuzzyWidget(SlicesHandler* hand3D, IFTfuzzy = NULL; QObject::connect(sl_extend, SIGNAL(valueChanged(int)), this, - SLOT(slextend_changed(int))); + SLOT(slextend_changed(int))); QObject::connect(sl_extend, SIGNAL(sliderPressed()), this, - SLOT(slextend_pressed())); + SLOT(slextend_pressed())); QObject::connect(sl_extend, SIGNAL(sliderReleased()), this, - SLOT(slextend_released())); + SLOT(slextend_released())); QObject::connect(sl_sigma, SIGNAL(sliderMoved(int)), this, - SLOT(slider_changed())); + SLOT(slider_changed())); QObject::connect(sl_thresh, SIGNAL(sliderMoved(int)), this, - SLOT(slider_changed())); + SLOT(slider_changed())); QObject::connect(sl_m1, SIGNAL(sliderMoved(int)), this, - SLOT(slider_changed())); + SLOT(slider_changed())); QObject::connect(sl_s1, SIGNAL(sliderMoved(int)), this, - SLOT(slider_changed())); + SLOT(slider_changed())); QObject::connect(sl_s2, SIGNAL(sliderMoved(int)), this, - SLOT(slider_changed())); + SLOT(slider_changed())); QObject::connect(bg_method, SIGNAL(buttonClicked(int)), this, - SLOT(method_changed())); + SLOT(method_changed())); QObject::connect(bg_interact, SIGNAL(buttonClicked(int)), this, - SLOT(interact_changed())); + SLOT(interact_changed())); QObject::connect(sb_thresh, SIGNAL(valueChanged(int)), this, - SLOT(spinbox_changed())); + SLOT(spinbox_changed())); QObject::connect(sb_m1, SIGNAL(valueChanged(int)), this, - SLOT(spinbox_changed())); + SLOT(spinbox_changed())); QObject::connect(sb_s1, SIGNAL(valueChanged(int)), this, - SLOT(spinbox_changed())); + SLOT(spinbox_changed())); QObject::connect(sb_s2, SIGNAL(valueChanged(int)), this, - SLOT(spinbox_changed())); + SLOT(spinbox_changed())); sigma = 1.0f; sigmamax = 5.0f; @@ -221,16 +221,12 @@ FastmarchingFuzzyWidget::~FastmarchingFuzzyWidget() delete IFTmarch; if (IFTfuzzy != NULL) delete IFTfuzzy; - // if(map!=NULL) free(map); - return; } -void FastmarchingFuzzyWidget::slicenr_changed() +void FastmarchingFuzzyWidget::on_slicenr_changed() { - // if(activeslice!=handler3D->get_activeslice()){ activeslice = handler3D->get_activeslice(); bmphand_changed(handler3D->get_activebmphandler()); - // } } void FastmarchingFuzzyWidget::bmphand_changed(bmphandler* bmph) @@ -245,8 +241,6 @@ void FastmarchingFuzzyWidget::bmphand_changed(bmphandler* bmph) bmphand = bmph; sl_extend->setEnabled(false); - - return; } void FastmarchingFuzzyWidget::init() @@ -269,11 +263,6 @@ void FastmarchingFuzzyWidget::init() sl_extend->setEnabled(false); hideparams_changed(); - - // Point p; - // p.px=p.py=0; - // IFTmarch=bmphand->fastmarching_init(p,1.4f,20); - // IFTfuzzy } void FastmarchingFuzzyWidget::newloaded() @@ -304,7 +293,7 @@ void FastmarchingFuzzyWidget::getrange() return; } -void FastmarchingFuzzyWidget::mouse_clicked(Point p) +void FastmarchingFuzzyWidget::on_mouse_clicked(Point p) { if (rb_fastmarch->isOn()) { @@ -322,8 +311,8 @@ void FastmarchingFuzzyWidget::mouse_clicked(Point p) { IFTfuzzy = new ImageForestingTransformAdaptFuzzy; IFTfuzzy->fuzzy_init(bmphand->return_width(), - bmphand->return_height(), - bmphand->return_bmp(), p, m1, s1, s2); + bmphand->return_height(), + bmphand->return_bmp(), p, m1, s1, s2); } else { @@ -355,7 +344,7 @@ void FastmarchingFuzzyWidget::mouse_clicked(Point p) } } -void FastmarchingFuzzyWidget::mouse_released(Point p) +void FastmarchingFuzzyWidget::on_mouse_released(Point p) { if (rb_drag->isOn()) { @@ -377,7 +366,7 @@ void FastmarchingFuzzyWidget::mouse_released(Point p) } } -void FastmarchingFuzzyWidget::mouse_moved(Point p) +void FastmarchingFuzzyWidget::on_mouse_moved(Point p) { if (rb_drag->isOn()) { @@ -391,7 +380,7 @@ void FastmarchingFuzzyWidget::mouse_moved(Point p) unsigned pos = 0; if ((map[pos] <= extend && map[pos + 1] > extend) || - (map[pos] <= extend && map[pos + width] > extend)) + (map[pos] <= extend && map[pos + width] > extend)) { p.px = 0; p.py = 0; @@ -401,8 +390,8 @@ void FastmarchingFuzzyWidget::mouse_moved(Point p) for (unsigned short j = 1; j + 1 < width; j++) { if ((map[pos] <= extend && map[pos + 1] > extend) || - (map[pos] <= extend && map[pos - 1] > extend) || - (map[pos] <= extend && map[pos + width] > extend)) + (map[pos] <= extend && map[pos - 1] > extend) || + (map[pos] <= extend && map[pos + width] > extend)) { p.px = j; p.py = 0; @@ -411,7 +400,7 @@ void FastmarchingFuzzyWidget::mouse_moved(Point p) pos++; } if ((map[pos] <= extend && map[pos - 1] > extend) || - (map[pos] <= extend && map[pos + width] > extend)) + (map[pos] <= extend && map[pos + width] > extend)) { p.px = width - 1; p.py = 0; @@ -422,8 +411,8 @@ void FastmarchingFuzzyWidget::mouse_moved(Point p) for (unsigned short i = 1; i + 1 < height; i++) { if ((map[pos] <= extend && map[pos + 1] > extend) || - (map[pos] <= extend && map[pos + width] > extend) || - (map[pos] <= extend && map[pos - width] > extend)) + (map[pos] <= extend && map[pos + width] > extend) || + (map[pos] <= extend && map[pos - width] > extend)) { p.px = 0; p.py = i; @@ -433,9 +422,9 @@ void FastmarchingFuzzyWidget::mouse_moved(Point p) for (unsigned short j = 1; j + 1 < width; j++) { if ((map[pos] <= extend && map[pos + 1] > extend) || - (map[pos] <= extend && map[pos - 1] > extend) || - (map[pos] <= extend && map[pos + width] > extend) || - (map[pos] <= extend && map[pos - width] > extend)) + (map[pos] <= extend && map[pos - 1] > extend) || + (map[pos] <= extend && map[pos + width] > extend) || + (map[pos] <= extend && map[pos - width] > extend)) { p.px = j; p.py = i; @@ -444,8 +433,8 @@ void FastmarchingFuzzyWidget::mouse_moved(Point p) pos++; } if ((map[pos] <= extend && map[pos + 1] > extend) || - (map[pos] <= extend && map[pos + width] > extend) || - (map[pos] <= extend && map[pos - width] > extend)) + (map[pos] <= extend && map[pos + width] > extend) || + (map[pos] <= extend && map[pos - width] > extend)) { p.px = width - 1; p.py = i; @@ -454,7 +443,7 @@ void FastmarchingFuzzyWidget::mouse_moved(Point p) pos++; } if ((map[pos] <= extend && map[pos + 1] > extend) || - (map[pos] <= extend && map[pos - width] > extend)) + (map[pos] <= extend && map[pos - width] > extend)) { p.px = 0; p.py = height - 1; @@ -464,8 +453,8 @@ void FastmarchingFuzzyWidget::mouse_moved(Point p) for (unsigned short j = 1; j + 1 < width; j++) { if ((map[pos] <= extend && map[pos + 1] > extend) || - (map[pos] <= extend && map[pos - 1] > extend) || - (map[pos] <= extend && map[pos - width] > extend)) + (map[pos] <= extend && map[pos - 1] > extend) || + (map[pos] <= extend && map[pos - width] > extend)) { p.px = j; p.py = height - 1; @@ -474,7 +463,7 @@ void FastmarchingFuzzyWidget::mouse_moved(Point p) pos++; } if ((map[pos] <= extend && map[pos - 1] > extend) || - (map[pos] <= extend && map[pos - width] > extend)) + (map[pos] <= extend && map[pos - width] > extend)) { p.px = width - 1; p.py = height - 1; @@ -700,19 +689,19 @@ FILE* FastmarchingFuzzyWidget::LoadParams(FILE* fp, int version) if (version >= 2) { QObject::disconnect(sl_extend, SIGNAL(valueChanged(int)), this, - SLOT(slextend_changed(int))); + SLOT(slextend_changed(int))); QObject::disconnect(bg_method, SIGNAL(buttonClicked(int)), this, - SLOT(method_changed())); + SLOT(method_changed())); QObject::disconnect(bg_interact, SIGNAL(buttonClicked(int)), this, - SLOT(interact_changed())); + SLOT(interact_changed())); QObject::disconnect(sb_thresh, SIGNAL(valueChanged(int)), this, - SLOT(spinbox_changed())); + SLOT(spinbox_changed())); QObject::disconnect(sb_m1, SIGNAL(valueChanged(int)), this, - SLOT(spinbox_changed())); + SLOT(spinbox_changed())); QObject::disconnect(sb_s1, SIGNAL(valueChanged(int)), this, - SLOT(spinbox_changed())); + SLOT(spinbox_changed())); QObject::disconnect(sb_s2, SIGNAL(valueChanged(int)), this, - SLOT(spinbox_changed())); + SLOT(spinbox_changed())); int dummy; fread(&dummy, sizeof(int), 1, fp); @@ -757,19 +746,19 @@ FILE* FastmarchingFuzzyWidget::LoadParams(FILE* fp, int version) interact_changed(); QObject::connect(sl_extend, SIGNAL(valueChanged(int)), this, - SLOT(slextend_changed(int))); + SLOT(slextend_changed(int))); QObject::connect(bg_method, SIGNAL(buttonClicked(int)), this, - SLOT(method_changed())); + SLOT(method_changed())); QObject::connect(bg_interact, SIGNAL(buttonClicked(int)), this, - SLOT(interact_changed())); + SLOT(interact_changed())); QObject::connect(sb_thresh, SIGNAL(valueChanged(int)), this, - SLOT(spinbox_changed())); + SLOT(spinbox_changed())); QObject::connect(sb_m1, SIGNAL(valueChanged(int)), this, - SLOT(spinbox_changed())); + SLOT(spinbox_changed())); QObject::connect(sb_s1, SIGNAL(valueChanged(int)), this, - SLOT(spinbox_changed())); + SLOT(spinbox_changed())); QObject::connect(sb_s2, SIGNAL(valueChanged(int)), this, - SLOT(spinbox_changed())); + SLOT(spinbox_changed())); } return fp; } diff --git a/iSeg/FastmarchingFuzzyWidget.h b/iSeg/FastmarchingFuzzyWidget.h index c4ef7c88..cb4ab05d 100755 --- a/iSeg/FastmarchingFuzzyWidget.h +++ b/iSeg/FastmarchingFuzzyWidget.h @@ -7,13 +7,9 @@ * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ -#ifndef FMF_31March05 -#define FMF_31March05 +#pragma once -#include "Plugin/WidgetInterface.h" - -#include "Core/DataSelection.h" -#include "Core/Point.h" +#include "Interface/WidgetInterface.h" #include #include @@ -43,20 +39,23 @@ class FastmarchingFuzzyWidget : public WidgetInterface Q_OBJECT public: FastmarchingFuzzyWidget(SlicesHandler* hand3D, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0); + const char* name = 0, Qt::WindowFlags wFlags = 0); ~FastmarchingFuzzyWidget(); - void init(); - void newloaded(); - void cleanup(); - QSize sizeHint() const; - FILE* SaveParams(FILE* fp, int version); - FILE* LoadParams(FILE* fp, int version); - void hideparams_changed(); - std::string GetName() { return std::string("Fuzzy"); }; - virtual QIcon GetIcon(QDir picdir) - { - return QIcon(picdir.absFilePath(QString("fuzzy.png")).ascii()); - }; + void init() override; + void newloaded() override; + void cleanup() override; + QSize sizeHint() const override; + FILE* SaveParams(FILE* fp, int version) override; + FILE* LoadParams(FILE* fp, int version) override; + void hideparams_changed() override; + std::string GetName() override { return std::string("Fuzzy"); } + QIcon GetIcon(QDir picdir) override { return QIcon(picdir.absFilePath(QString("fuzzy.png"))); } + +protected: + void on_slicenr_changed() override; + void on_mouse_clicked(Point p) override; + void on_mouse_released(Point p) override; + void on_mouse_moved(Point p) override; private: float* map; @@ -109,19 +108,12 @@ class FastmarchingFuzzyWidget : public WidgetInterface signals: void vpdyn_changed(std::vector* vpdyn_arg); - void begin_datachange(iseg::DataSelection& dataSelection, - QWidget* sender = NULL, bool beginUndo = true); - void end_datachange(QWidget* sender = NULL, - iseg::EndUndoAction undoAction = iseg::EndUndo); - -public slots: - void slicenr_changed(); private slots: void bmphand_changed(bmphandler* bmph); - void mouse_clicked(Point p); - void mouse_released(Point p); - void mouse_moved(Point p); + //void mouse_clicked(Point p); + //void mouse_released(Point p); + //void mouse_moved(Point p); void slextend_changed(int i); void slextend_pressed(); void slextend_released(); @@ -133,5 +125,3 @@ private slots: }; } // namespace iseg - -#endif diff --git a/iSeg/featurewidget.cpp b/iSeg/FeatureWidget.cpp similarity index 82% rename from iSeg/featurewidget.cpp rename to iSeg/FeatureWidget.cpp index e552b2b9..78fbc6d1 100755 --- a/iSeg/featurewidget.cpp +++ b/iSeg/FeatureWidget.cpp @@ -17,7 +17,6 @@ #include "Core/ImageForestingTransform.h" #include "Core/Pair.h" -#include "Core/Point.h" #include "Core/addLine.h" #include @@ -41,14 +40,14 @@ using namespace iseg; FeatureWidget::FeatureWidget(SlicesHandler* hand3D, QWidget* parent, - const char* name, Qt::WindowFlags wFlags) - : WidgetInterface(parent, name, wFlags), handler3D(hand3D) + const char* name, Qt::WindowFlags wFlags) + : WidgetInterface(parent, name, wFlags), handler3D(hand3D) { setToolTip(Format( - "Obtain information about the gray value and tissue distribution." - "
" - "A rectangular area is marked by pressing down the left mouse " - "button and moving the mouse.")); + "Obtain information about the gray value and tissue distribution." + "
" + "A rectangular area is marked by pressing down the left mouse " + "button and moving the mouse.")); activeslice = handler3D->get_activeslice(); bmphand = handler3D->get_activebmphandler(); @@ -88,7 +87,7 @@ FeatureWidget::FeatureWidget(SlicesHandler* hand3D, QWidget* parent, vbox2->setFixedSize(vbox2->sizeHint()); // BL: hack to make layout wide enought to show very long tissue names vbox3->setFixedSize(3 * vbox3->sizeHint().width(), - vbox3->sizeHint().height()); + vbox3->sizeHint().height()); hbox1->setFixedSize(hbox1->sizeHint()); lb_map_value->setText("Source:"); @@ -100,13 +99,13 @@ FeatureWidget::FeatureWidget(SlicesHandler* hand3D, QWidget* parent, QSize FeatureWidget::sizeHint() const { return hbox1->sizeHint(); } -void FeatureWidget::pt_clicked(Point p) +void FeatureWidget::on_mouse_clicked(Point p) { selecting = true; pstart = p; } -void FeatureWidget::pt_moved(Point p) +void FeatureWidget::on_mouse_moved(Point p) { if (selecting) { @@ -126,25 +125,25 @@ void FeatureWidget::pt_moved(Point p) Pair psize = handler3D->get_pixelsize(); lb_pt_value->setText(QString::number(handler3D->return_width() - 1 - p.px) + - QString(":") + QString::number(p.py)); + QString(":") + QString::number(p.py)); lb_work_pt_value->setText( - QString("(") + - QString::number((handler3D->return_width() - 1 - p.px) * psize.high) + - QString(":") + QString::number(p.py * psize.low) + QString(" mm)")); + QString("(") + + QString::number((handler3D->return_width() - 1 - p.px) * psize.high) + + QString(":") + QString::number(p.py * psize.low) + QString(" mm)")); lb_grey_value->setText(QString::number(bmphand->bmp_pt(p))); lb_work_grey_value->setText(QString::number(bmphand->work_pt(p))); tissues_size_t tnr = - bmphand->tissues_pt(handler3D->get_active_tissuelayer(), p); + bmphand->tissues_pt(handler3D->get_active_tissuelayer(), p); if (tnr == 0) lb_tissuename->setText("- (0)"); else lb_tissuename->setText(TissueInfos::GetTissueName(tnr) + QString(" (") + - QString::number((int)tnr) + QString(")")); + QString::number((int)tnr) + QString(")")); return; } -void FeatureWidget::pt_released(Point p) +void FeatureWidget::on_mouse_released(Point p) { dynamic.clear(); emit vpdyn_changed(&dynamic); @@ -167,19 +166,18 @@ void FeatureWidget::pt_released(Point p) lb_work_stddev_value->setText(QString::number(stddev)); lb_work_min_value->setText(QString::number(extrema.low)); lb_work_max_value->setText(QString::number(extrema.high)); - - return; } -void FeatureWidget::slicenr_changed() +void FeatureWidget::on_slicenr_changed() { - // if(activeslice!=handler3D->get_activeslice()){ activeslice = handler3D->get_activeslice(); bmphand = handler3D->get_activebmphandler(); - // } } -void FeatureWidget::init() { slicenr_changed(); } +void FeatureWidget::init() +{ + on_slicenr_changed(); +} void FeatureWidget::newloaded() { diff --git a/iSeg/featurewidget.h b/iSeg/FeatureWidget.h similarity index 80% rename from iSeg/featurewidget.h rename to iSeg/FeatureWidget.h index cc211752..a3d77e4e 100755 --- a/iSeg/featurewidget.h +++ b/iSeg/FeatureWidget.h @@ -9,7 +9,8 @@ */ #pragma once -#include "Plugin/WidgetInterface.h" +#include "Interface/WidgetInterface.h" + #include "SlicesHandler.h" #include "bmp_read_1.h" @@ -42,17 +43,19 @@ class FeatureWidget : public WidgetInterface Q_OBJECT public: FeatureWidget(SlicesHandler* hand3D, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0); + const char* name = 0, Qt::WindowFlags wFlags = 0); void init(); void newloaded(); - QSize sizeHint() const; - std::string GetName() { return std::string("Feature"); }; - virtual QIcon GetIcon(QDir picdir) - { - return QIcon(picdir.absFilePath(QString("feature.png")).ascii()); - }; + QSize sizeHint() const override; + std::string GetName() { return std::string("Feature"); } + QIcon GetIcon(QDir picdir) { return QIcon(picdir.absFilePath(QString("feature.png")).ascii()); } private: + void on_slicenr_changed() override; + void on_mouse_clicked(Point p) override; + void on_mouse_moved(Point p) override; + void on_mouse_released(Point p) override; + bool selecting; std::vector dynamic; bmphandler* bmphand; @@ -90,14 +93,6 @@ class FeatureWidget : public WidgetInterface signals: void vpdyn_changed(std::vector* vpdyn); - -public slots: - void slicenr_changed(); - -private slots: - void pt_clicked(Point p); - void pt_moved(Point p); - void pt_released(Point p); }; } // namespace iseg diff --git a/iSeg/HystereticGrowingWidget.cpp b/iSeg/HystereticGrowingWidget.cpp index cd75e12d..0bef4c0e 100755 --- a/iSeg/HystereticGrowingWidget.cpp +++ b/iSeg/HystereticGrowingWidget.cpp @@ -15,7 +15,6 @@ #include "bmp_read_1.h" #include "Core/Pair.h" -#include "Core/Point.h" #include "Core/addLine.h" #include @@ -41,11 +40,11 @@ using namespace std; using namespace iseg; HystereticGrowingWidget::HystereticGrowingWidget(SlicesHandler* hand3D, QWidget* parent, - const char* name, Qt::WindowFlags wFlags) - : WidgetInterface(parent, name, wFlags), handler3D(hand3D) + const char* name, Qt::WindowFlags wFlags) + : WidgetInterface(parent, name, wFlags), handler3D(hand3D) { setToolTip(Format("Segment a tissue by picking seed points and adding " - "neighboring pixels with similar intensities.")); + "neighboring pixels with similar intensities.")); activeslice = handler3D->get_activeslice(); bmphand = handler3D->get_activebmphandler(); @@ -122,57 +121,53 @@ HystereticGrowingWidget::HystereticGrowingWidget(SlicesHandler* hand3D, QWidget* QObject::connect(clearlimit, SIGNAL(clicked()), this, SLOT(clearpressed())); QObject::connect(autoseed, SIGNAL(clicked()), this, SLOT(auto_toggled())); QObject::connect(sl_lower, SIGNAL(sliderMoved(int)), this, - SLOT(slider_changed())); + SLOT(slider_changed())); QObject::connect(sl_upper, SIGNAL(sliderMoved(int)), this, - SLOT(slider_changed())); + SLOT(slider_changed())); QObject::connect(sl_lowerhyster, SIGNAL(sliderMoved(int)), this, - SLOT(slider_changed())); + SLOT(slider_changed())); QObject::connect(sl_upperhyster, SIGNAL(sliderMoved(int)), this, - SLOT(slider_changed())); + SLOT(slider_changed())); QObject::connect(sl_lower, SIGNAL(sliderPressed()), this, - SLOT(slider_pressed())); + SLOT(slider_pressed())); QObject::connect(sl_upper, SIGNAL(sliderPressed()), this, - SLOT(slider_pressed())); + SLOT(slider_pressed())); QObject::connect(sl_lowerhyster, SIGNAL(sliderPressed()), this, - SLOT(slider_pressed())); + SLOT(slider_pressed())); QObject::connect(sl_upperhyster, SIGNAL(sliderPressed()), this, - SLOT(slider_pressed())); + SLOT(slider_pressed())); QObject::connect(sl_lower, SIGNAL(sliderReleased()), this, - SLOT(slider_released())); + SLOT(slider_released())); QObject::connect(sl_upper, SIGNAL(sliderReleased()), this, - SLOT(slider_released())); + SLOT(slider_released())); QObject::connect(sl_lowerhyster, SIGNAL(sliderReleased()), this, - SLOT(slider_released())); + SLOT(slider_released())); QObject::connect(sl_upperhyster, SIGNAL(sliderReleased()), this, - SLOT(slider_released())); + SLOT(slider_released())); QObject::connect(le_bordervall, SIGNAL(returnPressed()), this, - SLOT(le_bordervall_returnpressed())); + SLOT(le_bordervall_returnpressed())); QObject::connect(le_bordervalu, SIGNAL(returnPressed()), this, - SLOT(le_bordervalu_returnpressed())); + SLOT(le_bordervalu_returnpressed())); QObject::connect(le_bordervallh, SIGNAL(returnPressed()), this, - SLOT(le_bordervallh_returnpressed())); + SLOT(le_bordervallh_returnpressed())); QObject::connect(le_bordervaluh, SIGNAL(returnPressed()), this, - SLOT(le_bordervaluh_returnpressed())); + SLOT(le_bordervaluh_returnpressed())); QObject::connect(pb_saveborders, SIGNAL(clicked()), this, - SLOT(saveborders_execute())); + SLOT(saveborders_execute())); QObject::connect(pb_loadborders, SIGNAL(clicked()), this, - SLOT(loadborders_execute())); + SLOT(loadborders_execute())); update_visible(); getrange(); init1(); } -HystereticGrowingWidget::~HystereticGrowingWidget() { delete vbox1; } - -void HystereticGrowingWidget::slicenr_changed() +void HystereticGrowingWidget::on_slicenr_changed() { - // if(activeslice!=handler3D->get_activeslice()){ activeslice = handler3D->get_activeslice(); bmphand_changed(handler3D->get_activebmphandler()); - // } } void HystereticGrowingWidget::bmphand_changed(bmphandler* bmph) @@ -182,11 +177,9 @@ void HystereticGrowingWidget::bmphand_changed(bmphandler* bmph) getrange(); init1(); - - return; } -void HystereticGrowingWidget::pt_clicked(Point p) +void HystereticGrowingWidget::on_mouse_clicked(Point p) { if (limitdrawing) { @@ -254,35 +247,35 @@ void HystereticGrowingWidget::execute1() if (autoseed->isOn()) { float ll = lower_limit + - (upper_limit - lower_limit) * 0.005f * sl_lower->value(); + (upper_limit - lower_limit) * 0.005f * sl_lower->value(); float uu = lower_limit + - (upper_limit - lower_limit) * 0.005f * sl_upper->value(); + (upper_limit - lower_limit) * 0.005f * sl_upper->value(); float ul = ll + (uu - ll) * 0.005f * sl_lowerhyster->value(); float lu = ll + (uu - ll) * 0.005f * sl_upperhyster->value(); if (allslices->isChecked()) handler3D->double_hysteretic_allslices(ll, ul, lu, uu, false, - 255.0f); + 255.0f); else bmphand->double_hysteretic(ll, ul, lu, uu, false, 255.0f); le_bordervall->setText(QString::number(ll, 'g', 3)); le_bordervalu->setText(QString::number(uu, 'g', 3)); le_bordervallh->setText( - QString::number(int(0.4f + (ul - ll) / (uu - ll) * 100), 'g', 3)); + QString::number(int(0.4f + (ul - ll) / (uu - ll) * 100), 'g', 3)); le_bordervaluh->setText( - QString::number(int(0.4f + (lu - ll) / (uu - ll) * 100), 'g', 3)); + QString::number(int(0.4f + (lu - ll) / (uu - ll) * 100), 'g', 3)); } else { float ll = lower_limit + - (upper_limit - lower_limit) * 0.005f * sl_lower->value(); + (upper_limit - lower_limit) * 0.005f * sl_lower->value(); float uu = lower_limit + - (upper_limit - lower_limit) * 0.005f * sl_upper->value(); + (upper_limit - lower_limit) * 0.005f * sl_upper->value(); // bmphand->thresholded_growing(p1,ll,uu,false,255.f); if (allslices->isChecked()) { handler3D->thresholded_growing(handler3D->get_activeslice(), p1, ll, - uu, 255.f); + uu, 255.f); } else { @@ -297,9 +290,9 @@ void HystereticGrowingWidget::execute1() void HystereticGrowingWidget::getrange() { float ll = - lower_limit + (upper_limit - lower_limit) * 0.005f * sl_lower->value(); + lower_limit + (upper_limit - lower_limit) * 0.005f * sl_lower->value(); float uu = - lower_limit + (upper_limit - lower_limit) * 0.005f * sl_upper->value(); + lower_limit + (upper_limit - lower_limit) * 0.005f * sl_upper->value(); float ul = ll + (uu - ll) * 0.005f * sl_lowerhyster->value(); float lu = ll + (uu - ll) * 0.005f * sl_upperhyster->value(); @@ -329,7 +322,7 @@ void HystereticGrowingWidget::getrange_sub(float ll, float uu, float ul, float l sl_lower->setValue(100); else sl_lower->setValue(int( - 0.5f + (ll - lower_limit) / (upper_limit - lower_limit) * 200)); + 0.5f + (ll - lower_limit) / (upper_limit - lower_limit) * 200)); } if (uu < lower_limit) @@ -348,7 +341,7 @@ void HystereticGrowingWidget::getrange_sub(float ll, float uu, float ul, float l sl_upper->setValue(100); else sl_upper->setValue(int( - 0.5f + (uu - lower_limit) / (upper_limit - lower_limit) * 200)); + 0.5f + (uu - lower_limit) / (upper_limit - lower_limit) * 200)); } if (ul < ll) @@ -390,9 +383,9 @@ void HystereticGrowingWidget::getrange_sub(float ll, float uu, float ul, float l le_bordervall->setText(QString::number(ll, 'g', 3)); le_bordervalu->setText(QString::number(uu, 'g', 3)); le_bordervallh->setText( - QString::number(int(0.4f + (ul - ll) / (uu - ll) * 100), 'g', 3)); + QString::number(int(0.4f + (ul - ll) / (uu - ll) * 100), 'g', 3)); le_bordervaluh->setText( - QString::number(int(0.4f + (lu - ll) / (uu - ll) * 100), 'g', 3)); + QString::number(int(0.4f + (lu - ll) / (uu - ll) * 100), 'g', 3)); return; } @@ -429,7 +422,7 @@ void HystereticGrowingWidget::newloaded() vector>* vvp = bmphand->return_limits(); vp1.clear(); for (vector>::iterator it = vvp->begin(); it != vvp->end(); - it++) + it++) { vp1.insert(vp1.end(), it->begin(), it->end()); ; @@ -444,7 +437,7 @@ void HystereticGrowingWidget::init1() vector>* vvp = bmphand->return_limits(); vp1.clear(); for (vector>::iterator it = vvp->begin(); it != vvp->end(); - it++) + it++) { vp1.insert(vp1.end(), it->begin(), it->end()); ; @@ -453,7 +446,7 @@ void HystereticGrowingWidget::init1() emit vp1_changed(&vp1); } -void HystereticGrowingWidget::clean_up() +void HystereticGrowingWidget::cleanup() { limitdrawing = false; drawlimit->setDown(false); @@ -462,7 +455,7 @@ void HystereticGrowingWidget::clean_up() return; } -void HystereticGrowingWidget::pt_moved(Point p) +void HystereticGrowingWidget::on_mouse_moved(Point p) { if (limitdrawing) { @@ -472,7 +465,7 @@ void HystereticGrowingWidget::pt_moved(Point p) } } -void HystereticGrowingWidget::pt_released(Point p) +void HystereticGrowingWidget::on_mouse_released(Point p) { if (limitdrawing) { @@ -536,7 +529,7 @@ void HystereticGrowingWidget::slider_released() { emit end_datachange(this); } void HystereticGrowingWidget::saveborders_execute() { QString savefilename = Q3FileDialog::getSaveFileName( - QString::null, "Thresholds (*.txt)\n", this); //, filename); + QString::null, "Thresholds (*.txt)\n", this); //, filename); if (savefilename.length() > 4 && !savefilename.endsWith(QString(".txt"))) savefilename.append(".txt"); @@ -544,9 +537,9 @@ void HystereticGrowingWidget::saveborders_execute() if (!savefilename.isEmpty()) { float ll = lower_limit + - (upper_limit - lower_limit) * 0.005f * sl_lower->value(); + (upper_limit - lower_limit) * 0.005f * sl_lower->value(); float uu = lower_limit + - (upper_limit - lower_limit) * 0.005f * sl_upper->value(); + (upper_limit - lower_limit) * 0.005f * sl_upper->value(); float ul = ll + (uu - ll) * 0.005f * sl_lowerhyster->value(); float lu = ll + (uu - ll) * 0.005f * sl_upperhyster->value(); FILE* fp = fopen(savefilename.ascii(), "w"); @@ -558,9 +551,9 @@ void HystereticGrowingWidget::saveborders_execute() void HystereticGrowingWidget::loadborders_execute() { QString loadfilename = Q3FileDialog::getOpenFileName(QString::null, - "Borders (*.txt)\n" - "All(*.*)", - this); + "Borders (*.txt)\n" + "All(*.*)", + this); if (!loadfilename.isEmpty()) { @@ -582,7 +575,7 @@ void HystereticGrowingWidget::le_bordervall_returnpressed() bool b1; float val = le_bordervall->text().toFloat(&b1); float ll = - lower_limit + (upper_limit - lower_limit) * 0.005f * sl_lower->value(); + lower_limit + (upper_limit - lower_limit) * 0.005f * sl_lower->value(); if (b1) { if (val < lower_limit) @@ -607,8 +600,8 @@ void HystereticGrowingWidget::le_bordervall_returnpressed() } else sl_lower->setValue(int(0.5f + (val - lower_limit) / - (upper_limit - lower_limit) * - 200)); + (upper_limit - lower_limit) * + 200)); } execute(); @@ -625,7 +618,7 @@ void HystereticGrowingWidget::le_bordervalu_returnpressed() bool b1; float val = le_bordervalu->text().toFloat(&b1); float uu = - lower_limit + (upper_limit - lower_limit) * 0.005f * sl_upper->value(); + lower_limit + (upper_limit - lower_limit) * 0.005f * sl_upper->value(); if (b1) { if (val < lower_limit) @@ -650,8 +643,8 @@ void HystereticGrowingWidget::le_bordervalu_returnpressed() } else sl_upper->setValue(int(0.5f + (val - lower_limit) / - (upper_limit - lower_limit) * - 200)); + (upper_limit - lower_limit) * + 200)); } execute(); @@ -668,9 +661,9 @@ void HystereticGrowingWidget::le_bordervallh_returnpressed() bool b1; float val = le_bordervallh->text().toFloat(&b1); float ll = - lower_limit + (upper_limit - lower_limit) * 0.005f * sl_lower->value(); + lower_limit + (upper_limit - lower_limit) * 0.005f * sl_lower->value(); float uu = - lower_limit + (upper_limit - lower_limit) * 0.005f * sl_upper->value(); + lower_limit + (upper_limit - lower_limit) * 0.005f * sl_upper->value(); float ul = ll + (uu - ll) * 0.005f * sl_lowerhyster->value(); if (b1) { @@ -679,14 +672,14 @@ void HystereticGrowingWidget::le_bordervallh_returnpressed() ul = ll; sl_lowerhyster->setValue(0); le_bordervallh->setText( - QString::number(int((ul - ll) / (uu - ll) * 100), 'g', 3)); + QString::number(int((ul - ll) / (uu - ll) * 100), 'g', 3)); } else if (val > 100) { ul = uu; sl_lowerhyster->setValue(200); le_bordervallh->setText( - QString::number(int((ul - ll) / (uu - ll) * 100), 'g', 3)); + QString::number(int((ul - ll) / (uu - ll) * 100), 'g', 3)); } else { @@ -695,7 +688,7 @@ void HystereticGrowingWidget::le_bordervallh_returnpressed() ul = uu; sl_lowerhyster->setValue(100); le_bordervallh->setText( - QString::number(int((ul - ll) / (uu - ll) * 100), 'g', 3)); + QString::number(int((ul - ll) / (uu - ll) * 100), 'g', 3)); } else sl_lowerhyster->setValue(int(0.5f + val / 100 * 200)); @@ -707,7 +700,7 @@ void HystereticGrowingWidget::le_bordervallh_returnpressed() { QApplication::beep(); le_bordervallh->setText( - QString::number(int((ul - ll) / (uu - ll) * 100), 'g', 3)); + QString::number(int((ul - ll) / (uu - ll) * 100), 'g', 3)); } } @@ -716,9 +709,9 @@ void HystereticGrowingWidget::le_bordervaluh_returnpressed() bool b1; float val = le_bordervaluh->text().toFloat(&b1); float ll = - lower_limit + (upper_limit - lower_limit) * 0.005f * sl_lower->value(); + lower_limit + (upper_limit - lower_limit) * 0.005f * sl_lower->value(); float uu = - lower_limit + (upper_limit - lower_limit) * 0.005f * sl_upper->value(); + lower_limit + (upper_limit - lower_limit) * 0.005f * sl_upper->value(); float lu = ll + (uu - ll) * 0.005f * sl_upperhyster->value(); if (b1) { @@ -727,14 +720,14 @@ void HystereticGrowingWidget::le_bordervaluh_returnpressed() lu = ll; sl_upperhyster->setValue(0); le_bordervaluh->setText( - QString::number(int((lu - ll) / (uu - ll) * 100), 'g', 3)); + QString::number(int((lu - ll) / (uu - ll) * 100), 'g', 3)); } else if (val > 100) { lu = uu; sl_upperhyster->setValue(200); le_bordervaluh->setText( - QString::number(int((lu - ll) / (uu - ll) * 100), 'g', 3)); + QString::number(int((lu - ll) / (uu - ll) * 100), 'g', 3)); } else { @@ -743,7 +736,7 @@ void HystereticGrowingWidget::le_bordervaluh_returnpressed() lu = uu; sl_upperhyster->setValue(100); le_bordervaluh->setText( - QString::number(int((lu - ll) / (uu - ll) * 100), 'g', 3)); + QString::number(int((lu - ll) / (uu - ll) * 100), 'g', 3)); } else sl_upperhyster->setValue(int(0.5f + val / 100 * 200)); @@ -755,7 +748,7 @@ void HystereticGrowingWidget::le_bordervaluh_returnpressed() { QApplication::beep(); le_bordervaluh->setText( - QString::number(int((lu - ll) / (uu - ll) * 100), 'g', 3)); + QString::number(int((lu - ll) / (uu - ll) * 100), 'g', 3)); } } @@ -789,15 +782,15 @@ FILE* HystereticGrowingWidget::LoadParams(FILE* fp, int version) if (version >= 2) { QObject::disconnect(autoseed, SIGNAL(clicked()), this, - SLOT(auto_toggled())); + SLOT(auto_toggled())); QObject::disconnect(sl_lower, SIGNAL(sliderMoved(int)), this, - SLOT(slider_changed())); + SLOT(slider_changed())); QObject::disconnect(sl_upper, SIGNAL(sliderMoved(int)), this, - SLOT(slider_changed())); + SLOT(slider_changed())); QObject::disconnect(sl_lowerhyster, SIGNAL(sliderMoved(int)), this, - SLOT(slider_changed())); + SLOT(slider_changed())); QObject::disconnect(sl_upperhyster, SIGNAL(sliderMoved(int)), this, - SLOT(slider_changed())); + SLOT(slider_changed())); int dummy; fread(&dummy, sizeof(int), 1, fp); @@ -821,15 +814,15 @@ FILE* HystereticGrowingWidget::LoadParams(FILE* fp, int version) fread(&lower_limit, sizeof(float), 1, fp); QObject::connect(autoseed, SIGNAL(clicked()), this, - SLOT(auto_toggled())); + SLOT(auto_toggled())); QObject::connect(sl_lower, SIGNAL(sliderMoved(int)), this, - SLOT(slider_changed())); + SLOT(slider_changed())); QObject::connect(sl_upper, SIGNAL(sliderMoved(int)), this, - SLOT(slider_changed())); + SLOT(slider_changed())); QObject::connect(sl_lowerhyster, SIGNAL(sliderMoved(int)), this, - SLOT(slider_changed())); + SLOT(slider_changed())); QObject::connect(sl_upperhyster, SIGNAL(sliderMoved(int)), this, - SLOT(slider_changed())); + SLOT(slider_changed())); } return fp; } diff --git a/iSeg/HystereticGrowingWidget.h b/iSeg/HystereticGrowingWidget.h index d30a3575..6a2cf864 100755 --- a/iSeg/HystereticGrowingWidget.h +++ b/iSeg/HystereticGrowingWidget.h @@ -7,13 +7,12 @@ * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ -#ifndef THRESHWIDGET_14March05 -#define THRESHWIDGET_14March05 +#pragma once #include "SlicesHandler.h" #include "bmp_read_1.h" -#include "Plugin/WidgetInterface.h" +#include "Interface/WidgetInterface.h" #include #include @@ -43,22 +42,24 @@ class HystereticGrowingWidget : public WidgetInterface Q_OBJECT public: HystereticGrowingWidget(SlicesHandler* hand3D, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0); - ~HystereticGrowingWidget(); - void init(); - void newloaded(); - void clean_up(); - QSize sizeHint() const; - FILE* SaveParams(FILE* fp, int version); - FILE* LoadParams(FILE* fp, int version); - void hideparams_changed(); - std::string GetName() { return std::string("Growing"); }; - virtual QIcon GetIcon(QDir picdir) - { - return QIcon(picdir.absFilePath(QString("growing.png")).ascii()); - }; + const char* name = 0, Qt::WindowFlags wFlags = 0); + ~HystereticGrowingWidget() {} + void init() override; + void newloaded() override; + void cleanup() override; + QSize sizeHint() const override; + FILE* SaveParams(FILE* fp, int version) override; + FILE* LoadParams(FILE* fp, int version) override; + void hideparams_changed() override; + std::string GetName() override { return std::string("Growing"); } + QIcon GetIcon(QDir picdir) override { return QIcon(picdir.absFilePath(QString("growing.png"))); } private: + void on_slicenr_changed() override; + void on_mouse_clicked(Point p) override; + void on_mouse_moved(Point p) override; + void on_mouse_released(Point p) override; + void init1(); Point p1; Point last_pt; @@ -109,20 +110,10 @@ class HystereticGrowingWidget : public WidgetInterface void vpdyn_changed(std::vector* vpdyn_arg); void vp1_changed(std::vector* vp1_arg); void vp1dyn_changed(std::vector* vp1_arg, - std::vector* vpdyn_arg); - void begin_datachange(iseg::DataSelection& dataSelection, - QWidget* sender = NULL, bool beginUndo = true); - void end_datachange(QWidget* sender = NULL, - iseg::EndUndoAction undoAction = iseg::EndUndo); - -public slots: - void slicenr_changed(); + std::vector* vpdyn_arg); private slots: void bmphand_changed(bmphandler* bmph); - void pt_clicked(Point p); - void pt_moved(Point p); - void pt_released(Point p); void auto_toggled(); void update_visible(); void execute(); @@ -141,5 +132,3 @@ private slots: }; } // namespace iseg - -#endif diff --git a/iSeg/ImageForestingTransformRegionGrowingWidget.cpp b/iSeg/ImageForestingTransformRegionGrowingWidget.cpp index d5c81298..7667cc02 100755 --- a/iSeg/ImageForestingTransformRegionGrowingWidget.cpp +++ b/iSeg/ImageForestingTransformRegionGrowingWidget.cpp @@ -115,11 +115,11 @@ void ImageForestingTransformRegionGrowingWidget::init() } } else + { init1(); + } hideparams_changed(); - - return; } void ImageForestingTransformRegionGrowingWidget::newloaded() @@ -136,7 +136,6 @@ void ImageForestingTransformRegionGrowingWidget::init1() it++) { vm.insert(vm.end(), it->begin(), it->end()); - ; } emit vm_changed(&vm); area = bmphand->return_height() * (unsigned)bmphand->return_width(); @@ -179,13 +178,15 @@ void ImageForestingTransformRegionGrowingWidget::cleanup() emit vm_changed(&vmempty); } -void ImageForestingTransformRegionGrowingWidget::tissuenr_changed(int i) +void ImageForestingTransformRegionGrowingWidget::on_tissuenr_changed(int i) { + // \todo B + cerr << "ImageForestingTransformRegionGrowingWidget: tissuenr = " << i << std::endl; tissuenr = (unsigned)i + 1; return; } -void ImageForestingTransformRegionGrowingWidget::mouse_clicked(Point p) +void ImageForestingTransformRegionGrowingWidget::on_mouse_clicked(Point p) { last_pt = p; if (pushremove->isOn()) @@ -194,7 +195,7 @@ void ImageForestingTransformRegionGrowingWidget::mouse_clicked(Point p) } } -void ImageForestingTransformRegionGrowingWidget::mouse_moved(Point p) +void ImageForestingTransformRegionGrowingWidget::on_mouse_moved(Point p) { if (!pushremove->isOn()) { @@ -204,7 +205,7 @@ void ImageForestingTransformRegionGrowingWidget::mouse_moved(Point p) } } -void ImageForestingTransformRegionGrowingWidget::mouse_released(Point p) +void ImageForestingTransformRegionGrowingWidget::on_mouse_released(Point p) { if (!pushremove->isOn()) { @@ -309,7 +310,7 @@ void ImageForestingTransformRegionGrowingWidget::bmp_changed() init1(); } -void ImageForestingTransformRegionGrowingWidget::slicenr_changed() +void ImageForestingTransformRegionGrowingWidget::on_slicenr_changed() { // if(activeslice!=handler3D->get_activeslice()){ activeslice = handler3D->get_activeslice(); diff --git a/iSeg/ImageForestingTransformRegionGrowingWidget.h b/iSeg/ImageForestingTransformRegionGrowingWidget.h index 2d4a4891..a062e41a 100755 --- a/iSeg/ImageForestingTransformRegionGrowingWidget.h +++ b/iSeg/ImageForestingTransformRegionGrowingWidget.h @@ -7,16 +7,12 @@ * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ -#ifndef IFTRG_29March05 -#define IFTRG_29March05 +#pragma once #include "SlicesHandler.h" #include "bmp_read_1.h" -#include "Plugin/WidgetInterface.h" - -#include "Core/DataSelection.h" -#include "Core/Point.h" +#include "Interface/WidgetInterface.h" #include #include @@ -37,71 +33,62 @@ class ImageForestingTransformRegionGrowingWidget : public WidgetInterface { Q_OBJECT public: - ImageForestingTransformRegionGrowingWidget(SlicesHandler* hand3D, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0); + ImageForestingTransformRegionGrowingWidget(SlicesHandler *hand3D, QWidget *parent = 0, + const char *name = 0, Qt::WindowFlags wFlags = 0); ~ImageForestingTransformRegionGrowingWidget(); - void init(); - void newloaded(); - void cleanup(); - QSize sizeHint() const; - FILE* SaveParams(FILE* fp, int version); - FILE* LoadParams(FILE* fp, int version); - void hideparams_changed(); - std::string GetName() { return std::string("IFT"); }; - virtual QIcon GetIcon(QDir picdir) - { - return QIcon(picdir.absFilePath(QString("iftrg.png")).ascii()); - }; + void init() override; + void newloaded() override; + void cleanup() override; + QSize sizeHint() const override; + FILE *SaveParams(FILE *fp, int version) override; + FILE *LoadParams(FILE *fp, int version) override; + void hideparams_changed() override; + std::string GetName() override { return std::string("IFT"); } + QIcon GetIcon(QDir picdir) override { return QIcon(picdir.absFilePath(QString("iftrg.png"))); } + +protected: + void on_tissuenr_changed(int i) override; + void on_slicenr_changed() override; + + void on_mouse_clicked(Point p) override; + void on_mouse_released(Point p) override; + void on_mouse_moved(Point p) override; private: void init1(); void removemarks(Point p); - float* lbmap; - ImageForestingTransformRegionGrowing* IFTrg; + void getrange(); + + float *lbmap; + ImageForestingTransformRegionGrowing *IFTrg; Point last_pt; - bmphandler* bmphand; - SlicesHandler* handler3D; + bmphandler *bmphand; + SlicesHandler *handler3D; unsigned short activeslice; - Q3HBox* hbox1; - Q3VBox* vbox1; - QLabel* txt_lower; - QLabel* txt_upper; - QSlider* sl_thresh; - QPushButton* pushexec; - QPushButton* pushclear; - QPushButton* pushremove; - void getrange(); + Q3HBox *hbox1; + Q3VBox *vbox1; + QLabel *txt_lower; + QLabel *txt_upper; + QSlider *sl_thresh; + QPushButton *pushexec; + QPushButton *pushclear; + QPushButton *pushremove; unsigned tissuenr; - // unsigned maxim; float thresh; float maxthresh; std::vector vm; std::vector vmempty; std::vector vmdyn; - // std::vector > vvm; unsigned area; signals: - void vm_changed(std::vector* vm1); - void vmdyn_changed(std::vector* vmdyn1); - void begin_datachange(iseg::DataSelection& dataSelection, - QWidget* sender = NULL, bool beginUndo = true); - void end_datachange(QWidget* sender = NULL, - iseg::EndUndoAction undoAction = iseg::EndUndo); - -public slots: - void tissuenr_changed(int i); - void slicenr_changed(); + void vm_changed(std::vector *vm1); + void vmdyn_changed(std::vector *vmdyn1); private slots: - void bmphand_changed(bmphandler* bmph); - // void tissuenr_changed(int i); - void mouse_clicked(Point p); - void mouse_released(Point p); - void mouse_moved(Point p); + void bmphand_changed(bmphandler *bmph); void execute(); void clearmarks(); - // void removepressed(); void slider_changed(int i); void slider_pressed(); void slider_released(); @@ -109,5 +96,3 @@ private slots: }; } // namespace iseg - -#endif diff --git a/iSeg/InterpolationWidget.cpp b/iSeg/InterpolationWidget.cpp index 77674ab8..8ccea63f 100755 --- a/iSeg/InterpolationWidget.cpp +++ b/iSeg/InterpolationWidget.cpp @@ -179,9 +179,9 @@ void InterpolationWidget::init() void InterpolationWidget::newloaded() {} -void InterpolationWidget::slicenr_changed() {} +void InterpolationWidget::on_slicenr_changed() {} -void InterpolationWidget::tissuenr_changed(int tissuetype) +void InterpolationWidget::on_tissuenr_changed(int tissuetype) { tissuenr = (tissues_size_t)tissuetype + 1; } diff --git a/iSeg/InterpolationWidget.h b/iSeg/InterpolationWidget.h index 6496a514..aabb63eb 100755 --- a/iSeg/InterpolationWidget.h +++ b/iSeg/InterpolationWidget.h @@ -7,13 +7,12 @@ * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ -#ifndef Interpolate_20April05 -#define Interpolate_20April05 +#pragma once #include "SlicesHandler.h" #include "bmp_read_1.h" -#include "Plugin/WidgetInterface.h" +#include "Interface/WidgetInterface.h" #include #include @@ -40,61 +39,53 @@ class InterpolationWidget : public WidgetInterface { Q_OBJECT public: - InterpolationWidget(SlicesHandler* hand3D, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0); + InterpolationWidget(SlicesHandler *hand3D, QWidget *parent = 0, + const char *name = 0, Qt::WindowFlags wFlags = 0); ~InterpolationWidget(); - QSize sizeHint() const; - void init(); - void newloaded(); - FILE* SaveParams(FILE* fp, int version); - FILE* LoadParams(FILE* fp, int version); - std::string GetName() { return std::string("Interpol"); }; - virtual QIcon GetIcon(QDir picdir) - { - return QIcon(picdir.absFilePath(QString("interpolate.png")).ascii()); - }; + QSize sizeHint() const override; + void init() override; + void newloaded() override; + FILE *SaveParams(FILE *fp, int version) override; + FILE *LoadParams(FILE *fp, int version) override; + std::string GetName() override { return std::string("Interpol"); } + QIcon GetIcon(QDir picdir) override { return QIcon(picdir.absFilePath(QString("interpolate.png"))); } private: - SlicesHandler* handler3D; - Q3HBox* hboxoverall; - Q3VBox* vboxmethods; - Q3VBox* vboxdataselect; - Q3VBox* vboxparams; - Q3VBox* vboxexecute; - Q3HBox* hboxextra; - Q3HBox* hboxbatch; - QLabel* txt_slicenr; - QSpinBox* sb_slicenr; - QLabel* txt_batchstride; - QSpinBox* sb_batchstride; - QPushButton* pushexec; - QPushButton* pushstart; - QRadioButton* rb_tissue; - QRadioButton* rb_tissueall; - QRadioButton* rb_work; - QButtonGroup* sourcegroup; - QRadioButton* rb_inter; + void on_tissuenr_changed(int i) override; + void on_slicenr_changed() override; + + SlicesHandler *handler3D; + Q3HBox *hboxoverall; + Q3VBox *vboxmethods; + Q3VBox *vboxdataselect; + Q3VBox *vboxparams; + Q3VBox *vboxexecute; + Q3HBox *hboxextra; + Q3HBox *hboxbatch; + QLabel *txt_slicenr; + QSpinBox *sb_slicenr; + QLabel *txt_batchstride; + QSpinBox *sb_batchstride; + QPushButton *pushexec; + QPushButton *pushstart; + QRadioButton *rb_tissue; + QRadioButton *rb_tissueall; + QRadioButton *rb_work; + QButtonGroup *sourcegroup; + QRadioButton *rb_inter; // QRadioButton *rb_intergrey; - QRadioButton* rb_extra; - QRadioButton* rb_batchinter; - QButtonGroup* modegroup; - QRadioButton* rb_4connectivity; - QRadioButton* rb_8connectivity; - QButtonGroup* connectivitygroup; - QCheckBox* cb_medianset; + QRadioButton *rb_extra; + QRadioButton *rb_batchinter; + QButtonGroup *modegroup; + QRadioButton *rb_4connectivity; + QRadioButton *rb_8connectivity; + QButtonGroup *connectivitygroup; + QCheckBox *cb_medianset; unsigned short startnr; unsigned short nrslices; unsigned short tissuenr; -signals: - void begin_datachange(iseg::DataSelection& dataSelection, - QWidget* sender = NULL, bool beginUndo = true); - void end_datachange(QWidget* sender = NULL, - iseg::EndUndoAction undoAction = iseg::EndUndo); - public slots: - void slicenr_changed(); - void tissuenr_changed(int tissuetype); void handler3D_changed(); private slots: @@ -105,5 +96,3 @@ private slots: }; } // namespace iseg - -#endif diff --git a/iSeg/levelset.cpp b/iSeg/Levelset.cpp similarity index 100% rename from iSeg/levelset.cpp rename to iSeg/Levelset.cpp diff --git a/iSeg/levelset.h b/iSeg/Levelset.h similarity index 98% rename from iSeg/levelset.h rename to iSeg/Levelset.h index f7b15e9c..cd2099fb 100755 --- a/iSeg/levelset.h +++ b/iSeg/Levelset.h @@ -9,7 +9,8 @@ */ #pragma once -#include "Core/Point.h" +#include "Interface/Point.h" + #include "Core/SliceProvider.h" #include diff --git a/iSeg/livewirewidget.cpp b/iSeg/LivewireWidget.cpp similarity index 82% rename from iSeg/livewirewidget.cpp rename to iSeg/LivewireWidget.cpp index e3c17d8c..65c2f570 100755 --- a/iSeg/livewirewidget.cpp +++ b/iSeg/LivewireWidget.cpp @@ -16,7 +16,6 @@ #include "Core/ImageForestingTransform.h" #include "Core/Pair.h" -#include "Core/Point.h" #include "Core/addLine.h" #include @@ -39,12 +38,12 @@ using namespace std; using namespace iseg; -livewire_widget::livewire_widget(SlicesHandler* hand3D, QWidget* parent, - const char* name, Qt::WindowFlags wFlags) - : WidgetInterface(parent, name, wFlags), handler3D(hand3D) +LivewireWidget::LivewireWidget(SlicesHandler* hand3D, QWidget* parent, + const char* name, Qt::WindowFlags wFlags) + : WidgetInterface(parent, name, wFlags), handler3D(hand3D) { setToolTip(Format("Use the Auto Trace to follow ideal contour path or draw " - "contours around a tissue to segment it.")); + "contours around a tissue to segment it.")); activeslice = handler3D->get_activeslice(); bmphand = handler3D->get_activebmphandler(); @@ -61,24 +60,24 @@ livewire_widget::livewire_widget(SlicesHandler* hand3D, QWidget* parent, straight = new QRadioButton(QString("Straight"), vboxmethods); autotrace = new QRadioButton(QString("Auto Trace"), vboxmethods); autotrace->setToolTip(Format( - "The Livewire (intelligent scissors) algorithm " - "to automatically identify the ideal contour path.This algorithm uses " - "information " - "about the strength and orientation of the(smoothed) image gradient, " - "the zero - crossing of the Laplacian (for fine tuning) together with " - "some weighting " - "to favor straighter lines to determine the most likely contour path. " - "The " - "contouring is started by clicking the left mouse button. Each " - "subsequent left " - "button click fixes another point and the suggested contour line in " - "between. " - "
" - "Successive removing of unwanted points is achieved by clicking the " - "middle " - "mouse button. A double left click closes the contour while a double " - "middle " - "click aborts the line drawing process.")); + "The Livewire (intelligent scissors) algorithm " + "to automatically identify the ideal contour path.This algorithm uses " + "information " + "about the strength and orientation of the(smoothed) image gradient, " + "the zero - crossing of the Laplacian (for fine tuning) together with " + "some weighting " + "to favor straighter lines to determine the most likely contour path. " + "The " + "contouring is started by clicking the left mouse button. Each " + "subsequent left " + "button click fixes another point and the suggested contour line in " + "between. " + "
" + "Successive removing of unwanted points is achieved by clicking the " + "middle " + "mouse button. A double left click closes the contour while a double " + "middle " + "click aborts the line drawing process.")); freedraw = new QRadioButton(QString("Free"), vboxmethods); drawmode->insert(straight); drawmode->insert(autotrace); @@ -88,8 +87,8 @@ livewire_widget::livewire_widget(SlicesHandler* hand3D, QWidget* parent, hbox2 = new Q3HBox(vbox1); cb_freezing = new QCheckBox("Freezing", hbox2); cb_freezing->setToolTip( - Format("Specify the number of seconds after which a line segment is " - "frozen even without mouse click if it has not changed.")); + Format("Specify the number of seconds after which a line segment is " + "frozen even without mouse click if it has not changed.")); lb_freezing1 = new QLabel("Delay: ", hbox2); sb_freezing = new QSpinBox(1, 10, 1, hbox2); sb_freezing->setValue(3); @@ -115,16 +114,16 @@ livewire_widget::livewire_widget(SlicesHandler* hand3D, QWidget* parent, mode_changed(); QObject::connect(drawmode, SIGNAL(buttonClicked(int)), this, - SLOT(mode_changed())); + SLOT(mode_changed())); QObject::connect(cb_freezing, SIGNAL(clicked()), this, - SLOT(freezing_changed())); + SLOT(freezing_changed())); QObject::connect(sb_freezing, SIGNAL(valueChanged(int)), this, - SLOT(sbfreezing_changed(int))); + SLOT(sbfreezing_changed(int))); return; } -livewire_widget::~livewire_widget() +LivewireWidget::~LivewireWidget() { delete vbox1; delete drawmode; @@ -134,9 +133,9 @@ livewire_widget::~livewire_widget() delete lwfirst; } -QSize livewire_widget::sizeHint() const { return hboxoverall->sizeHint(); } +QSize LivewireWidget::sizeHint() const { return hboxoverall->sizeHint(); } -void livewire_widget::pt_clicked(Point p) +void LivewireWidget::on_mouse_clicked(Point p) { if (!drawing) { @@ -181,7 +180,7 @@ void livewire_widget::pt_clicked(Point p) { lw->return_path(p, &dynamic); established.insert(established.end(), dynamic.begin(), - dynamic.end()); + dynamic.end()); if (cb_closing->isChecked()) lwfirst->return_path(p, &dynamic); else @@ -200,7 +199,7 @@ void livewire_widget::pt_clicked(Point p) } } -void livewire_widget::pt_doubleclicked(Point p) +void LivewireWidget::pt_doubleclicked(Point p) { if (drawing && !freedraw->isOn()) { @@ -214,10 +213,10 @@ void livewire_widget::pt_doubleclicked(Point p) { lw->return_path(p, &dynamic); established.insert(established.end(), dynamic.begin(), - dynamic.end()); + dynamic.end()); lwfirst->return_path(p, &dynamic); established.insert(established.end(), dynamic.begin(), - dynamic.end()); + dynamic.end()); } iseg::DataSelection dataSelection; @@ -245,7 +244,7 @@ void livewire_widget::pt_doubleclicked(Point p) } } -void livewire_widget::pt_midclicked(Point p) +void LivewireWidget::pt_midclicked(Point p) { if (drawing) { @@ -310,7 +309,7 @@ void livewire_widget::pt_midclicked(Point p) } } -void livewire_widget::pt_doubleclickedmid(Point p) +void LivewireWidget::pt_doubleclickedmid(Point p) { UNREFERENCED_PARAMETER(p); if (drawing) @@ -332,7 +331,7 @@ void livewire_widget::pt_doubleclickedmid(Point p) } } -void livewire_widget::pt_released(Point p) +void LivewireWidget::on_mouse_released(Point p) { if (freedraw->isOn() && drawing) { @@ -361,7 +360,7 @@ void livewire_widget::pt_released(Point p) } } -void livewire_widget::pt_moved(Point p) +void LivewireWidget::on_mouse_moved(Point p) { if (drawing) { @@ -397,7 +396,7 @@ void livewire_widget::pt_moved(Point p) times.resize(dynamic.size()); vector::iterator tit = times.begin(); while (rit != dynamic.rend() && ritold != dynamicold.rend() && - (*rit).px == (*ritold).px && (*rit).py == (*ritold).py) + (*rit).px == (*ritold).px && (*rit).py == (*ritold).py) { rit++; ritold++; @@ -413,7 +412,7 @@ void livewire_widget::pt_moved(Point p) dynamicold.clear(); dynamicold.insert(dynamicold.begin(), dynamic.begin(), - dynamic.end()); + dynamic.end()); /*FILE *fp3=fopen("D:\\Development\\segmentation\\sample images\\test100.txt","w"); for(tit=times.begin();tit!=times.end();tit++) @@ -435,20 +434,20 @@ void livewire_widget::pt_moved(Point p) lw->change_pt(*rit); rit++; established.insert(established.end(), dynamic.rbegin(), - rit); + rit); times.erase(times.begin(), tit); // dynamic.erase(dynamic.rbegin(),rit); if (cb_closing->isChecked()) dynamic.insert(dynamic.end(), dynamic1.begin(), - dynamic1.end()); + dynamic1.end()); emit vp1dyn_changed(&established, &dynamic); } else { if (cb_closing->isChecked()) dynamic.insert(dynamic.end(), dynamic1.begin(), - dynamic1.end()); + dynamic1.end()); emit vpdyn_changed(&dynamic); } } @@ -456,14 +455,14 @@ void livewire_widget::pt_moved(Point p) { if (cb_closing->isChecked()) dynamic.insert(dynamic.end(), dynamic1.begin(), - dynamic1.end()); + dynamic1.end()); emit vpdyn_changed(&dynamic); } } } } -void livewire_widget::init() +void LivewireWidget::init() { if (activeslice != handler3D->get_activeslice()) { @@ -502,7 +501,7 @@ void livewire_widget::init() return; } -void livewire_widget::newloaded() +void LivewireWidget::newloaded() { activeslice = handler3D->get_activeslice(); bmphand = handler3D->get_activebmphandler(); @@ -530,7 +529,7 @@ void livewire_widget::newloaded() } } -void livewire_widget::init1() +void LivewireWidget::init1() { Point p; p.px = p.py = 0; @@ -542,7 +541,7 @@ void livewire_widget::init1() // isactive=true; } -void livewire_widget::cleanup() +void LivewireWidget::cleanup() { dynamic.clear(); established.clear(); @@ -565,28 +564,20 @@ void livewire_widget::cleanup() // isactive=false; } -void livewire_widget::bmp_changed() +void LivewireWidget::bmp_changed() { cleanup(); bmphand = handler3D->get_activebmphandler(); init1(); } -/*void livewire_widget::mode_changed() +void LivewireWidget::on_slicenr_changed() { - if(autotrace->isOn()){ - } -}*/ - -void livewire_widget::slicenr_changed() -{ - // if(activeslice!=handler3D->get_activeslice()){ activeslice = handler3D->get_activeslice(); bmphand_changed(handler3D->get_activebmphandler()); - // } } -void livewire_widget::bmphand_changed(bmphandler* bmph) +void LivewireWidget::bmphand_changed(bmphandler* bmph) { bmphand = bmph; @@ -617,7 +608,7 @@ void livewire_widget::bmphand_changed(bmphandler* bmph) emit vp1dyn_changed(&established, &dynamic); } -void livewire_widget::mode_changed() +void LivewireWidget::mode_changed() { if (autotrace->isOn()) { @@ -638,7 +629,7 @@ void livewire_widget::mode_changed() } } -void livewire_widget::freezing_changed() +void LivewireWidget::freezing_changed() { if (cb_freezing->isChecked()) { @@ -656,13 +647,13 @@ void livewire_widget::freezing_changed() } } -void livewire_widget::sbfreezing_changed(int i) +void LivewireWidget::sbfreezing_changed(int i) { tlimit1 = i * 1000; tlimit2 = (float(i) + 0.5f) * 1000; } -FILE* livewire_widget::SaveParams(FILE* fp, int version) +FILE* LivewireWidget::SaveParams(FILE* fp, int version) { if (version >= 2) { @@ -684,16 +675,16 @@ FILE* livewire_widget::SaveParams(FILE* fp, int version) return fp; } -FILE* livewire_widget::LoadParams(FILE* fp, int version) +FILE* LivewireWidget::LoadParams(FILE* fp, int version) { if (version >= 2) { QObject::disconnect(drawmode, SIGNAL(buttonClicked(int)), this, - SLOT(mode_changed())); + SLOT(mode_changed())); QObject::disconnect(cb_freezing, SIGNAL(clicked()), this, - SLOT(freezing_changed())); + SLOT(freezing_changed())); QObject::disconnect(sb_freezing, SIGNAL(valueChanged(int)), this, - SLOT(sbfreezing_changed(int))); + SLOT(sbfreezing_changed(int))); int dummy; fread(&dummy, sizeof(int), 1, fp); @@ -714,16 +705,16 @@ FILE* livewire_widget::LoadParams(FILE* fp, int version) mode_changed(); QObject::connect(drawmode, SIGNAL(buttonClicked(int)), this, - SLOT(mode_changed())); + SLOT(mode_changed())); QObject::connect(cb_freezing, SIGNAL(clicked()), this, - SLOT(freezing_changed())); + SLOT(freezing_changed())); QObject::connect(sb_freezing, SIGNAL(valueChanged(int)), this, - SLOT(sbfreezing_changed(int))); + SLOT(sbfreezing_changed(int))); } return fp; } -void livewire_widget::hideparams_changed() +void LivewireWidget::hideparams_changed() { mode_changed(); if (hideparams && !cb_freezing->isChecked()) diff --git a/iSeg/livewirewidget.h b/iSeg/LivewireWidget.h similarity index 70% rename from iSeg/livewirewidget.h rename to iSeg/LivewireWidget.h index 7a257b11..e14b92fe 100755 --- a/iSeg/livewirewidget.h +++ b/iSeg/LivewireWidget.h @@ -13,9 +13,8 @@ #include "SlicesHandler.h" #include "bmp_read_1.h" -#include "Plugin/WidgetInterface.h" +#include "Interface/WidgetInterface.h" -#include "Core/DataSelection.h" #include "Core/ImageForestingTransform.h" #include @@ -42,30 +41,35 @@ namespace iseg { -class livewire_widget : public WidgetInterface +class LivewireWidget : public WidgetInterface { Q_OBJECT public: - livewire_widget(SlicesHandler* hand3D, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0); - ~livewire_widget(); - void init(); - void newloaded(); - void cleanup(); - FILE* SaveParams(FILE* fp, int version); - FILE* LoadParams(FILE* fp, int version); - void hideparams_changed(); - QSize sizeHint() const; - ImageForestingTransformLivewire* lw; - ImageForestingTransformLivewire* lwfirst; - std::string GetName() { return std::string("Contour"); }; - virtual QIcon GetIcon(QDir picdir) - { - return QIcon(picdir.absFilePath(QString("contour.png")).ascii()); - }; + LivewireWidget(SlicesHandler* hand3D, QWidget* parent = 0, + const char* name = 0, Qt::WindowFlags wFlags = 0); + ~LivewireWidget(); + void init() override; + void newloaded() override; + void cleanup() override; + FILE* SaveParams(FILE* fp, int version) override; + FILE* LoadParams(FILE* fp, int version) override; + void hideparams_changed() override; + QSize sizeHint() const override; + std::string GetName() override { return std::string("Contour"); } + QIcon GetIcon(QDir picdir) override { return QIcon(picdir.absFilePath(QString("contour.png"))); } private: + void on_slicenr_changed() override; + + void on_mouse_clicked(Point p) override; + void on_mouse_moved(Point p) override; + void on_mouse_released(Point p) override; + void init1(); + + ImageForestingTransformLivewire* lw; + ImageForestingTransformLivewire* lwfirst; + // bool isactive; bool drawing; std::vector clicks; @@ -103,23 +107,13 @@ class livewire_widget : public WidgetInterface void vp1_changed(std::vector* vp1); void vpdyn_changed(std::vector* vpdyn); void vp1dyn_changed(std::vector* vp1, std::vector* vpdyn); - void begin_datachange(iseg::DataSelection& dataSelection, - QWidget* sender = NULL, bool beginUndo = true); - void end_datachange(QWidget* sender = NULL, - iseg::EndUndoAction undoAction = iseg::EndUndo); - -public slots: - void slicenr_changed(); private slots: void bmphand_changed(bmphandler* bmph); // void bmphand_changed(bmphandler *bmph); - void pt_clicked(Point p); void pt_doubleclicked(Point p); void pt_midclicked(Point p); void pt_doubleclickedmid(Point p); - void pt_moved(Point p); - void pt_released(Point p); void bmp_changed(); void mode_changed(); void freezing_changed(); diff --git a/iSeg/loaderwidgets.cpp b/iSeg/LoaderWidgets.cpp similarity index 99% rename from iSeg/loaderwidgets.cpp rename to iSeg/LoaderWidgets.cpp index 68824601..e24f13d1 100755 --- a/iSeg/loaderwidgets.cpp +++ b/iSeg/LoaderWidgets.cpp @@ -13,7 +13,7 @@ #include "CImg.h" #include "LoaderWidgets.h" -#include "Core/Point.h" +#include "Interface/Point.h" #include #include diff --git a/iSeg/loaderwidgets.h b/iSeg/LoaderWidgets.h similarity index 99% rename from iSeg/loaderwidgets.h rename to iSeg/LoaderWidgets.h index 3922593a..ec5b0df3 100755 --- a/iSeg/loaderwidgets.h +++ b/iSeg/LoaderWidgets.h @@ -10,9 +10,11 @@ #ifndef LOADERWIDGET #define LOADERWIDGET -#include "Core/Point.h" #include "SlicesHandler.h" #include "bmp_read_1.h" + +#include "Interface/Point.h" + #include #include #include diff --git a/iSeg/MainWindow.cpp b/iSeg/MainWindow.cpp index 02d14635..e827502e 100755 --- a/iSeg/MainWindow.cpp +++ b/iSeg/MainWindow.cpp @@ -1,9 +1,9 @@ /* * Copyright (c) 2018 The Foundation for Research on Information Technologies in Society (IT'IS). - * + * * This file is part of iSEG * (see https://github.com/ITISFoundation/osparc-iseg). - * + * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ @@ -45,7 +45,7 @@ # include "RadiotherapyStructureSetImporter.h" #endif -#include "Plugin/Plugin.h" +#include "Interface/Plugin.h" #include "Core/LoadPlugin.h" #include "Core/ProjectVersion.h" @@ -173,7 +173,7 @@ QString TruncateFileName(QString str) } bool read_grouptissues(const char* filename, vector& olds, - vector& news) + vector& news) { FILE* fp; if ((fp = fopen(filename, "r")) == NULL) @@ -195,8 +195,8 @@ bool read_grouptissues(const char* filename, vector& olds, } bool read_grouptissuescapped(const char* filename, vector& olds, - vector& news, - bool fail_on_unknown_tissue) + vector& news, + bool fail_on_unknown_tissue) { FILE* fp; if ((fp = fopen(filename, "r")) == NULL) @@ -223,7 +223,7 @@ bool read_grouptissuescapped(const char* filename, vector& olds, // Read input as tissue indices type2 = (tissues_size_t)QString(name2).toUInt(&readIndices); if (type1 > 0 && type1 <= tissueCount && type2 > 0 && - type2 <= tissueCount) + type2 <= tissueCount) { olds.push_back(type1); news.push_back(type2); @@ -237,7 +237,7 @@ bool read_grouptissuescapped(const char* filename, vector& olds, type1 = (tissues_size_t)tmp1; type2 = (tissues_size_t)tmp2; if (type1 > 0 && type1 <= tissueCount && type2 > 0 && - type2 <= tissueCount) + type2 <= tissueCount) { olds.push_back(type1); news.push_back(type2); @@ -252,7 +252,7 @@ bool read_grouptissuescapped(const char* filename, vector& olds, type1 = TissueInfos::GetTissueType(QString(name1)); type2 = TissueInfos::GetTissueType(QString(name2)); if (type1 > 0 && type1 <= tissueCount && type2 > 0 && - type2 <= tissueCount) + type2 <= tissueCount) { olds.push_back(type1); news.push_back(type2); @@ -273,7 +273,7 @@ bool read_grouptissuescapped(const char* filename, vector& olds, type1 = TissueInfos::GetTissueType(QString(name1)); type2 = TissueInfos::GetTissueType(QString(name2)); if (type1 > 0 && type1 <= tissueCount && type2 > 0 && - type2 <= tissueCount) + type2 <= tissueCount) { olds.push_back(type1); news.push_back(type2); @@ -282,11 +282,9 @@ bool read_grouptissuescapped(const char* filename, vector& olds, { ok = false; if (type1 == 0 || type1 > tissueCount) - std::cerr << "old: " << name1 - << " not in tissue list\n"; + std::cerr << "old: " << name1 << " not in tissue list\n"; if (type2 == 0 || type2 > tissueCount) - std::cerr << "new: " << name2 - << " not in tissue list\n"; + std::cerr << "new: " << name2 << " not in tissue list\n"; } memset(name1, 0, 1000); @@ -360,11 +358,11 @@ bool MenuWTT::event(QEvent* e) return QMenu::event(e); } -MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, - QDir picpath, QDir tmppath, bool editingmode, - QWidget* parent, const char* name, - Qt::WindowFlags wFlags, char** argv) - : QMainWindow(parent, name, wFlags) +MainWindow::MainWindow(SlicesHandler* hand3D, const QString& locationstring, + const QDir& picpath, const QDir& tmppath, bool editingmode, + QWidget* parent, const char* name, + Qt::WindowFlags wFlags, char** argv) + : QMainWindow(parent, name, wFlags) { setObjectName("MainWindow"); @@ -375,7 +373,8 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, m_editingmode = editingmode; tab_old = nullptr; - setCaption(QString(" iSeg ") + QString(xstr(ISEG_VERSION)) + QString(" - No Filename")); + setCaption(QString(" iSeg ") + QString(xstr(ISEG_VERSION)) + + QString(" - No Filename")); QIcon isegicon(m_picpath.absFilePath(QString("isegicon.png")).ascii()); setWindowIcon(isegicon); m_locationstring = locationstring; @@ -403,7 +402,7 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, cb_workpicturevisible->setChecked(true); bmp_show = new bmptissuemarklineshower( - this, "new window", Qt::WDestructiveClose | Qt::WResizeNoErase); + this, "new window", Qt::WDestructiveClose | Qt::WResizeNoErase); lb_source = new QLabel("Source", this); lb_target = new QLabel("Target", this); bmp_scroller = new Q3ScrollView(this); @@ -413,8 +412,8 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, sl_brightnessbmp->setRange(0, 100); lb_contrastbmp = new QLabel("C:", this); lb_contrastbmp->setPixmap( - QIcon(m_picpath.absFilePath(QString("icon-contrast.png")).ascii()) - .pixmap()); + QIcon(m_picpath.absFilePath(QString("icon-contrast.png")).ascii()) + .pixmap()); le_contrastbmp_val = new QLineEdit(this); le_contrastbmp_val->setAlignment(Qt::AlignRight); le_contrastbmp_val->setText(QString("%1").arg(9999.99, 6, 'f', 2)); @@ -425,8 +424,8 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, lb_contrastbmp_val = new QLabel("x", this); lb_brightnessbmp = new QLabel("B:", this); lb_brightnessbmp->setPixmap( - QIcon(m_picpath.absFilePath(QString("icon-brightness.png")).ascii()) - .pixmap()); + QIcon(m_picpath.absFilePath(QString("icon-brightness.png")).ascii()) + .pixmap()); le_brightnessbmp_val = new QLineEdit(this); le_brightnessbmp_val->setAlignment(Qt::AlignRight); le_brightnessbmp_val->setText(QString("%1").arg(9999, 3)); @@ -443,29 +442,28 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, bmp_show->update(); toworkBtn = new QPushButton( - QIcon(m_picpath.absFilePath(QString("next.png")).ascii()), "", this); + QIcon(m_picpath.absFilePath(QString("next.png")).ascii()), "", this); toworkBtn->setFixedWidth(50); tobmpBtn = new QPushButton( - QIcon(m_picpath.absFilePath(QString("previous.png")).ascii()), "", - this); + QIcon(m_picpath.absFilePath(QString("previous.png")).ascii()), "", this); tobmpBtn->setFixedWidth(50); swapBtn = new QPushButton( - QIcon(m_picpath.absFilePath(QString("swap.png")).ascii()), "", this); + QIcon(m_picpath.absFilePath(QString("swap.png")).ascii()), "", this); swapBtn->setFixedWidth(50); swapAllBtn = new QPushButton( - QIcon(m_picpath.absFilePath(QString("swap.png")).ascii()), "3D", this); + QIcon(m_picpath.absFilePath(QString("swap.png")).ascii()), "3D", this); swapAllBtn->setFixedWidth(50); work_show = new bmptissuemarklineshower( - this, "new window", Qt::WDestructiveClose | Qt::WResizeNoErase); + this, "new window", Qt::WDestructiveClose | Qt::WResizeNoErase); sl_contrastwork = new QSlider(Qt::Horizontal, this); sl_contrastwork->setRange(0, 100); sl_brightnesswork = new QSlider(Qt::Horizontal, this); sl_brightnesswork->setRange(0, 100); lb_contrastwork = new QLabel(this); lb_contrastwork->setPixmap( - QIcon(m_picpath.absFilePath(QString("icon-contrast.png")).ascii()) - .pixmap()); + QIcon(m_picpath.absFilePath(QString("icon-contrast.png")).ascii()) + .pixmap()); le_contrastwork_val = new QLineEdit(this); le_contrastwork_val->setAlignment(Qt::AlignRight); le_contrastwork_val->setText(QString("%1").arg(9999.99, 6, 'f', 2)); @@ -476,8 +474,8 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, lb_contrastwork_val = new QLabel("x", this); lb_brightnesswork = new QLabel(this); lb_brightnesswork->setPixmap( - QIcon(m_picpath.absFilePath(QString("icon-brightness.png")).ascii()) - .pixmap()); + QIcon(m_picpath.absFilePath(QString("icon-brightness.png")).ascii()) + .pixmap()); le_brightnesswork_val = new QLineEdit(this); le_brightnesswork_val->setAlignment(Qt::AlignRight); le_brightnesswork_val->setText(QString("%1").arg(9999, 3)); @@ -495,10 +493,10 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, reset_brightnesscontrast(); - zoom_widget = new zoomer_widget(1.0, m_picpath, this); + zoom_widget = new ZoomWidget(1.0, m_picpath, this); tissueTreeWidget = - new TissueTreeWidget(handler3D->get_tissue_hierachy(), m_picpath, this); + new TissueTreeWidget(handler3D->get_tissue_hierachy(), m_picpath, this); tissueTreeWidget->setContextMenuPolicy(Qt::CustomContextMenu); tissueFilter = new QLineEdit(this); tissueFilter->setMargin(1); @@ -506,7 +504,7 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, tissueTreeWidget->update_tree_widget(); // Reload hierarchy cb_tissuelock = new QCheckBox(this); cb_tissuelock->setPixmap( - QIcon(m_picpath.absFilePath(QString("lock.png")).ascii()).pixmap()); + QIcon(m_picpath.absFilePath(QString("lock.png")).ascii()).pixmap()); cb_tissuelock->setChecked(false); lockTissues = new QPushButton("All", this); lockTissues->setToggleButton(true); @@ -516,69 +514,68 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, //xxxb addTissue->setFixedWidth(110); modifyTissueFolder = new QPushButton("Mod. Tissue/Folder", this); modifyTissueFolder->setToolTip( - Format("Edit the selected tissue or folder properties.")); + Format("Edit the selected tissue or folder properties.")); //xxxb modifyTissue->setFixedWidth(110); removeTissueFolder = new QPushButton("Del. Tissue/Folder", this); removeTissueFolder->setToolTip( - Format("Remove the selected tissues or folders.")); + Format("Remove the selected tissues or folders.")); removeTissueFolderAll = new QPushButton("All", this); removeTissueFolderAll->setFixedWidth(30); //xxxb removeTissue->setFixedWidth(110); tissue3Dopt = new QCheckBox("3D", this); tissue3Dopt->setChecked(false); tissue3Dopt->setToolTip( - Format("'Get Tissue' is applied in 3D or current slice only.")); + Format("'Get Tissue' is applied in 3D or current slice only.")); getTissue = new QPushButton("Get Tissue", this); getTissue->setToolTip(Format("Get tissue creates a mask in the Target from " - "the currently selected Tissue.")); + "the currently selected Tissue.")); getTissueAll = new QPushButton("All", this); getTissueAll->setFixedWidth(30); - getTissueAll->setToolTip( - Format("Get all tissue creates a mask in the Target " - "from all Tissue excluding the background.")); + getTissueAll->setToolTip(Format("Get all tissue creates a mask in the Target " + "from all Tissue excluding the background.")); //xxxb getTissue->setFixedWidth(110); clearTissue = new QPushButton("Clear Tissue", this); clearTissue->setToolTip( - Format("Clears the currently selected tissue (use '3D' option to clear " - "whole tissue or just the current slice).")); + Format("Clears the currently selected tissue (use '3D' option to clear " + "whole tissue or just the current slice).")); //xxxb clearTissue->setFixedWidth(110); clearTissues = new QPushButton("All", this); clearTissues->setFixedWidth(30); clearTissues->setToolTip( - Format("Clears all tissues (use '3D' option to clear the entire " - "segmentation or just the current slice).")); + Format("Clears all tissues (use '3D' option to clear the entire " + "segmentation or just the current slice).")); //xxxb clearTissues->setFixedWidth(110); cb_addsub3d = new QCheckBox("3D", this); cb_addsub3d->setToolTip( - Format("Apply add/remove actions in 3D or current slice only.")); + Format("Apply add/remove actions in 3D or current slice only.")); cb_addsuboverride = new QCheckBox("Override", this); cb_addsuboverride->setToolTip( - Format("If override is off, Tissue voxels which are already assigned " - "will not be modified. Override allows to change these voxels, " - "unless they are locked.")); + Format("If override is off, Tissue voxels which are already assigned " + "will not be modified. Override allows to change these voxels, " + "unless they are locked.")); cb_addsubconn = new QCheckBox("Connected", this); cb_addsubconn->setToolTip( - Format("Only the connected image region is added/removed.")); + Format("Only the connected image region is added/removed.")); // vboxtissueadder2->addStretch(); pb_add = new QPushButton("+", this); pb_add->setToggleButton(true); pb_add->setToolTip(Format( - "Adds next selected/picked Target image region to current tissue.")); + "Adds next selected/picked Target image region to current tissue.")); pb_sub = new QPushButton("-", this); pb_sub->setToggleButton(true); pb_sub->setToolTip(Format("Removes next selected/picked Target image " - "region from current tissue.")); + "region from current tissue.")); pb_addhold = new QPushButton("++", this); pb_addhold->setToggleButton(true); pb_addhold->setToolTip( - Format("Adds selected/picked Target image regions to current tissue.")); + Format("Adds selected/picked Target image regions to current tissue.")); // pb_stophold=new QPushButton(".",this); // vboxtissueadder2->addWidget(pb_stophold); pb_subhold = new QPushButton("--", this); pb_subhold->setToggleButton(true); pb_subhold->setToolTip(Format( - "Removes selected/picked Target image regions from current tissue.")); + "Removes selected/picked Target image regions from current tissue.")); /* pb_add3D=new QPushButton("+3D",this); vboxtissueadder1->addWidget(pb_add3D); pb_addconn=new QPushButton("+Conn",this); @@ -596,15 +593,15 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, unsigned short slicenr = handler3D->get_activeslice() + 1; pb_first = new QPushButton("|<<", this); scb_slicenr = new QScrollBar(1, (int)handler3D->return_nrslices(), 1, 5, 1, - Qt::Horizontal, this); + Qt::Horizontal, this); scb_slicenr->setFixedWidth(500); scb_slicenr->setValue(int(slicenr)); pb_last = new QPushButton(">>|", this); sb_slicenr = new QSpinBox(1, (int)handler3D->return_nrslices(), 1, this); sb_slicenr->setValue(slicenr); lb_slicenr = new QLabel( - QString(" of ") + QString::number((int)handler3D->return_nrslices()), - this); + QString(" of ") + QString::number((int)handler3D->return_nrslices()), + this); // lb_inactivewarning=new QLabel(QSimpleRichText(QString(" 3D Inactive Slice!"),this->font()),this); lb_inactivewarning = new QLabel(" 3D Inactive Slice! ", this); lb_inactivewarning->setPaletteForegroundColor(QColor(255, 0, 0)); @@ -612,68 +609,69 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, lb_slicethick = new QLabel("Slice Thickness (mm): ", this); le_slicethick = - new QLineEdit(QString::number(handler3D->get_slicethickness()), this); + new QLineEdit(QString::number(handler3D->get_slicethickness()), this); le_slicethick->setFixedWidth(80); threshold_widget = - new ThresholdWidget(handler3D, this, "new window", - Qt::WDestructiveClose | Qt::WResizeNoErase); + new ThresholdWidget(handler3D, this, "new window", + Qt::WDestructiveClose | Qt::WResizeNoErase); tabwidgets.push_back(threshold_widget); - hyst_widget = new HystereticGrowingWidget(handler3D, this, "new window", - Qt::WDestructiveClose | Qt::WResizeNoErase); + hyst_widget = + new HystereticGrowingWidget(handler3D, this, "new window", + Qt::WDestructiveClose | Qt::WResizeNoErase); tabwidgets.push_back(hyst_widget); - lw_widget = new livewire_widget(handler3D, this, "new window", - Qt::WDestructiveClose | Qt::WResizeNoErase); + lw_widget = new LivewireWidget(handler3D, this, "new window", + Qt::WDestructiveClose | Qt::WResizeNoErase); tabwidgets.push_back(lw_widget); - iftrg_widget = new ImageForestingTransformRegionGrowingWidget(handler3D, this, "new window", - Qt::WDestructiveClose | Qt::WResizeNoErase); + iftrg_widget = new ImageForestingTransformRegionGrowingWidget( + handler3D, this, "new window", + Qt::WDestructiveClose | Qt::WResizeNoErase); tabwidgets.push_back(iftrg_widget); FMF_widget = - new FastmarchingFuzzyWidget(handler3D, this, "new window", - Qt::WDestructiveClose | Qt::WResizeNoErase); + new FastmarchingFuzzyWidget(handler3D, this, "new window", + Qt::WDestructiveClose | Qt::WResizeNoErase); tabwidgets.push_back(FMF_widget); wshed_widget = - new WatershedWidget(handler3D, this, "new window", - Qt::WDestructiveClose | Qt::WResizeNoErase); + new WatershedWidget(handler3D, this, "new window", + Qt::WDestructiveClose | Qt::WResizeNoErase); tabwidgets.push_back(wshed_widget); OutlineCorrect_widget = - new OutlineCorrectionWidget(handler3D, this, "new window", - Qt::WDestructiveClose | Qt::WResizeNoErase); + new OutlineCorrectionWidget(handler3D, this, "new window", + Qt::WDestructiveClose | Qt::WResizeNoErase); tabwidgets.push_back(OutlineCorrect_widget); interpolwidget = - new InterpolationWidget(handler3D, this, "new window", - Qt::WDestructiveClose | Qt::WResizeNoErase); + new InterpolationWidget(handler3D, this, "new window", + Qt::WDestructiveClose | Qt::WResizeNoErase); tabwidgets.push_back(interpolwidget); smoothing_widget = - new SmoothingWidget(handler3D, this, "new window", - Qt::WDestructiveClose | Qt::WResizeNoErase); + new SmoothingWidget(handler3D, this, "new window", + Qt::WDestructiveClose | Qt::WResizeNoErase); tabwidgets.push_back(smoothing_widget); morph_widget = - new MorphologyWidget(handler3D, this, "new window", - Qt::WDestructiveClose | Qt::WResizeNoErase); + new MorphologyWidget(handler3D, this, "new window", + Qt::WDestructiveClose | Qt::WResizeNoErase); tabwidgets.push_back(morph_widget); edge_widg = new EdgeWidget(handler3D, this, "new window", - Qt::WDestructiveClose | Qt::WResizeNoErase); + Qt::WDestructiveClose | Qt::WResizeNoErase); tabwidgets.push_back(edge_widg); feature_widget = - new FeatureWidget(handler3D, this, "new window", - Qt::WDestructiveClose | Qt::WResizeNoErase); + new FeatureWidget(handler3D, this, "new window", + Qt::WDestructiveClose | Qt::WResizeNoErase); tabwidgets.push_back(feature_widget); measurement_widget = - new MeasurementWidget(handler3D, this, "new window", - Qt::WDestructiveClose | Qt::WResizeNoErase); + new MeasurementWidget(handler3D, this, "new window", + Qt::WDestructiveClose | Qt::WResizeNoErase); tabwidgets.push_back(measurement_widget); vesselextr_widget = - new VesselWidget(handler3D, this, "new window", - Qt::WDestructiveClose | Qt::WResizeNoErase); + new VesselWidget(handler3D, this, "new window", + Qt::WDestructiveClose | Qt::WResizeNoErase); tabwidgets.push_back(vesselextr_widget); - pickerwidget = - new PickerWidget(handler3D, this, "new window", - Qt::WDestructiveClose | Qt::WResizeNoErase); + pickerwidget = new PickerWidget(handler3D, this, "new window", + Qt::WDestructiveClose | Qt::WResizeNoErase); tabwidgets.push_back(pickerwidget); transfrmWidget = - new TransformWidget(handler3D, this, "new window", - Qt::WDestructiveClose | Qt::WResizeNoErase); + new TransformWidget(handler3D, this, "new window", + Qt::WDestructiveClose | Qt::WResizeNoErase); tabwidgets.push_back(transfrmWidget); boost::filesystem::path this_exe(argv[0]); @@ -686,7 +684,7 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, { a->install_slice_handler(handler3D); tabwidgets.push_back(a->create_widget( - this, "new window", Qt::WDestructiveClose | Qt::WResizeNoErase)); + this, "new window", Qt::WDestructiveClose | Qt::WResizeNoErase)); } nrtabbuttons = (unsigned short)tabwidgets.size(); @@ -731,8 +729,8 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, int height_max = 0; QSize qs; //,qsmax; - // qsmax.setHeight(0); - // qsmax.setWidth(0); + // qsmax.setHeight(0); + // qsmax.setWidth(0); for (size_t i = 0; i < tabwidgets.size(); i++) { qs = tabwidgets[i]->sizeHint(); @@ -754,22 +752,21 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, } scalewidget = new ScaleWork(handler3D, m_picpath, this, "new window", - Qt::WDestructiveClose | Qt::WResizeNoErase); + Qt::WDestructiveClose | Qt::WResizeNoErase); imagemathwidget = new ImageMath(handler3D, this, "new window", - Qt::WDestructiveClose | Qt::WResizeNoErase); + Qt::WDestructiveClose | Qt::WResizeNoErase); imageoverlaywidget = - new ImageOverlay(handler3D, this, "new window", - Qt::WDestructiveClose | Qt::WResizeNoErase); + new ImageOverlay(handler3D, this, "new window", + Qt::WDestructiveClose | Qt::WResizeNoErase); - bitstack_widget = - new bits_stack(handler3D, this, "new window", - Qt::WDestructiveClose | Qt::WResizeNoErase); + bitstack_widget = new bits_stack(handler3D, this, "new window", + Qt::WDestructiveClose | Qt::WResizeNoErase); overlay_widget = - new extoverlay_widget(handler3D, this, "new window", - Qt::WDestructiveClose | Qt::WResizeNoErase); + new extoverlay_widget(handler3D, this, "new window", + Qt::WDestructiveClose | Qt::WResizeNoErase); m_MultiDataset_widget = - new MultiDataset_widget(handler3D, this, "multi dataset window", - Qt::WDestructiveClose | Qt::WResizeNoErase); + new MultiDataset_widget(handler3D, this, "multi dataset window", + Qt::WDestructiveClose | Qt::WResizeNoErase); int height_max1 = height_max; // methodTab->setFixedHeight(height_max1); // bitstack_widget->setFixedHeight(height_max1); @@ -785,7 +782,7 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, VV3Dbmp = NULL; if (handler3D->return_startslice() >= slicenr || - handler3D->return_endslice() + 1 <= slicenr) + handler3D->return_endslice() + 1 <= slicenr) { lb_inactivewarning->setText(QString(" 3D Inactive Slice! ")); lb_inactivewarning->setPaletteBackgroundColor(QColor(0, 255, 0)); @@ -794,7 +791,7 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, { lb_inactivewarning->setText(QString(" ")); lb_inactivewarning->setPaletteBackgroundColor( - this->paletteBackgroundColor()); + this->paletteBackgroundColor()); } QWidget* hbox2w = new QWidget; @@ -930,7 +927,7 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, hboxslicew->setLayout(hboxslice); auto add_widget_filter = [this](QVBoxLayout* vbox, QPushButton* pb, - unsigned short i) { + unsigned short i) { #ifdef PLUGIN_VESSEL_WIDGET vbox->addWidget(pb); #else @@ -979,8 +976,7 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, QDockWidget* tabswdock = new QDockWidget(tr("Methods"), this); style_dockwidget(tabswdock); tabswdock->setObjectName("Methods"); - tabswdock->setAllowedAreas(Qt::TopDockWidgetArea | - Qt::BottomDockWidgetArea); + tabswdock->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea); tabswdock->setWidget(hboxtabsw); addDockWidget(Qt::BottomDockWidgetArea, tabswdock); @@ -988,7 +984,7 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, style_dockwidget(methodTabdock); methodTabdock->setObjectName("Parameters"); methodTabdock->setAllowedAreas(Qt::TopDockWidgetArea | - Qt::BottomDockWidgetArea); + Qt::BottomDockWidgetArea); // Q3ScrollView *tab_scroller=new Q3ScrollView(this);xxxa // tab_scroller->addChild(methodTab); // methodTabdock->setWidget(tab_scroller); @@ -1002,8 +998,7 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, QDockWidget* notesdock = new QDockWidget(tr("Notes"), this); style_dockwidget(notesdock); notesdock->setObjectName("Notes"); - notesdock->setAllowedAreas(Qt::TopDockWidgetArea | - Qt::BottomDockWidgetArea); + notesdock->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea); notesdock->setWidget(m_notes); addDockWidget(Qt::BottomDockWidgetArea, notesdock); @@ -1011,7 +1006,7 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, style_dockwidget(bitstackdock); bitstackdock->setObjectName("Clipboard"); bitstackdock->setAllowedAreas(Qt::TopDockWidgetArea | - Qt::BottomDockWidgetArea); + Qt::BottomDockWidgetArea); bitstackdock->setWidget(bitstack_widget); addDockWidget(Qt::BottomDockWidgetArea, bitstackdock); @@ -1019,7 +1014,7 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, style_dockwidget(multiDatasetDock); multiDatasetDock->setObjectName("Multi Dataset"); multiDatasetDock->setAllowedAreas(Qt::TopDockWidgetArea | - Qt::BottomDockWidgetArea); + Qt::BottomDockWidgetArea); multiDatasetDock->setWidget(m_MultiDataset_widget); addDockWidget(Qt::BottomDockWidgetArea, multiDatasetDock); @@ -1027,7 +1022,7 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, style_dockwidget(overlaydock); overlaydock->setObjectName("Overlay"); overlaydock->setAllowedAreas(Qt::TopDockWidgetArea | - Qt::BottomDockWidgetArea); + Qt::BottomDockWidgetArea); overlaydock->setWidget(overlay_widget); addDockWidget(Qt::BottomDockWidgetArea, overlaydock); @@ -1112,32 +1107,31 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, style_dockwidget(tissuewdock); tissuewdock->setObjectName("Tissues"); tissuewdock->setAllowedAreas(Qt::LeftDockWidgetArea | - Qt::RightDockWidgetArea); + Qt::RightDockWidgetArea); tissuewdock->setWidget(vboxtissuew); addDockWidget(Qt::RightDockWidgetArea, tissuewdock); QDockWidget* tissuehierarchydock = - new QDockWidget(tr("Tissue Hierarchy"), this); + new QDockWidget(tr("Tissue Hierarchy"), this); style_dockwidget(tissuehierarchydock); tissuehierarchydock->setToolTip( - Format("The tissue hierarchy allows to group and organize complex " - "segmentations into a hierarchy.")); + Format("The tissue hierarchy allows to group and organize complex " + "segmentations into a hierarchy.")); tissuehierarchydock->setObjectName("Tissue Hierarchy"); tissuehierarchydock->setAllowedAreas(Qt::LeftDockWidgetArea | - Qt::RightDockWidgetArea); + Qt::RightDockWidgetArea); tissuehierarchydock->setWidget(tissueHierarchyWidget); addDockWidget(Qt::RightDockWidgetArea, tissuehierarchydock); QDockWidget* tissueadddock = new QDockWidget(tr("Adder"), this); style_dockwidget(tissueadddock); - tissueadddock->setToolTip( - Format("The tissue adder provides functionality " - "to add/remove an object selected/picked in " - "the Target to/from the selected tissue." - "Note: Only one tissue can be selected.")); + tissueadddock->setToolTip(Format("The tissue adder provides functionality " + "to add/remove an object selected/picked in " + "the Target to/from the selected tissue." + "Note: Only one tissue can be selected.")); tissueadddock->setObjectName("Adder"); tissueadddock->setAllowedAreas(Qt::LeftDockWidgetArea | - Qt::RightDockWidgetArea); + Qt::RightDockWidgetArea); tissueadddock->setWidget(hboxtissueadderw); addDockWidget(Qt::RightDockWidgetArea, tissueadddock); @@ -1161,8 +1155,8 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, if (!m_editingmode) { file->insertItem( - QIcon(m_picpath.absFilePath(QString("filenew.png")).ascii()), - "&New...", this, SLOT(execute_new())); + QIcon(m_picpath.absFilePath(QString("filenew.png")).ascii()), "&New...", + this, SLOT(execute_new())); loadmenu = new Q3PopupMenu(this, "loadmenu"); loadmenu->insertItem("Open .dcm...", this, SLOT(execute_loaddicom())); loadmenu->insertItem("Open .bmp...", this, SLOT(execute_loadbmp())); @@ -1171,30 +1165,26 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, loadmenu->insertItem("Open .raw...", this, SLOT(execute_loadraw())); loadmenu->insertItem("Open .mhd...", this, SLOT(execute_loadmhd())); loadmenu->insertItem("Open .avw...", this, SLOT(execute_loadavw())); - loadmenu->insertItem("Open .vti/.vtk...", this, - SLOT(execute_loadvtk())); + loadmenu->insertItem("Open .vti/.vtk...", this, SLOT(execute_loadvtk())); loadmenu->insertItem("Open NIfTI...", this, SLOT(execute_loadnifti())); #ifndef NORTDOSESUPPORT - loadmenu->insertItem("Open RTdose...", this, - SLOT(execute_loadrtdose())); + loadmenu->insertItem("Open RTdose...", this, SLOT(execute_loadrtdose())); #endif file->insertItem("&Open", loadmenu); } reloadmenu = new Q3PopupMenu( - this, "reloadmenu"); //xxxa add reload function for s4llink data later - reloadmenu->insertItem("Reopen .dc&m...", this, - SLOT(execute_reloaddicom())); + this, "reloadmenu"); //xxxa add reload function for s4llink data later + reloadmenu->insertItem("Reopen .dc&m...", this, SLOT(execute_reloaddicom())); reloadmenu->insertItem("Reopen .&bmp...", this, SLOT(execute_reloadbmp())); reloadmenu->insertItem("Reopen .raw...", this, SLOT(execute_reloadraw())); reloadmenu->insertItem("Reopen .mhd...", this, SLOT(execute_reloadmhd())); reloadmenu->insertItem("Reopen .avw...", this, SLOT(execute_reloadavw())); reloadmenu->insertItem("Reopen .vti/.vtk...", this, - SLOT(execute_reloadvtk())); - reloadmenu->insertItem("Reopen NIfTI...", this, - SLOT(execute_reloadnifti())); + SLOT(execute_reloadvtk())); + reloadmenu->insertItem("Reopen NIfTI...", this, SLOT(execute_reloadnifti())); #ifndef NORTDOSESUPPORT reloadmenu->insertItem("Reopen RTdose...", this, - SLOT(execute_reloadrtdose())); + SLOT(execute_reloadrtdose())); #endif file->insertItem("&Reopen", reloadmenu); #ifndef NORTSTRUCTSUPPORT @@ -1205,9 +1195,8 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, QAction* importS4LLink = file->addAction("Import S4L link (h5)..."); connect(importS4LLink, SIGNAL(triggered()), this, SLOT(execute_loads4llivelink())); - importS4LLink->setToolTip( - "Loads a Sim4Life live link file (the h5 file, " - "which is part of an iSEG project)."); + importS4LLink->setToolTip("Loads a Sim4Life live link file (the h5 file, " + "which is part of an iSEG project)."); importS4LLink->setEnabled(true); } @@ -1216,7 +1205,7 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, connect(importSurface, SIGNAL(triggered()), this, SLOT(execute_loadsurface())); importSurface->setToolTip("Some data must be opened first to load the " - "surface on top of the existing project."); + "surface on top of the existing project."); importSurface->setEnabled(true); importRTstructPos = file->actions().size(); @@ -1224,71 +1213,68 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, connect(importRTAction, SIGNAL(triggered()), this, SLOT(execute_loadrtstruct())); importRTAction->setToolTip( - "Some data must be opened first to import its RTStruct file"); + "Some data must be opened first to import its RTStruct file"); importRTAction->setEnabled(false); #endif file->insertItem("&Export Image(s)...", this, SLOT(execute_saveimg())); file->insertItem("Export &Contour...", this, SLOT(execute_saveContours())); exportmenu = new Q3PopupMenu(this, "exportmenu"); exportmenu->insertItem("Export &Labelfield...(am)", this, - SLOT(execute_exportlabelfield())); + SLOT(execute_exportlabelfield())); exportmenu->insertItem("Export vtk-ascii...(vti/vtk)", this, - SLOT(execute_exportvtkascii())); + SLOT(execute_exportvtkascii())); exportmenu->insertItem("Export vtk-binary...(vti/vtk)", this, - SLOT(execute_exportvtkbinary())); + SLOT(execute_exportvtkbinary())); exportmenu->insertItem("Export vtk-compressed-ascii...(vti)", this, - SLOT(execute_exportvtkcompressedascii())); + SLOT(execute_exportvtkcompressedascii())); exportmenu->insertItem("Export vtk-compressed-binary...(vti)", this, - SLOT(execute_exportvtkcompressedbinary())); + SLOT(execute_exportvtkcompressedbinary())); exportmenu->insertItem("Export Matlab...(mat)", this, - SLOT(execute_exportmat())); - exportmenu->insertItem("Export hdf...(h5)", this, - SLOT(execute_exporthdf())); + SLOT(execute_exportmat())); + exportmenu->insertItem("Export hdf...(h5)", this, SLOT(execute_exporthdf())); exportmenu->insertItem("Export xml-extent index...(xml)", this, - SLOT(execute_exportxmlregionextent())); + SLOT(execute_exportxmlregionextent())); exportmenu->insertItem("Export tissue index...(txt)", this, - SLOT(execute_exporttissueindex())); + SLOT(execute_exporttissueindex())); file->insertItem("Export Tissue Distr.", exportmenu); file->insertSeparator(); if (!m_editingmode) - file->insertItem("Save &Project as...", this, - SLOT(execute_saveprojas())); + file->insertItem("Save &Project as...", this, SLOT(execute_saveprojas())); else file->insertItem("Save &Project-Copy as...", this, - SLOT(execute_savecopyas())); + SLOT(execute_savecopyas())); file->insertItem( - QIcon(m_picpath.absFilePath(QString("filesave.png")).ascii()), - "Save Pro&ject", this, SLOT(execute_saveproj()), - QKeySequence("Ctrl+S")); + QIcon(m_picpath.absFilePath(QString("filesave.png")).ascii()), + "Save Pro&ject", this, SLOT(execute_saveproj()), QKeySequence("Ctrl+S")); file->insertItem("Save Active Slices...", this, - SLOT(execute_saveactiveslicesas())); + SLOT(execute_saveactiveslicesas())); if (!m_editingmode) file->insertItem( - QIcon(m_picpath.absFilePath(QString("fileopen.png")).ascii()), - "Open P&roject...", this, SLOT(execute_loadproj())); + QIcon(m_picpath.absFilePath(QString("fileopen.png")).ascii()), + "Open P&roject...", this, SLOT(execute_loadproj())); file->insertSeparator(); file->insertItem("Save &Tissuelist...", this, SLOT(execute_savetissues())); file->insertItem("Open T&issuelist...", this, SLOT(execute_loadtissues())); file->insertItem("Set Tissuelist as Default", this, - SLOT(execute_settissuesasdef())); + SLOT(execute_settissuesasdef())); file->insertItem("Remove Default Tissuelist", this, - SLOT(execute_removedeftissues())); + SLOT(execute_removedeftissues())); #ifndef NOSURFACEGENERATIONTOOLSUPPORT file->insertItem("Export Surface Generation Tool XML...", this, - SLOT(execute_exportsurfacegenerationtoolxml())); + SLOT(execute_exportsurfacegenerationtoolxml())); #endif file->insertSeparator(); if (!m_editingmode) { m_loadprojfilename.lpf1nr = - file->insertItem("", this, SLOT(execute_loadproj1())); + file->insertItem("", this, SLOT(execute_loadproj1())); m_loadprojfilename.lpf2nr = - file->insertItem("", this, SLOT(execute_loadproj2())); + file->insertItem("", this, SLOT(execute_loadproj2())); m_loadprojfilename.lpf3nr = - file->insertItem("", this, SLOT(execute_loadproj3())); + file->insertItem("", this, SLOT(execute_loadproj3())); m_loadprojfilename.lpf4nr = - file->insertItem("", this, SLOT(execute_loadproj4())); + file->insertItem("", this, SLOT(execute_loadproj4())); m_loadprojfilename.separatornr = file->insertSeparator(); file->setItemVisible(m_loadprojfilename.lpf1nr, false); file->setItemVisible(m_loadprojfilename.lpf2nr, false); @@ -1309,8 +1295,8 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, imagemenu->insertItem("Crop...", this, SLOT(execute_crop())); } imagemenu->insertItem( - QIcon(m_picpath.absFilePath(QString("histo.png")).ascii()), - "&Histogram...", this, SLOT(execute_histo())); + QIcon(m_picpath.absFilePath(QString("histo.png")).ascii()), + "&Histogram...", this, SLOT(execute_histo())); imagemenu->insertItem("&Contr./Bright. ...", this, SLOT(execute_scale())); imagemenu->insertItem("&Image Math. ...", this, SLOT(execute_imagemath())); imagemenu->insertItem("Unwrap", this, SLOT(execute_unwrap())); @@ -1319,13 +1305,13 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, imagemenu->insertItem("&x Sliced", this, SLOT(execute_xslice())); imagemenu->insertItem("&y Sliced", this, SLOT(execute_yslice())); imagemenu->insertItem("3D surface view", this, - SLOT(execute_3Dsurfaceviewer())); + SLOT(execute_3Dsurfaceviewer())); imagemenu->insertItem("3D isosurface view", this, - SLOT(execute_3Dsurfaceviewerbmp())); + SLOT(execute_3Dsurfaceviewerbmp())); imagemenu->insertItem("3D volume view source", this, - SLOT(execute_3Dvolumeviewerbmp())); + SLOT(execute_3Dvolumeviewerbmp())); imagemenu->insertItem("3D volume view tissue", this, - SLOT(execute_3Dvolumeviewertissue())); + SLOT(execute_3Dvolumeviewertissue())); if (!m_editingmode) { //xxxa; @@ -1337,15 +1323,15 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, editmenu = menuBar()->addMenu(tr("E&dit")); undonr = editmenu->insertItem( - QIcon(m_picpath.absFilePath(QString("undo.png")).ascii()), "&Undo", - this, SLOT(execute_undo())); + QIcon(m_picpath.absFilePath(QString("undo.png")).ascii()), "&Undo", this, + SLOT(execute_undo())); redonr = editmenu->insertItem( - QIcon(m_picpath.absFilePath(QString("redo.png")).ascii()), "Redo", this, - SLOT(execute_redo())); + QIcon(m_picpath.absFilePath(QString("redo.png")).ascii()), "Redo", this, + SLOT(execute_redo())); editmenu->insertSeparator(); editmenu->insertItem("&Configure Undo...", this, SLOT(execute_undoconf())); editmenu->insertItem("&Active Slices...", this, - SLOT(execute_activeslicesconf())); + SLOT(execute_activeslicesconf())); editmenu->setItemEnabled(undonr, false); editmenu->setItemEnabled(redonr, false); editmenu->insertItem("&Settings...", this, SLOT(execute_settings())); @@ -1391,8 +1377,7 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, for (unsigned short i = 0; i < nrtabbuttons; i++) { //showtab_action[i]=new Q3Action((std::string("Show ")+tabwidgets[i]->GetName()).c_str(),0,this); - showtab_action[i] = - new Q3Action(tabwidgets[i]->GetName().c_str(), 0, this); + showtab_action[i] = new Q3Action(tabwidgets[i]->GetName().c_str(), 0, this); showtab_action[i]->setToggleAction(true); showtab_action[i]->setOn(showpb_tab[i]); connect(showtab_action[i], SIGNAL(toggled(bool)), this, @@ -1410,68 +1395,67 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, viewmenu->insertItem("Methods", hidesubmenu); toolmenu = menuBar()->addMenu(tr("T&ools")); - toolmenu->insertItem("&Group Tissues...", this, - SLOT(execute_grouptissues())); + toolmenu->insertItem("&Group Tissues...", this, SLOT(execute_grouptissues())); toolmenu->insertItem("Remove Tissues...", this, - SLOT(execute_removetissues())); + SLOT(execute_removetissues())); toolmenu->insertItem("Target->Tissue", this, SLOT(do_work2tissue())); toolmenu->insertItem("Target->Tissue grouped...", this, - SLOT(do_work2tissue_grouped())); + SLOT(do_work2tissue_grouped())); toolmenu->insertItem("Tissue->Target", this, SLOT(do_tissue2work())); toolmenu->insertItem("In&verse Slice Order", this, - SLOT(execute_inversesliceorder())); + SLOT(execute_inversesliceorder())); toolmenu->insertItem("Clean Up", this, SLOT(execute_cleanup())); toolmenu->insertItem("Smooth Steps", this, SLOT(execute_smoothsteps())); // toolmenu->insertItem( "Smooth Tissues", this, SLOT(execute_smoothtissues())); if (!m_editingmode) toolmenu->insertItem("Merge Projects...", this, - SLOT(execute_mergeprojects())); + SLOT(execute_mergeprojects())); toolmenu->insertItem("Check Bone Connectivity", this, - SLOT(execute_boneconnectivity())); + SLOT(execute_boneconnectivity())); atlasmenu = menuBar()->addMenu(tr("Atlas")); // todo: make atlas method generic, i.e. for loop // see e.g. https://stackoverflow.com/questions/9187538/how-to-add-a-list-of-qactions-to-a-qmenu-and-handle-them-with-a-single-slot m_atlasfilename.atlasnr[0] = - atlasmenu->insertItem("", this, SLOT(execute_loadatlas0())); + atlasmenu->insertItem("", this, SLOT(execute_loadatlas0())); m_atlasfilename.atlasnr[1] = - atlasmenu->insertItem("", this, SLOT(execute_loadatlas1())); + atlasmenu->insertItem("", this, SLOT(execute_loadatlas1())); m_atlasfilename.atlasnr[2] = - atlasmenu->insertItem("", this, SLOT(execute_loadatlas2())); + atlasmenu->insertItem("", this, SLOT(execute_loadatlas2())); m_atlasfilename.atlasnr[3] = - atlasmenu->insertItem("", this, SLOT(execute_loadatlas3())); + atlasmenu->insertItem("", this, SLOT(execute_loadatlas3())); m_atlasfilename.atlasnr[4] = - atlasmenu->insertItem("", this, SLOT(execute_loadatlas4())); + atlasmenu->insertItem("", this, SLOT(execute_loadatlas4())); m_atlasfilename.atlasnr[5] = - atlasmenu->insertItem("", this, SLOT(execute_loadatlas5())); + atlasmenu->insertItem("", this, SLOT(execute_loadatlas5())); m_atlasfilename.atlasnr[6] = - atlasmenu->insertItem("", this, SLOT(execute_loadatlas6())); + atlasmenu->insertItem("", this, SLOT(execute_loadatlas6())); m_atlasfilename.atlasnr[7] = - atlasmenu->insertItem("", this, SLOT(execute_loadatlas7())); + atlasmenu->insertItem("", this, SLOT(execute_loadatlas7())); m_atlasfilename.atlasnr[8] = - atlasmenu->insertItem("", this, SLOT(execute_loadatlas8())); + atlasmenu->insertItem("", this, SLOT(execute_loadatlas8())); m_atlasfilename.atlasnr[9] = - atlasmenu->insertItem("", this, SLOT(execute_loadatlas9())); + atlasmenu->insertItem("", this, SLOT(execute_loadatlas9())); m_atlasfilename.atlasnr[10] = - atlasmenu->insertItem("", this, SLOT(execute_loadatlas10())); + atlasmenu->insertItem("", this, SLOT(execute_loadatlas10())); m_atlasfilename.atlasnr[11] = - atlasmenu->insertItem("", this, SLOT(execute_loadatlas11())); + atlasmenu->insertItem("", this, SLOT(execute_loadatlas11())); m_atlasfilename.atlasnr[12] = - atlasmenu->insertItem("", this, SLOT(execute_loadatlas12())); + atlasmenu->insertItem("", this, SLOT(execute_loadatlas12())); m_atlasfilename.atlasnr[13] = - atlasmenu->insertItem("", this, SLOT(execute_loadatlas13())); + atlasmenu->insertItem("", this, SLOT(execute_loadatlas13())); m_atlasfilename.atlasnr[14] = - atlasmenu->insertItem("", this, SLOT(execute_loadatlas14())); + atlasmenu->insertItem("", this, SLOT(execute_loadatlas14())); m_atlasfilename.atlasnr[15] = - atlasmenu->insertItem("", this, SLOT(execute_loadatlas15())); + atlasmenu->insertItem("", this, SLOT(execute_loadatlas15())); m_atlasfilename.atlasnr[16] = - atlasmenu->insertItem("", this, SLOT(execute_loadatlas16())); + atlasmenu->insertItem("", this, SLOT(execute_loadatlas16())); m_atlasfilename.atlasnr[17] = - atlasmenu->insertItem("", this, SLOT(execute_loadatlas17())); + atlasmenu->insertItem("", this, SLOT(execute_loadatlas17())); m_atlasfilename.atlasnr[18] = - atlasmenu->insertItem("", this, SLOT(execute_loadatlas18())); + atlasmenu->insertItem("", this, SLOT(execute_loadatlas18())); m_atlasfilename.atlasnr[19] = - atlasmenu->insertItem("", this, SLOT(execute_loadatlas19())); + atlasmenu->insertItem("", this, SLOT(execute_loadatlas19())); m_atlasfilename.separatornr = atlasmenu->insertSeparator(); atlasmenu->insertItem("Create Atlas...", this, SLOT(execute_createatlas())); atlasmenu->insertItem("Update Menu", this, SLOT(execute_reloadatlases())); @@ -1499,430 +1483,410 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, helpmenu = menuBar()->addMenu(tr("Help")); helpmenu->insertItem( - QIcon(m_picpath.absFilePath(QString("help.png")).ascii()), "About", - this, SLOT(execute_about())); + QIcon(m_picpath.absFilePath(QString("help.png")).ascii()), "About", this, + SLOT(execute_about())); QObject::connect(toworkBtn, SIGNAL(clicked()), this, - SLOT(execute_bmp2work())); - QObject::connect(tobmpBtn, SIGNAL(clicked()), this, - SLOT(execute_work2bmp())); + SLOT(execute_bmp2work())); + QObject::connect(tobmpBtn, SIGNAL(clicked()), this, SLOT(execute_work2bmp())); QObject::connect(swapBtn, SIGNAL(clicked()), this, - SLOT(execute_swap_bmpwork())); + SLOT(execute_swap_bmpwork())); QObject::connect(swapAllBtn, SIGNAL(clicked()), this, - SLOT(execute_swap_bmpworkall())); + SLOT(execute_swap_bmpworkall())); QObject::connect(this, SIGNAL(bmp_changed()), this, SLOT(update_bmp())); QObject::connect(this, SIGNAL(work_changed()), this, SLOT(update_work())); QObject::connect(this, SIGNAL(work_changed()), bmp_show, - SLOT(workborder_changed())); + SLOT(workborder_changed())); QObject::connect(this, SIGNAL(marks_changed()), bmp_show, - SLOT(mark_changed())); + SLOT(mark_changed())); QObject::connect(this, SIGNAL(marks_changed()), work_show, - SLOT(mark_changed())); + SLOT(mark_changed())); QObject::connect(this, SIGNAL(tissues_changed()), this, - SLOT(update_tissue())); + SLOT(update_tissue())); QObject::connect(bmp_show, SIGNAL(addmark_sign(Point)), this, - SLOT(add_mark(Point))); + SLOT(add_mark(Point))); QObject::connect(bmp_show, SIGNAL(addlabel_sign(Point, std::string)), this, - SLOT(add_label(Point, std::string))); + SLOT(add_label(Point, std::string))); QObject::connect(bmp_show, SIGNAL(clearmarks_sign()), this, - SLOT(clear_marks())); + SLOT(clear_marks())); QObject::connect(bmp_show, SIGNAL(removemark_sign(Point)), this, - SLOT(remove_mark(Point))); + SLOT(remove_mark(Point))); QObject::connect(bmp_show, SIGNAL(addtissue_sign(Point)), this, - SLOT(add_tissue(Point))); + SLOT(add_tissue(Point))); QObject::connect(bmp_show, SIGNAL(addtissueconnected_sign(Point)), this, - SLOT(add_tissue_connected(Point))); + SLOT(add_tissue_connected(Point))); QObject::connect(bmp_show, SIGNAL(subtissue_sign(Point)), this, - SLOT(subtract_tissue(Point))); + SLOT(subtract_tissue(Point))); QObject::connect(bmp_show, SIGNAL(addtissue3D_sign(Point)), this, - SLOT(add_tissue_3D(Point))); + SLOT(add_tissue_3D(Point))); QObject::connect(bmp_show, SIGNAL(addtissuelarger_sign(Point)), this, - SLOT(add_tissuelarger(Point))); + SLOT(add_tissuelarger(Point))); QObject::connect(bmp_show, SIGNAL(selecttissue_sign(Point)), this, - SLOT(select_tissue(Point))); + SLOT(select_tissue(Point))); QObject::connect(work_show, SIGNAL(addmark_sign(Point)), this, - SLOT(add_mark(Point))); + SLOT(add_mark(Point))); QObject::connect(work_show, SIGNAL(addlabel_sign(Point, std::string)), this, - SLOT(add_label(Point, std::string))); + SLOT(add_label(Point, std::string))); QObject::connect(work_show, SIGNAL(clearmarks_sign()), this, - SLOT(clear_marks())); + SLOT(clear_marks())); QObject::connect(work_show, SIGNAL(removemark_sign(Point)), this, - SLOT(remove_mark(Point))); + SLOT(remove_mark(Point))); QObject::connect(work_show, SIGNAL(addtissue_sign(Point)), this, - SLOT(add_tissue(Point))); + SLOT(add_tissue(Point))); QObject::connect(work_show, SIGNAL(addtissueconnected_sign(Point)), this, - SLOT(add_tissue_connected(Point))); + SLOT(add_tissue_connected(Point))); QObject::connect(work_show, SIGNAL(subtissue_sign(Point)), this, - SLOT(subtract_tissue(Point))); + SLOT(subtract_tissue(Point))); QObject::connect(work_show, SIGNAL(addtissue3D_sign(Point)), this, - SLOT(add_tissue_3D(Point))); + SLOT(add_tissue_3D(Point))); QObject::connect(work_show, SIGNAL(addtissuelarger_sign(Point)), this, - SLOT(add_tissuelarger(Point))); + SLOT(add_tissuelarger(Point))); QObject::connect(work_show, SIGNAL(selecttissue_sign(Point)), this, - SLOT(select_tissue(Point))); + SLOT(select_tissue(Point))); QObject::connect(tissueFilter, SIGNAL(textChanged(const QString&)), this, - SLOT(tissueFilterChanged(const QString&))); + SLOT(tissueFilterChanged(const QString&))); QObject::connect(lockTissues, SIGNAL(clicked()), this, - SLOT(lockAllTissues())); + SLOT(lockAllTissues())); QObject::connect(addTissue, SIGNAL(clicked()), this, - SLOT(newTissuePressed())); + SLOT(newTissuePressed())); QObject::connect(addFolder, SIGNAL(clicked()), this, - SLOT(newFolderPressed())); + SLOT(newFolderPressed())); QObject::connect(modifyTissueFolder, SIGNAL(clicked()), this, - SLOT(modifTissueFolderPressed())); + SLOT(modifTissueFolderPressed())); QObject::connect(removeTissueFolder, SIGNAL(clicked()), this, - SLOT(removeTissueFolderPressed())); + SLOT(removeTissueFolderPressed())); QObject::connect(removeTissueFolderAll, SIGNAL(clicked()), this, - SLOT(removeTissueFolderAllPressed())); + SLOT(removeTissueFolderAllPressed())); QObject::connect(getTissue, SIGNAL(clicked()), this, - SLOT(selectedtissue2work())); + SLOT(selectedtissue2work())); QObject::connect(getTissueAll, SIGNAL(clicked()), this, - SLOT(tissue2workall())); - QObject::connect(clearTissue, SIGNAL(clicked()), this, - SLOT(clearselected())); - QObject::connect(clearTissues, SIGNAL(clicked()), this, - SLOT(cleartissues())); + SLOT(tissue2workall())); + QObject::connect(clearTissue, SIGNAL(clicked()), this, SLOT(clearselected())); + QObject::connect(clearTissues, SIGNAL(clicked()), this, SLOT(cleartissues())); QObject::connect(methodTab, SIGNAL(aboutToShow(QWidget*)), this, - SLOT(tab_changed(QWidget*))); + SLOT(tab_changed(QWidget*))); tissueTreeWidget->setSelectionMode( - QAbstractItemView::SelectionMode::ExtendedSelection); + QAbstractItemView::SelectionMode::ExtendedSelection); QObject::connect(tissueTreeWidget, SIGNAL(itemSelectionChanged()), this, - SLOT(tissue_selection_changed())); + SLOT(tissue_selection_changed())); QObject::connect(tissueTreeWidget, - SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, - SLOT(tree_widget_doubleclicked(QTreeWidgetItem*, int))); + SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, + SLOT(tree_widget_doubleclicked(QTreeWidgetItem*, int))); QObject::connect(tissueTreeWidget, - SIGNAL(customContextMenuRequested(const QPoint&)), this, - SLOT(tree_widget_contextmenu(const QPoint&))); + SIGNAL(customContextMenuRequested(const QPoint&)), this, + SLOT(tree_widget_contextmenu(const QPoint&))); tissues_size_t currTissueType = tissueTreeWidget->get_current_type(); bmp_show->color_changed(currTissueType - 1); work_show->color_changed(currTissueType - 1); QObject::connect(cb_bmptissuevisible, SIGNAL(clicked()), this, - SLOT(bmptissuevisible_changed())); + SLOT(bmptissuevisible_changed())); QObject::connect(cb_bmpcrosshairvisible, SIGNAL(clicked()), this, - SLOT(bmpcrosshairvisible_changed())); + SLOT(bmpcrosshairvisible_changed())); QObject::connect(cb_bmpoutlinevisible, SIGNAL(clicked()), this, - SLOT(bmpoutlinevisible_changed())); + SLOT(bmpoutlinevisible_changed())); QObject::connect(cb_worktissuevisible, SIGNAL(clicked()), this, - SLOT(worktissuevisible_changed())); + SLOT(worktissuevisible_changed())); QObject::connect(cb_workcrosshairvisible, SIGNAL(clicked()), this, - SLOT(workcrosshairvisible_changed())); + SLOT(workcrosshairvisible_changed())); QObject::connect(cb_workpicturevisible, SIGNAL(clicked()), this, - SLOT(workpicturevisible_changed())); + SLOT(workpicturevisible_changed())); - QObject::connect(pb_first, SIGNAL(clicked()), this, - SLOT(pb_first_pressed())); + QObject::connect(pb_first, SIGNAL(clicked()), this, SLOT(pb_first_pressed())); QObject::connect(pb_last, SIGNAL(clicked()), this, SLOT(pb_last_pressed())); QObject::connect(sb_slicenr, SIGNAL(valueChanged(int)), this, - SLOT(sb_slicenr_changed())); + SLOT(sb_slicenr_changed())); QObject::connect(scb_slicenr, SIGNAL(valueChanged(int)), this, - SLOT(scb_slicenr_changed())); + SLOT(scb_slicenr_changed())); - // QObject::connect(le_slicethick,SIGNAL(returnPressed()),this,SLOT(slicethickness_changed())); QObject::connect(le_slicethick, SIGNAL(textChanged(const QString&)), this, - SLOT(slicethickness_changed())); + SLOT(slicethickness_changed())); - QObject::connect(pb_add, SIGNAL(clicked()), this, - SLOT(add_tissue_pushed())); + QObject::connect(pb_add, SIGNAL(clicked()), this, SLOT(add_tissue_pushed())); QObject::connect(pb_sub, SIGNAL(clicked()), this, - SLOT(subtract_tissue_pushed())); + SLOT(subtract_tissue_pushed())); QObject::connect(pb_addhold, SIGNAL(clicked()), this, - SLOT(addhold_tissue_pushed())); - // QObject::connect(pb_stophold,SIGNAL(clicked()),this,SLOT(stophold_tissue_pushed())); + SLOT(addhold_tissue_pushed())); QObject::connect(pb_subhold, SIGNAL(clicked()), this, - SLOT(subtracthold_tissue_pushed())); - // QObject::connect(pb_addconn,SIGNAL(clicked()),this,SLOT(add_tissue_connected_pushed())); - // QObject::connect(pb_add3D,SIGNAL(clicked()),this,SLOT(add_tissue_3D_pushed())); - - /*if(xsliceshower) - QObject::connect(xsliceshower,SIGNAL(hasbeenclosed()),this,SLOT(xslice_closed())); - if(ysliceshower) - QObject::connect(ysliceshower,SIGNAL(hasbeenclosed()),this,SLOT(yslice_closed()));*/ + SLOT(subtracthold_tissue_pushed())); + QObject::connect(bmp_scroller, SIGNAL(contentsMoving(int, int)), this, - SLOT(setWorkContentsPos(int, int))); + SLOT(setWorkContentsPos(int, int))); QObject::connect(work_scroller, SIGNAL(contentsMoving(int, int)), this, - SLOT(setBmpContentsPos(int, int))); + SLOT(setBmpContentsPos(int, int))); QObject::connect(bmp_show, SIGNAL(setcenter_sign(int, int)), bmp_scroller, - SLOT(center(int, int))); + SLOT(center(int, int))); QObject::connect(work_show, SIGNAL(setcenter_sign(int, int)), work_scroller, - SLOT(center(int, int))); + SLOT(center(int, int))); tomove_scroller = true; - interpolwidget->tissuenr_changed(currTissueType - 1); - QObject::connect(zoom_widget, SIGNAL(set_zoom(double)), bmp_show, - SLOT(set_zoom(double))); + SLOT(set_zoom(double))); QObject::connect(zoom_widget, SIGNAL(set_zoom(double)), work_show, - SLOT(set_zoom(double))); + SLOT(set_zoom(double))); QObject::connect( - this, SIGNAL(begin_dataexport(iseg::DataSelection&, QWidget*)), this, - SLOT(handle_begin_dataexport(iseg::DataSelection&, QWidget*))); + this, SIGNAL(begin_dataexport(iseg::DataSelection&, QWidget*)), this, + SLOT(handle_begin_dataexport(iseg::DataSelection&, QWidget*))); QObject::connect(this, SIGNAL(end_dataexport(QWidget*)), this, - SLOT(handle_end_dataexport(QWidget*))); + SLOT(handle_end_dataexport(QWidget*))); QObject::connect( - this, SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), - this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); - QObject::connect( - this, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, - SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); - QObject::connect( - threshold_widget, - SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); - QObject::connect( - threshold_widget, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), - this, SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); - QObject::connect( - OutlineCorrect_widget, - SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + this, SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), + this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + QObject::connect(this, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), + this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); + QObject::connect( - OutlineCorrect_widget, - SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, - SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); + threshold_widget, + SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + QObject::connect(threshold_widget, + SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); QObject::connect( - OutlineCorrect_widget, - SIGNAL(end_datachange(QRect, QWidget*, iseg::EndUndoAction)), this, - SLOT(handle_end_datachange(QRect, QWidget*, iseg::EndUndoAction))); + OutlineCorrect_widget, + SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); QObject::connect(OutlineCorrect_widget, - SIGNAL(signal_request_selected_tissue_TS()), this, - SLOT(provide_selected_tissue_TS())); + SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); QObject::connect(OutlineCorrect_widget, - SIGNAL(signal_request_selected_tissue_BG()), this, - SLOT(provide_selected_tissue_BG())); - QObject::connect( - smoothing_widget, - SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); - QObject::connect( - smoothing_widget, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), - this, SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); - QObject::connect( - edge_widg, - SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); - QObject::connect( - edge_widg, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, - SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); - QObject::connect( - morph_widget, - SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); - QObject::connect( - morph_widget, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), - this, SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); - QObject::connect( - wshed_widget, - SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); - QObject::connect( - wshed_widget, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), - this, SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); - QObject::connect( - lw_widget, - SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); - QObject::connect( - lw_widget, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, - SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); - QObject::connect( - iftrg_widget, - SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); - QObject::connect( - iftrg_widget, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), - this, SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); + SIGNAL(signal_request_selected_tissue_TS()), this, + SLOT(provide_selected_tissue_TS())); + QObject::connect(OutlineCorrect_widget, + SIGNAL(signal_request_selected_tissue_BG()), this, + SLOT(provide_selected_tissue_BG())); QObject::connect( - FMF_widget, - SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + smoothing_widget, + SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + QObject::connect(smoothing_widget, + SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); QObject::connect( - FMF_widget, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, - SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); + edge_widg, + SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + QObject::connect(edge_widg, + SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); QObject::connect( - interpolwidget, - SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + morph_widget, + SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + QObject::connect(morph_widget, + SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); QObject::connect( - interpolwidget, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), - this, SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); + wshed_widget, + SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + QObject::connect(wshed_widget, + SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); QObject::connect( - scalewidget, - SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + lw_widget, + SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + QObject::connect(lw_widget, + SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); QObject::connect( - scalewidget, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), - this, SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); + iftrg_widget, + SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + QObject::connect(iftrg_widget, + SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); QObject::connect( - imagemathwidget, - SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + FMF_widget, + SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + QObject::connect(FMF_widget, + SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); QObject::connect( - imagemathwidget, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), - this, SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); + interpolwidget, + SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + QObject::connect(interpolwidget, + SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); QObject::connect( - imageoverlaywidget, - SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + scalewidget, + SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + QObject::connect(scalewidget, + SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); QObject::connect( - imageoverlaywidget, - SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, - SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); + imagemathwidget, + SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + QObject::connect(imagemathwidget, + SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); QObject::connect( - bitstack_widget, - SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + imageoverlaywidget, + SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + QObject::connect(imageoverlaywidget, + SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); QObject::connect( - bitstack_widget, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), - this, SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); + bitstack_widget, + SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + QObject::connect(bitstack_widget, + SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); QObject::connect( - bitstack_widget, - SIGNAL(begin_dataexport(iseg::DataSelection&, QWidget*)), this, - SLOT(handle_begin_dataexport(iseg::DataSelection&, QWidget*))); + bitstack_widget, + SIGNAL(begin_dataexport(iseg::DataSelection&, QWidget*)), this, + SLOT(handle_begin_dataexport(iseg::DataSelection&, QWidget*))); QObject::connect(bitstack_widget, SIGNAL(end_dataexport(QWidget*)), this, - SLOT(handle_end_dataexport(QWidget*))); + SLOT(handle_end_dataexport(QWidget*))); QObject::connect( - hyst_widget, - SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + hyst_widget, + SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + QObject::connect(hyst_widget, + SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); QObject::connect( - hyst_widget, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), - this, SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); + pickerwidget, + SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + QObject::connect(pickerwidget, + SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); QObject::connect( - pickerwidget, - SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); - QObject::connect( - pickerwidget, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), - this, SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); - QObject::connect( - transfrmWidget, - SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); - QObject::connect( - transfrmWidget, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), - this, SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); + transfrmWidget, + SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + QObject::connect(transfrmWidget, + SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); QObject::connect(overlay_widget, SIGNAL(overlay_changed()), bmp_show, - SLOT(overlay_changed())); + SLOT(overlay_changed())); QObject::connect(overlay_widget, SIGNAL(overlay_changed()), work_show, - SLOT(overlay_changed())); + SLOT(overlay_changed())); QObject::connect(overlay_widget, SIGNAL(overlayalpha_changed(float)), - bmp_show, SLOT(set_overlayalpha(float))); + bmp_show, SLOT(set_overlayalpha(float))); QObject::connect(overlay_widget, SIGNAL(overlayalpha_changed(float)), - work_show, SLOT(set_overlayalpha(float))); + work_show, SLOT(set_overlayalpha(float))); QObject::connect(overlay_widget, SIGNAL(bmpoverlayvisible_changed(bool)), - bmp_show, SLOT(set_overlayvisible(bool))); + bmp_show, SLOT(set_overlayvisible(bool))); QObject::connect(overlay_widget, SIGNAL(workoverlayvisible_changed(bool)), - work_show, SLOT(set_overlayvisible(bool))); + work_show, SLOT(set_overlayvisible(bool))); QObject::connect(m_MultiDataset_widget, SIGNAL(dataset_changed()), bmp_show, - SLOT(overlay_changed())); - QObject::connect(m_MultiDataset_widget, SIGNAL(dataset_changed()), - work_show, SLOT(overlay_changed())); + SLOT(overlay_changed())); + QObject::connect(m_MultiDataset_widget, SIGNAL(dataset_changed()), work_show, + SLOT(overlay_changed())); QObject::connect(m_MultiDataset_widget, SIGNAL(dataset_changed()), this, - SLOT(DatasetChanged())); - QObject::connect( - m_MultiDataset_widget, - SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + SLOT(DatasetChanged())); QObject::connect( - m_MultiDataset_widget, - SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, - SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); + m_MultiDataset_widget, + SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + QObject::connect(m_MultiDataset_widget, + SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); QObject::connect(cb_tissuelock, SIGNAL(clicked()), this, - SLOT(tissuelock_toggled())); + SLOT(tissuelock_toggled())); QObject::connect(sl_contrastbmp, SIGNAL(valueChanged(int)), this, - SLOT(sl_contrastbmp_moved(int))); + SLOT(sl_contrastbmp_moved(int))); QObject::connect(sl_contrastwork, SIGNAL(valueChanged(int)), this, - SLOT(sl_contrastwork_moved(int))); + SLOT(sl_contrastwork_moved(int))); QObject::connect(sl_brightnessbmp, SIGNAL(valueChanged(int)), this, - SLOT(sl_brightnessbmp_moved(int))); + SLOT(sl_brightnessbmp_moved(int))); QObject::connect(sl_brightnesswork, SIGNAL(valueChanged(int)), this, - SLOT(sl_brightnesswork_moved(int))); + SLOT(sl_brightnesswork_moved(int))); QObject::connect(le_contrastbmp_val, SIGNAL(editingFinished()), this, - SLOT(le_contrastbmp_val_edited())); + SLOT(le_contrastbmp_val_edited())); QObject::connect(le_contrastwork_val, SIGNAL(editingFinished()), this, - SLOT(le_contrastwork_val_edited())); + SLOT(le_contrastwork_val_edited())); QObject::connect(le_brightnessbmp_val, SIGNAL(editingFinished()), this, - SLOT(le_brightnessbmp_val_edited())); + SLOT(le_brightnessbmp_val_edited())); QObject::connect(le_brightnesswork_val, SIGNAL(editingFinished()), this, - SLOT(le_brightnesswork_val_edited())); + SLOT(le_brightnesswork_val_edited())); + + // \todo BL add generic connections here, e.g. begin/end_datachange m_widget_signal_mapper = new QSignalMapper(this); for (int i = 0; i < nrtabbuttons; ++i) { QObject::connect(pb_tab[i], SIGNAL(clicked()), m_widget_signal_mapper, - SLOT(map())); + SLOT(map())); m_widget_signal_mapper->setMapping(pb_tab[i], i); QObject::connect(m_widget_signal_mapper, SIGNAL(mapped(int)), this, - SLOT(pb_tab_pressed(int))); + SLOT(pb_tab_pressed(int))); } QObject::connect(bmp_show, SIGNAL(wheelrotatedctrl_sign(int)), this, - SLOT(wheelrotated(int))); + SLOT(wheelrotated(int))); QObject::connect(work_show, SIGNAL(wheelrotatedctrl_sign(int)), this, - SLOT(wheelrotated(int))); + SLOT(wheelrotated(int))); QObject::connect(bmp_show, SIGNAL(mousePosZoom_sign(QPoint)), this, - SLOT(mousePosZoom_changed(QPoint))); + SLOT(mousePosZoom_changed(const QPoint&))); QObject::connect(work_show, SIGNAL(mousePosZoom_sign(QPoint)), this, - SLOT(mousePosZoom_changed(QPoint))); + SLOT(mousePosZoom_changed(const QPoint&))); // QObject::connect(pb_work2tissue,SIGNAL(clicked()),this,SLOT(do_work2tissue())); m_acc_sliceup = new Q3Accel(this); m_acc_sliceup->connectItem( - m_acc_sliceup->insertItem(QKeySequence(Qt::CTRL + Qt::Key_Right)), this, - SLOT(slicenr_up())); + m_acc_sliceup->insertItem(QKeySequence(Qt::CTRL + Qt::Key_Right)), this, + SLOT(slicenr_up())); m_acc_slicedown = new Q3Accel(this); m_acc_slicedown->connectItem( - m_acc_slicedown->insertItem(QKeySequence(Qt::CTRL + Qt::Key_Left)), - this, SLOT(slicenr_down())); + m_acc_slicedown->insertItem(QKeySequence(Qt::CTRL + Qt::Key_Left)), this, + SLOT(slicenr_down())); m_acc_sliceup1 = new Q3Accel(this); m_acc_sliceup->connectItem( - m_acc_sliceup->insertItem(QKeySequence(Qt::Key_Next)), this, - SLOT(slicenr_up())); + m_acc_sliceup->insertItem(QKeySequence(Qt::Key_Next)), this, + SLOT(slicenr_up())); m_acc_slicedown1 = new Q3Accel(this); m_acc_slicedown->connectItem( - m_acc_slicedown->insertItem(QKeySequence(Qt::Key_Prior)), this, - SLOT(slicenr_down())); + m_acc_slicedown->insertItem(QKeySequence(Qt::Key_Prior)), this, + SLOT(slicenr_down())); m_acc_zoomin = new Q3Accel(this); m_acc_zoomin->connectItem( - m_acc_zoomin->insertItem(QKeySequence(Qt::CTRL + Qt::Key_Up)), this, - SLOT(zoom_in())); + m_acc_zoomin->insertItem(QKeySequence(Qt::CTRL + Qt::Key_Up)), this, + SLOT(zoom_in())); m_acc_zoomout = new Q3Accel(this); m_acc_zoomout->connectItem( - m_acc_zoomout->insertItem(QKeySequence(Qt::CTRL + Qt::Key_Down)), this, - SLOT(zoom_out())); + m_acc_zoomout->insertItem(QKeySequence(Qt::CTRL + Qt::Key_Down)), this, + SLOT(zoom_out())); m_acc_add = new Q3Accel(this); m_acc_add->connectItem( - m_acc_add->insertItem(QKeySequence(Qt::CTRL + Qt::Key_Plus)), this, - SLOT(add_tissue_shortkey())); + m_acc_add->insertItem(QKeySequence(Qt::CTRL + Qt::Key_Plus)), this, + SLOT(add_tissue_shortkey())); m_acc_sub = new Q3Accel(this); m_acc_sub->connectItem( - m_acc_sub->insertItem(QKeySequence(Qt::CTRL + Qt::Key_Minus)), this, - SLOT(subtract_tissue_shortkey())); + m_acc_sub->insertItem(QKeySequence(Qt::CTRL + Qt::Key_Minus)), this, + SLOT(subtract_tissue_shortkey())); m_acc_undo = new Q3Accel(this); - m_acc_undo->connectItem( - m_acc_undo->insertItem(QKeySequence(Qt::Key_Escape)), this, - SLOT(execute_undo())); + m_acc_undo->connectItem(m_acc_undo->insertItem(QKeySequence(Qt::Key_Escape)), + this, SLOT(execute_undo())); m_acc_undo2 = new Q3Accel(this); m_acc_undo2->connectItem(m_acc_undo2->insertItem(QKeySequence("Ctrl+Z")), - this, SLOT(execute_undo())); + this, SLOT(execute_undo())); m_acc_redo = new Q3Accel(this); - m_acc_redo->connectItem(m_acc_redo->insertItem(QKeySequence("Ctrl+Y")), - this, SLOT(execute_redo())); + m_acc_redo->connectItem(m_acc_redo->insertItem(QKeySequence("Ctrl+Y")), this, + SLOT(execute_redo())); // setCentralWidget(hbox); // vbox->insertChild(hbox2); @@ -1937,111 +1901,9 @@ MainWindow::MainWindow(SlicesHandler* hand3D, QString locationstring, m_NewDataAfterSwap = false; methodTab->raiseWidget(methodTab->visibleWidget()); - return; } -MainWindow::~MainWindow() -{ - //delete vboxtotal; - //delete file; - //delete loadmenu; - //delete reloadmenu; - //delete exportmenu; - //delete imagemenu; - //delete editmenu; - //delete toolmenu; - //delete helpmenu; - //delete hidemenu; - //delete hidesubmenu; - //delete menubar; - //delete menubarspacer; - //delete cb_bmptissuevisible; - //delete cb_bmpcrosshairvisible; - //delete cb_bmpoutlinevisible; - //delete cb_worktissuevisible; - //delete cb_workcrosshairvisible; - //delete cb_workpicturevisible; - //delete bmp_show; - //delete lb_source; - //delete lb_target; - //delete bmp_scroller; - //delete sl_contrastbmp; - //delete sl_brightnessbmp; - //delete lb_contrastbmp; - //delete lb_brightnessbmp; - //delete toworkBtn; - //delete tobmpBtn; - //delete swapBtn; - //delete swapAllBtn; - //delete zoom_widget; - //delete work_show; - //delete sl_contrastwork; - //delete sl_brightnesswork; - //delete lb_contrastwork; - //delete lb_brightnesswork; - //delete work_scroller; - //delete scalewidget; - //delete imagemathwidget; - //delete tissueTreeWidget; - //delete cb_tissuelock; - //delete lockTissues; - //delete addTissue; - //delete modifyTissue; - //delete removeTissue; - //delete tissue3Dopt; - //delete getTissue; - //delete clearTissue; - //delete clearTissues; - //delete cb_addsub3d; - //delete cb_addsuboverride; - //delete cb_addsubconn; - //delete pb_add; - //delete pb_sub; - //delete pb_addhold; - //delete pb_subhold; - //delete pb_first; - //delete scb_slicenr; - //delete pb_last; - //delete sb_slicenr; - //delete lb_slicenr; - //delete lb_inactivewarning; - //delete lb_slicethick; - //delete le_slicethick; - //delete methodTab; - //delete bitstack_widget; - //delete m_acc_sliceup; - //delete m_acc_slicedown; - //delete m_acc_sliceup1; - //delete m_acc_slicedown1; - //delete m_acc_zoomin; - //delete m_acc_zoomout; - //delete m_acc_add; - //delete m_acc_sub; - //delete m_acc_undo; - //for(unsigned short i=0;iclose(); - QObject::disconnect( - bmp_show, SIGNAL(scaleoffsetfactor_changed(float, float, bool)), - xsliceshower, SLOT(set_scale(float, float, bool))); - QObject::disconnect( - work_show, - SIGNAL(scaleoffsetfactor_changed(float, float, bool)), - xsliceshower, SLOT(set_scale(float, float, bool))); + QObject::disconnect(bmp_show, + SIGNAL(scaleoffsetfactor_changed(float, float, bool)), + xsliceshower, SLOT(set_scale(float, float, bool))); + QObject::disconnect(work_show, + SIGNAL(scaleoffsetfactor_changed(float, float, bool)), + xsliceshower, SLOT(set_scale(float, float, bool))); QObject::disconnect(xsliceshower, SIGNAL(slice_changed(int)), this, - SLOT(xshower_slicechanged())); - QObject::disconnect(zoom_widget, SIGNAL(set_zoom(double)), - xsliceshower, SLOT(set_zoom(double))); + SLOT(xshower_slicechanged())); + QObject::disconnect(zoom_widget, SIGNAL(set_zoom(double)), xsliceshower, + SLOT(set_zoom(double))); QObject::disconnect(xsliceshower, SIGNAL(hasbeenclosed()), this, - SLOT(xslice_closed())); + SLOT(xslice_closed())); delete xsliceshower; } if (ysliceshower != NULL) { ysliceshower->close(); - QObject::disconnect( - bmp_show, SIGNAL(scaleoffsetfactor_changed(float, float, bool)), - ysliceshower, SLOT(set_scale(float, float, bool))); - QObject::disconnect( - work_show, - SIGNAL(scaleoffsetfactor_changed(float, float, bool)), - ysliceshower, SLOT(set_scale(float, float, bool))); + QObject::disconnect(bmp_show, + SIGNAL(scaleoffsetfactor_changed(float, float, bool)), + ysliceshower, SLOT(set_scale(float, float, bool))); + QObject::disconnect(work_show, + SIGNAL(scaleoffsetfactor_changed(float, float, bool)), + ysliceshower, SLOT(set_scale(float, float, bool))); QObject::disconnect(ysliceshower, SIGNAL(slice_changed(int)), this, - SLOT(yshower_slicechanged())); - QObject::disconnect(zoom_widget, SIGNAL(set_zoom(double)), - ysliceshower, SLOT(set_zoom(double))); + SLOT(yshower_slicechanged())); + QObject::disconnect(zoom_widget, SIGNAL(set_zoom(double)), ysliceshower, + SLOT(set_zoom(double))); QObject::disconnect(ysliceshower, SIGNAL(hasbeenclosed()), this, - SLOT(yslice_closed())); + SLOT(yslice_closed())); delete ysliceshower; } if (SV3D != NULL) { SV3D->close(); QObject::disconnect(SV3D, SIGNAL(hasbeenclosed()), this, - SLOT(SV3D_closed())); + SLOT(SV3D_closed())); delete SV3D; } if (SV3Dbmp != NULL) { SV3Dbmp->close(); QObject::disconnect(SV3Dbmp, SIGNAL(hasbeenclosed()), this, - SLOT(SV3Dbmp_closed())); + SLOT(SV3Dbmp_closed())); delete SV3Dbmp; } if (VV3D != NULL) { VV3D->close(); QObject::disconnect(VV3D, SIGNAL(hasbeenclosed()), this, - SLOT(VV3D_closed())); + SLOT(VV3D_closed())); delete VV3D; } if (VV3Dbmp != NULL) { VV3Dbmp->close(); QObject::disconnect(VV3Dbmp, SIGNAL(hasbeenclosed()), this, - SLOT(VV3Dbmp_closed())); + SLOT(VV3Dbmp_closed())); delete VV3Dbmp; } @@ -2127,9 +1987,9 @@ bool MainWindow::maybeSafe() if (modified()) { int ret = QMessageBox::warning( - this, "iSeg", "Do you want to save your changes?", - QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, - QMessageBox::Cancel | QMessageBox::Escape); + this, "iSeg", "Do you want to save your changes?", + QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, + QMessageBox::Cancel | QMessageBox::Escape); if (ret == QMessageBox::Yes) { // Handle tissue hierarchy changes @@ -2138,7 +1998,7 @@ bool MainWindow::maybeSafe() return false; } if ((!m_editingmode && !m_saveprojfilename.isEmpty()) || - (m_editingmode && !m_S4Lcommunicationfilename.isEmpty())) + (m_editingmode && !m_S4Lcommunicationfilename.isEmpty())) { execute_saveproj(); } @@ -2163,32 +2023,32 @@ void MainWindow::provide_selected_tissue_BG() if (TissueInfos::GetTissueLocked(tissueTreeWidget->get_current_type())) { QMessageBox::warning(this, "iSeg", - "Error: Unable to get " + - tissueTreeWidget->get_current_name() + - " because it is locked.\nPlease, unlock it.", - QMessageBox::Ok | QMessageBox::Default); + "Error: Unable to get " + + tissueTreeWidget->get_current_name() + + " because it is locked.\nPlease, unlock it.", + QMessageBox::Ok | QMessageBox::Default); return; } OutlineCorrect_widget->Select_selected_tissue_BG( - tissueTreeWidget->get_current_name(), - tissueTreeWidget->get_current_type()); + tissueTreeWidget->get_current_name(), + tissueTreeWidget->get_current_type()); } void MainWindow::provide_selected_tissue_TS() { if (TissueInfos::GetTissueLocked(tissueTreeWidget->get_current_type())) { QMessageBox::warning(this, "iSeg", - "Error: Unable to get " + - tissueTreeWidget->get_current_name() + - " because it is locked.\nPlease, unlock it.", - QMessageBox::Ok | QMessageBox::Default); + "Error: Unable to get " + + tissueTreeWidget->get_current_name() + + " because it is locked.\nPlease, unlock it.", + QMessageBox::Ok | QMessageBox::Default); return; } OutlineCorrect_widget->Select_selected_tissue_TS( - tissueTreeWidget->get_current_name(), - tissueTreeWidget->get_current_type()); + tissueTreeWidget->get_current_name(), + tissueTreeWidget->get_current_type()); } void MainWindow::execute_bmp2work() @@ -2201,8 +2061,6 @@ void MainWindow::execute_bmp2work() handler3D->bmp2work(); emit end_datachange(this); - // work_show->update(); - return; } void MainWindow::execute_work2bmp() @@ -2215,8 +2073,6 @@ void MainWindow::execute_work2bmp() handler3D->work2bmp(); emit end_datachange(this); - // bmp_show->update(); - return; } void MainWindow::execute_swap_bmpwork() @@ -2230,9 +2086,6 @@ void MainWindow::execute_swap_bmpwork() handler3D->swap_bmpwork(); emit end_datachange(this); - // work_show->update(); - // bmp_show->update(); - return; } void MainWindow::execute_swap_bmpworkall() @@ -2246,9 +2099,6 @@ void MainWindow::execute_swap_bmpworkall() handler3D->swap_bmpworkall(); emit end_datachange(this); - // work_show->update(); - // bmp_show->update(); - return; } void MainWindow::execute_saveContours() @@ -2279,14 +2129,8 @@ void MainWindow::execute_loadbmp1() LB.move(QCursor::pos()); LB.exec(); - // work_show->update();//(bmphand->return_width(),bmphand->return_height()); - // bmp_show->update();//(bmphand->return_width(),bmphand->return_height()); - // bmp_show->workborder_changed(); - emit end_datachange(this, iseg::ClearUndo); - // hbox1->setFixedSize(bmphand->return_width()*2+vbox1->sizeHint().width(),bmphand->return_height()); - reset_brightnesscontrast(); } @@ -2316,44 +2160,40 @@ void MainWindow::execute_swapxy() if (!m_MultiDataset_widget->IsActive(i)) { std::string tempFileName = - "bmp_float_eds_" + std::to_string(i) + ".raw"; + "bmp_float_eds_" + std::to_string(i) + ".raw"; str1 = QDir::temp().absFilePath(QString(tempFileName.c_str())); if (SlicesHandler::SaveRaw_xy_swapped( - str1.ascii(), m_MultiDataset_widget->GetBmpData(i), w, - h, nrslices) != 0) + str1.ascii(), m_MultiDataset_widget->GetBmpData(i), w, h, + nrslices) != 0) ok = false; tempFileName = "work_float_eds_" + std::to_string(i) + ".raw"; str1 = QDir::temp().absFilePath(QString(tempFileName.c_str())); if (SlicesHandler::SaveRaw_xy_swapped( - str1.ascii(), m_MultiDataset_widget->GetWorkingData(i), - w, h, nrslices) != 0) + str1.ascii(), m_MultiDataset_widget->GetWorkingData(i), w, h, + nrslices) != 0) ok = false; if (ok) { - tempFileName = - "work_float_eds_" + std::to_string(i) + ".raw"; - str1 = - QDir::temp().absFilePath(QString(tempFileName.c_str())); + tempFileName = "work_float_eds_" + std::to_string(i) + ".raw"; + str1 = QDir::temp().absFilePath(QString(tempFileName.c_str())); str1 = QDir::temp().absFilePath(QString("work_float.raw")); m_MultiDataset_widget->SetWorkingData( - i, SlicesHandler::LoadRawFloat( - str1.ascii(), handler3D->return_startslice(), - handler3D->return_endslice(), 0, w * h)); + i, SlicesHandler::LoadRawFloat( + str1.ascii(), handler3D->return_startslice(), + handler3D->return_endslice(), 0, w * h)); } if (ok) { - tempFileName = - "bmp_float_eds_" + std::to_string(i) + ".raw"; - str1 = - QDir::temp().absFilePath(QString(tempFileName.c_str())); + tempFileName = "bmp_float_eds_" + std::to_string(i) + ".raw"; + str1 = QDir::temp().absFilePath(QString(tempFileName.c_str())); str1 = QDir::temp().absFilePath(QString("bmp_float.raw")); m_MultiDataset_widget->SetBmpData( - i, SlicesHandler::LoadRawFloat( - str1.ascii(), handler3D->return_startslice(), - handler3D->return_endslice(), 0, w * h)); + i, SlicesHandler::LoadRawFloat( + str1.ascii(), handler3D->return_startslice(), + handler3D->return_endslice(), 0, w * h)); } } } @@ -2396,41 +2236,38 @@ void MainWindow::execute_swapxz() // Swap all but the active one if (!m_MultiDataset_widget->IsActive(i)) { - std::string tempFileName = - "bmp_float_" + std::to_string(i) + ".raw"; + std::string tempFileName = "bmp_float_" + std::to_string(i) + ".raw"; str1 = QDir::temp().absFilePath(QString(tempFileName.c_str())); if (SlicesHandler::SaveRaw_xz_swapped( - str1.ascii(), m_MultiDataset_widget->GetBmpData(i), w, - h, nrslices) != 0) + str1.ascii(), m_MultiDataset_widget->GetBmpData(i), w, h, + nrslices) != 0) ok = false; tempFileName = "work_float_" + std::to_string(i) + ".raw"; str1 = QDir::temp().absFilePath(QString(tempFileName.c_str())); if (SlicesHandler::SaveRaw_xz_swapped( - str1.ascii(), m_MultiDataset_widget->GetWorkingData(i), - w, h, nrslices) != 0) + str1.ascii(), m_MultiDataset_widget->GetWorkingData(i), w, h, + nrslices) != 0) ok = false; if (ok) { tempFileName = "work_float_" + std::to_string(i) + ".raw"; - str1 = - QDir::temp().absFilePath(QString(tempFileName.c_str())); + str1 = QDir::temp().absFilePath(QString(tempFileName.c_str())); m_MultiDataset_widget->SetWorkingData( - i, SlicesHandler::LoadRawFloat( - str1.ascii(), handler3D->return_startslice(), - handler3D->return_endslice(), 0, w * h)); + i, SlicesHandler::LoadRawFloat( + str1.ascii(), handler3D->return_startslice(), + handler3D->return_endslice(), 0, w * h)); } if (ok) { tempFileName = "bmp_float_" + std::to_string(i) + ".raw"; - str1 = - QDir::temp().absFilePath(QString(tempFileName.c_str())); + str1 = QDir::temp().absFilePath(QString(tempFileName.c_str())); m_MultiDataset_widget->SetBmpData( - i, SlicesHandler::LoadRawFloat( - str1.ascii(), handler3D->return_startslice(), - handler3D->return_endslice(), 0, w * h)); + i, SlicesHandler::LoadRawFloat( + str1.ascii(), handler3D->return_startslice(), + handler3D->return_endslice(), 0, w * h)); } } } @@ -2477,41 +2314,38 @@ void MainWindow::execute_swapyz() // Swap all but the active one if (!m_MultiDataset_widget->IsActive(i)) { - std::string tempFileName = - "bmp_float_" + std::to_string(i) + ".raw"; + std::string tempFileName = "bmp_float_" + std::to_string(i) + ".raw"; str1 = QDir::temp().absFilePath(QString(tempFileName.c_str())); if (SlicesHandler::SaveRaw_yz_swapped( - str1.ascii(), m_MultiDataset_widget->GetBmpData(i), w, - h, nrslices) != 0) + str1.ascii(), m_MultiDataset_widget->GetBmpData(i), w, h, + nrslices) != 0) ok = false; tempFileName = "work_float_" + std::to_string(i) + ".raw"; str1 = QDir::temp().absFilePath(QString(tempFileName.c_str())); if (SlicesHandler::SaveRaw_yz_swapped( - str1.ascii(), m_MultiDataset_widget->GetWorkingData(i), - w, h, nrslices) != 0) + str1.ascii(), m_MultiDataset_widget->GetWorkingData(i), w, h, + nrslices) != 0) ok = false; if (ok) { tempFileName = "work_float_" + std::to_string(i) + ".raw"; - str1 = - QDir::temp().absFilePath(QString(tempFileName.c_str())); + str1 = QDir::temp().absFilePath(QString(tempFileName.c_str())); m_MultiDataset_widget->SetWorkingData( - i, SlicesHandler::LoadRawFloat( - str1.ascii(), handler3D->return_startslice(), - handler3D->return_endslice(), 0, w * h)); + i, SlicesHandler::LoadRawFloat( + str1.ascii(), handler3D->return_startslice(), + handler3D->return_endslice(), 0, w * h)); } if (ok) { tempFileName = "bmp_float_" + std::to_string(i) + ".raw"; - str1 = - QDir::temp().absFilePath(QString(tempFileName.c_str())); + str1 = QDir::temp().absFilePath(QString(tempFileName.c_str())); m_MultiDataset_widget->SetBmpData( - i, SlicesHandler::LoadRawFloat( - str1.ascii(), handler3D->return_startslice(), - handler3D->return_endslice(), 0, w * h)); + i, SlicesHandler::LoadRawFloat( + str1.ascii(), handler3D->return_startslice(), + handler3D->return_endslice(), 0, w * h)); } } } @@ -2541,8 +2375,8 @@ void MainWindow::execute_resize(int resizetype) dataSelection.tissues = true; emit begin_datachange(dataSelection, this, false); - ResizeDialog RD(handler3D, - static_cast(resizetype), this); + ResizeDialog RD(handler3D, static_cast(resizetype), + this); RD.move(QCursor::pos()); if (!RD.exec()) { @@ -2561,22 +2395,22 @@ void MainWindow::execute_resize(int resizetype) bool ok = true; str1 = QDir::temp().absFilePath(QString("bmp_float.raw")); if (handler3D->SaveRaw_resized(str1.ascii(), dxm, dxp, dym, dyp, dzm, dzp, - false) != 0) + false) != 0) ok = false; str1 = QDir::temp().absFilePath(QString("work_float.raw")); if (handler3D->SaveRaw_resized(str1.ascii(), dxm, dxp, dym, dyp, dzm, dzp, - true) != 0) + true) != 0) ok = false; str1 = QDir::temp().absFilePath(QString("tissues.raw")); if (handler3D->SaveTissuesRaw_resized(str1.ascii(), dxm, dxp, dym, dyp, dzm, - dzp) != 0) + dzp) != 0) ok = false; if (ok) { str1 = QDir::temp().absFilePath(QString("work_float.raw")); - if (handler3D->ReadRawFloat(str1.ascii(), w + dxm + dxp, h + dym + dyp, - 0, nrslices + dzm + dzp) != 1) + if (handler3D->ReadRawFloat(str1.ascii(), w + dxm + dxp, h + dym + dyp, 0, + nrslices + dzm + dzp) != 1) ok = false; } if (ok) @@ -2588,8 +2422,8 @@ void MainWindow::execute_resize(int resizetype) if (ok) { str1 = QDir::temp().absFilePath(QString("tissues.raw")); - if (handler3D->ReloadRawTissues(str1.ascii(), - sizeof(tissues_size_t) * 8, 0) != 1) + if (handler3D->ReloadRawTissues(str1.ascii(), sizeof(tissues_size_t) * 8, + 0) != 1) ok = false; } @@ -2644,7 +2478,7 @@ void MainWindow::sl_brightnessbmp_moved(int i) // Update line edit le_brightnessbmp_val->setText( - QString("%1").arg(sl_brightnessbmp->value() - 50, 3)); + QString("%1").arg(sl_brightnessbmp->value() - 50, 3)); // Update display update_brightnesscontrast(true); @@ -2656,7 +2490,7 @@ void MainWindow::sl_brightnesswork_moved(int i) // Update line edit le_brightnesswork_val->setText( - QString("%1").arg(sl_brightnesswork->value() - 50, 3)); + QString("%1").arg(sl_brightnesswork->value() - 50, 3)); // Update display update_brightnesscontrast(false); @@ -2666,14 +2500,14 @@ void MainWindow::le_contrastbmp_val_edited() { // Clamp to range and round to precision float contrast = - max(0.01f, min(le_contrastbmp_val->text().toFloat(), 100.0f)); + max(0.01f, min(le_contrastbmp_val->text().toFloat(), 100.0f)); le_contrastbmp_val->setText(QString("%1").arg(contrast, 6, 'f', 2)); // Update slider int sliderValue = std::floor( - 100.0f * (std::log10(le_contrastbmp_val->text().toFloat()) + 2.0f) / - 4.0f + - 0.5f); + 100.0f * (std::log10(le_contrastbmp_val->text().toFloat()) + 2.0f) / + 4.0f + + 0.5f); sl_contrastbmp->setValue(sliderValue); // Update display @@ -2684,14 +2518,14 @@ void MainWindow::le_contrastwork_val_edited() { // Clamp to range and round to precision float contrast = - max(0.01f, min(le_contrastwork_val->text().toFloat(), 100.0f)); + max(0.01f, min(le_contrastwork_val->text().toFloat(), 100.0f)); le_contrastwork_val->setText(QString("%1").arg(contrast, 6, 'f', 2)); // Update slider int sliderValue = std::floor( - 100.0f * (std::log10(le_contrastwork_val->text().toFloat()) + 2.0f) / - 4.0f + - 0.5f); + 100.0f * (std::log10(le_contrastwork_val->text().toFloat()) + 2.0f) / + 4.0f + + 0.5f); sl_contrastwork->setValue(sliderValue); // Update display @@ -2702,8 +2536,8 @@ void MainWindow::le_brightnessbmp_val_edited() { // Clamp to range and round to precision int brightness = (int)max( - -50.0f, - min(std::floor(le_brightnessbmp_val->text().toFloat() + 0.5f), 50.0f)); + -50.0f, + min(std::floor(le_brightnessbmp_val->text().toFloat() + 0.5f), 50.0f)); le_brightnessbmp_val->setText(QString("%1").arg(brightness, 3)); // Update slider @@ -2717,8 +2551,8 @@ void MainWindow::le_brightnesswork_val_edited() { // Clamp to range and round to precision int brightness = (int)max( - -50.0f, - min(std::floor(le_brightnesswork_val->text().toFloat() + 0.5f), 50.0f)); + -50.0f, + min(std::floor(le_brightnesswork_val->text().toFloat() + 0.5f), 50.0f)); le_brightnesswork_val->setText(QString("%1").arg(brightness, 3)); // Update slider @@ -2755,8 +2589,7 @@ void MainWindow::update_brightnesscontrast(bool bmporwork, bool paint) { // Get values from line edits float contrast = le_contrastbmp_val->text().toFloat(); - float brightness = - (le_brightnessbmp_val->text().toFloat() + 50.0f) * 0.01f; + float brightness = (le_brightnessbmp_val->text().toFloat() + 50.0f) * 0.01f; // Update bmp shower bmp_show->set_brightnesscontrast(brightness, contrast, paint); @@ -2766,7 +2599,7 @@ void MainWindow::update_brightnesscontrast(bool bmporwork, bool paint) // Get values from sliders float contrast = le_contrastwork_val->text().toFloat(); float brightness = - (le_brightnesswork_val->text().toFloat() + 50.0f) * 0.01f; + (le_brightnesswork_val->text().toFloat() + 50.0f) * 0.01f; // Update work shower work_show->set_brightnesscontrast(brightness, contrast, paint); @@ -2794,10 +2627,10 @@ void MainWindow::execute_loadbmp() maybeSafe(); QStringList files = - Q3FileDialog::getOpenFileNames("Images (*.bmp)\n" - "All(*.*)", - QString::null, this, "open files dialog", - "Select one or more files to open"); + Q3FileDialog::getOpenFileNames("Images (*.bmp)\n" + "All(*.*)", + QString::null, this, "open files dialog", + "Select one or more files to open"); if (!files.empty()) { @@ -2865,10 +2698,10 @@ void MainWindow::execute_loadpng() maybeSafe(); QStringList files = - Q3FileDialog::getOpenFileNames("Images (*.png)\n" - "All(*.*)", - QString::null, this, "open files dialog", - "Select one or more files to open"); + Q3FileDialog::getOpenFileNames("Images (*.png)\n" + "All(*.*)", + QString::null, this, "open files dialog", + "Select one or more files to open"); if (!files.empty()) { @@ -2916,10 +2749,10 @@ void MainWindow::execute_loadjpg() maybeSafe(); QStringList files = - Q3FileDialog::getOpenFileNames("Images (*.jpg)\n" - "All(*.*)", - QString::null, this, "open files dialog", - "Select one or more files to open"); + Q3FileDialog::getOpenFileNames("Images (*.jpg)\n" + "All(*.*)", + QString::null, this, "open files dialog", + "Select one or more files to open"); if (!files.empty()) { @@ -2984,10 +2817,10 @@ void MainWindow::execute_loaddicom() maybeSafe(); QStringList files = - Q3FileDialog::getOpenFileNames("Images (*.dcm *.dicom)\n" - "All(*.*)", - QString::null, this, "open files dialog", - "Select one or more files to open"); + Q3FileDialog::getOpenFileNames("Images (*.dcm *.dicom)\n" + "All(*.*)", + QString::null, this, "open files dialog", + "Select one or more files to open"); if (!files.empty()) { @@ -3025,8 +2858,8 @@ void MainWindow::execute_loaddicom() void MainWindow::execute_reloaddicom() { QStringList files = Q3FileDialog::getOpenFileNames( - "Images (*.dcm *.dicom)", QString::null, this, "open files dialog", - "Select one or more files to open"); + "Images (*.dcm *.dicom)", QString::null, this, "open files dialog", + "Select one or more files to open"); if (!files.empty()) { @@ -3099,10 +2932,10 @@ void MainWindow::execute_loadmhd() emit begin_datachange(dataSelection, this, false); QString loadfilename = - Q3FileDialog::getOpenFileName(QString::null, - "Metaheader (*.mhd *.mha)\n" - "All(*.*)", - this); + Q3FileDialog::getOpenFileName(QString::null, + "Metaheader (*.mhd *.mha)\n" + "All(*.*)", + this); if (!loadfilename.isEmpty()) { handler3D->ReadImage(loadfilename.ascii()); @@ -3130,9 +2963,9 @@ void MainWindow::execute_loadvtk() bool res = true; QString loadfilename = Q3FileDialog::getOpenFileName(QString::null, - "VTK (*.vti *.vtk)\n" - "All(*.*)", - this); + "VTK (*.vti *.vtk)\n" + "All(*.*)", + this); if (!loadfilename.isEmpty()) { res = handler3D->ReadImage(loadfilename.ascii()); @@ -3148,9 +2981,9 @@ void MainWindow::execute_loadvtk() if (!res) { - QMessageBox::warning( - this, "iSeg", "Error: Could not load file\n" + loadfilename + "\n", - QMessageBox::Ok | QMessageBox::Default); + QMessageBox::warning(this, "iSeg", + "Error: Could not load file\n" + loadfilename + "\n", + QMessageBox::Ok | QMessageBox::Default); } } @@ -3166,10 +2999,10 @@ void MainWindow::execute_loadnifti() emit begin_datachange(dataSelection, this, false); QString loadfilename = - Q3FileDialog::getOpenFileName(QString::null, - "NIFTI (*.nii *.hdr *.img *.nii.gz)\n" - "All(*.*)", - this); + Q3FileDialog::getOpenFileName(QString::null, + "NIFTI (*.nii *.hdr *.img *.nii.gz)\n" + "All(*.*)", + this); if (!loadfilename.isEmpty()) { handler3D->ReadImage(loadfilename.ascii()); @@ -3196,9 +3029,9 @@ void MainWindow::execute_loadavw() emit begin_datachange(dataSelection, this, false); QString loadfilename = Q3FileDialog::getOpenFileName(QString::null, - "AnalzyeAVW (*.avw)\n" - "All(*.*)", - this); + "AnalzyeAVW (*.avw)\n" + "All(*.*)", + this); if (!loadfilename.isEmpty()) { handler3D->ReadAvw(loadfilename.ascii()); @@ -3216,14 +3049,14 @@ void MainWindow::execute_loadavw() void MainWindow::execute_reloadbmp() { QStringList files = - Q3FileDialog::getOpenFileNames("Images (*.bmp)\n" - "All(*.*)", - QString::null, this, "open files dialog", - "Select one or more files to open"); + Q3FileDialog::getOpenFileNames("Images (*.bmp)\n" + "All(*.*)", + QString::null, this, "open files dialog", + "Select one or more files to open"); if ((unsigned short)files.size() == handler3D->return_nrslices() || - (unsigned short)files.size() == - (handler3D->return_endslice() - handler3D->return_startslice())) + (unsigned short)files.size() == + (handler3D->return_endslice() - handler3D->return_startslice())) { sort(files.begin(), files.end()); @@ -3283,8 +3116,8 @@ void MainWindow::execute_reloadbmp() if (!files.empty()) { QMessageBox::information( - this, "Segm. Tool", - "You have to select the same number of slices.\n"); + this, "Segm. Tool", + "You have to select the same number of slices.\n"); } } @@ -3324,13 +3157,12 @@ void MainWindow::execute_reloadavw() emit begin_datachange(dataSelection, this, false); QString loadfilename = Q3FileDialog::getOpenFileName(QString::null, - "AnalzyeAVW (*.avw)\n" - "All(*.*)", - this); + "AnalzyeAVW (*.avw)\n" + "All(*.*)", + this); if (!loadfilename.isEmpty()) { - handler3D->ReloadAVW(loadfilename.ascii(), - handler3D->return_startslice()); + handler3D->ReloadAVW(loadfilename.ascii(), handler3D->return_startslice()); reset_brightnesscontrast(); } emit end_datachange(this, iseg::ClearUndo); @@ -3348,14 +3180,14 @@ void MainWindow::execute_reloadmhd() emit begin_datachange(dataSelection, this, false); QString loadfilename = - Q3FileDialog::getOpenFileName(QString::null, - "Metaheader (*.mhd *.mha)\n" - "All(*.*)", - this); + Q3FileDialog::getOpenFileName(QString::null, + "Metaheader (*.mhd *.mha)\n" + "All(*.*)", + this); if (!loadfilename.isEmpty()) { handler3D->ReloadImage(loadfilename.ascii(), - handler3D->return_startslice()); + handler3D->return_startslice()); reset_brightnesscontrast(); } emit end_datachange(this, iseg::ClearUndo); @@ -3373,13 +3205,13 @@ void MainWindow::execute_reloadvtk() emit begin_datachange(dataSelection, this, false); QString loadfilename = Q3FileDialog::getOpenFileName(QString::null, - "VTK (*.vti *.vtk)\n" - "All(*.*)", - this); + "VTK (*.vti *.vtk)\n" + "All(*.*)", + this); if (!loadfilename.isEmpty()) { handler3D->ReloadImage(loadfilename.ascii(), - handler3D->return_startslice()); + handler3D->return_startslice()); reset_brightnesscontrast(); } emit end_datachange(this, iseg::ClearUndo); @@ -3397,15 +3229,15 @@ void MainWindow::execute_reloadnifti() emit begin_datachange(dataSelection, this, false); QString loadfilename = - Q3FileDialog::getOpenFileName(QString::null, - "NIFTI (*.nii *.hdr *.img *.nii.gz)\n" - "All(*.*)", - this); + Q3FileDialog::getOpenFileName(QString::null, + "NIFTI (*.nii *.hdr *.img *.nii.gz)\n" + "All(*.*)", + this); if (!loadfilename.isEmpty()) { handler3D->ReloadImage( - loadfilename.ascii(), - handler3D->return_startslice()); // TODO: handle failure + loadfilename.ascii(), + handler3D->return_startslice()); // TODO: handle failure reset_brightnesscontrast(); } emit end_datachange(this, iseg::ClearUndo); @@ -3413,109 +3245,22 @@ void MainWindow::execute_reloadnifti() return; } -//void MainWindow::execute_loadrtstruct() -//{ -// QString loadfilename = Q3FileDialog::getOpenFileName(QString::null, "RTstruct (*.dcm)\n" "All(*.*)", this);//, filename); -// -// if(loadfilename.isEmpty()) return; -// -// gdcmvtk_rtstruct::tissuevec tissues; -// tissues.clear(); -// -// gdcmvtk_rtstruct::RequestData_RTStructureSetStorage(loadfilename.ascii() , tissues); -// -// bool *mask=new bool[handler3D->return_area()]; -// -// if(mask==0) return; -// -// bool undoactive=false; -// if(handler3D->return_undo3D()&&handler3D->start_undoall(4)){ -// undoactive=true; -// } else { -// do_clearundo(); -// } -// -// tissues_size_t tissuenr; -// std::string namedummy=std::string(""); -// for(gdcmvtk_rtstruct::tissuevec::iterator it=tissues.begin();it!=tissues.end();it++) { -// bool caninsert=true; -// if((*it)->name!=namedummy) { -// for(tissuenr=0;tissuenrname!=tissuenames[tissuenr].toStdString();tissuenr++) {} -// if(tissuenr==(tissues_size_t)tissuenames.size()) { -// QString name1=QString((*it)->name.c_str()); -// if(tissuenrcolor[0]; -// tissuecolor[tissuecount][1]=(*it)->color[1]; -// tissuecolor[tissuecount][2]=(*it)->color[2]; -// QPixmap abc(10,10); -// abc.fill(QColor((int)(255*(*it)->color[0]),(int)(255*(*it)->color[1]),(int)(255*(*it)->color[2]))); -// tissueTreeWidget->insertItem(abc,name1); -// } else caninsert=false; -// } -// tissuenr++; -// } -// if(caninsert) { -// Pair p; -// p=handler3D->get_pixelsize(); -// float thick=handler3D->get_slicethickness(); -// float disp[3]; -// handler3D->get_displacement(disp); -// size_t pospoints=0; -// size_t posoutlines=0; -// std::vector points; -// bool clockwisefill=false; -// while(posoutlines<(*it)->outlinelength.size()) { -// points.clear(); -// unsigned int *nrpoints=&((*it)->outlinelength[posoutlines]); -// float zcoord=(*it)->points[pospoints+2]; -// points.push_back(&((*it)->points[pospoints])); -// pospoints+=(*it)->outlinelength[posoutlines]*3; -// posoutlines++; -// while(posoutlines<(*it)->outlinelength.size()&&zcoord==(*it)->points[pospoints+2]) { -// points.push_back(&((*it)->points[pospoints])); -// pospoints+=(*it)->outlinelength[posoutlines]*3; -// posoutlines++; -// } -// int slicenr=handler3D->return_nrslices()-floor((zcoord-disp[2])/thick)-1; -// if(slicenr>=handler3D->return_startslice()&&slicenrreturn_endslice()) { -// fillcontours::fill_contour(mask, handler3D->return_width(), handler3D->return_height(), disp[0], disp[1], p.high, p.low, &(points[0]), nrpoints, points.size(), clockwisefill); -// handler3D->add2tissue(tissuenr,mask,(unsigned short)slicenr,true); -// } -// } -// } -// } -// -// if(undoactive){ -// do_undostepdone(); -// } -// -// tissuenr_changed(tissueTreeWidget->get_current_type()); -// emit tissues_changed(); -// -// delete[] mask; -//} - void MainWindow::execute_loadsurface() { maybeSafe(); bool ok = true; QString loadfilename = Q3FileDialog::getOpenFileName(QString::null, - "STL (*.stl)\n" - "All(*.*)", - this); + "STL (*.stl)\n" + "All(*.*)", + this); if (!loadfilename.isEmpty()) { QMessageBox msgBox; msgBox.setWindowTitle("Import Surface"); - msgBox.setText( - "What would you like to do what with the imported surface?"); + msgBox.setText("What would you like to do what with the imported surface?"); msgBox.addButton("Overwrite", QMessageBox::YesRole); //==0 - msgBox.addButton("Add", QMessageBox::NoRole); //==1 + msgBox.addButton("Add", QMessageBox::NoRole); //==1 msgBox.addButton("Cancel", QMessageBox::RejectRole); //==2 int overwrite = msgBox.exec(); @@ -3530,8 +3275,8 @@ void MainWindow::execute_loadsurface() if (!ok) { QMessageBox::warning(this, "iSeg", - "Error: Surface does not overlap with image", - QMessageBox::Ok | QMessageBox::Default); + "Error: Surface does not overlap with image", + QMessageBox::Ok | QMessageBox::Default); } } @@ -3539,9 +3284,9 @@ void MainWindow::execute_loadrtstruct() { #ifndef NORTSTRUCTSUPPORT QString loadfilename = Q3FileDialog::getOpenFileName(QString::null, - "RTstruct (*.dcm)\n" - "All(*.*)", - this); //, filename); + "RTstruct (*.dcm)\n" + "All(*.*)", + this); //, filename); if (loadfilename.isEmpty()) { @@ -3551,12 +3296,12 @@ void MainWindow::execute_loadrtstruct() RadiotherapyStructureSetImporter RI(loadfilename, handler3D, this); QObject::connect( - &RI, SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), - this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); - QObject::connect( - &RI, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, - SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); + &RI, SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), + this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + QObject::connect(&RI, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), + this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); RI.move(QCursor::pos()); RI.exec(); @@ -3565,12 +3310,12 @@ void MainWindow::execute_loadrtstruct() tissuenr_changed(tissueTreeWidget->get_current_type() - 1); QObject::disconnect( - &RI, SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), - this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + &RI, SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), + this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); QObject::disconnect( - &RI, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, - SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); + &RI, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); reset_brightnesscontrast(); #endif @@ -3590,9 +3335,9 @@ void MainWindow::execute_loadrtdose() emit begin_datachange(dataSelection, this, false); QString loadfilename = Q3FileDialog::getOpenFileName(QString::null, - "RTdose (*.dcm)\n" - "All(*.*)", - this); + "RTdose (*.dcm)\n" + "All(*.*)", + this); if (!loadfilename.isEmpty()) { handler3D->ReadRTdose(loadfilename.ascii()); @@ -3619,14 +3364,14 @@ void MainWindow::execute_reloadrtdose() emit begin_datachange(dataSelection, this, false); QString loadfilename = Q3FileDialog::getOpenFileName(QString::null, - "RTdose (*.dcm)\n" - "All(*.*)", - this); + "RTdose (*.dcm)\n" + "All(*.*)", + this); if (!loadfilename.isEmpty()) { handler3D->ReloadRTdose( - loadfilename.ascii(), - handler3D->return_startslice()); // TODO: handle failure + loadfilename.ascii(), + handler3D->return_startslice()); // TODO: handle failure reset_brightnesscontrast(); } emit end_datachange(this, iseg::ClearUndo); @@ -3638,9 +3383,9 @@ void MainWindow::execute_reloadrtdose() void MainWindow::execute_loads4llivelink() { QString loadfilename = Q3FileDialog::getOpenFileName(QString::null, - "S4L Link (*.h5)\n" - "All(*.*)", - this); + "S4L Link (*.h5)\n" + "All(*.*)", + this); if (!loadfilename.isEmpty()) { loadS4Llink(loadfilename); @@ -3698,12 +3443,11 @@ void MainWindow::execute_saveprojas() emit begin_dataexport(dataSelection, this); QString savefilename = Q3FileDialog::getSaveFileName( - QString::null, "Projects (*.prj)\n", this); //, filename); + QString::null, "Projects (*.prj)\n", this); //, filename); if (!savefilename.isEmpty()) { - if (savefilename.length() <= 4 || - !savefilename.endsWith(QString(".prj"))) + if (savefilename.length() <= 4 || !savefilename.endsWith(QString(".prj"))) savefilename.append(".prj"); m_saveprojfilename = savefilename; @@ -3712,9 +3456,9 @@ void MainWindow::execute_saveprojas() QString tempFileName = QString(savefilename); int afterDot = tempFileName.lastIndexOf('.'); if (afterDot != 0) - tempFileName = tempFileName.remove(afterDot, tempFileName.length() - - afterDot) + - "Temp.prj"; + tempFileName = + tempFileName.remove(afterDot, tempFileName.length() - afterDot) + + "Temp.prj"; else tempFileName = tempFileName + "Temp.prj"; @@ -3730,15 +3474,15 @@ void MainWindow::execute_saveprojas() int numTasks = 3; QProgressDialog progress("Save in progress...", "Cancel", 0, numTasks, - this); + this); progress.show(); QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); progress.setWindowModality(Qt::WindowModal); progress.setModal(true); progress.setValue(1); - setCaption(QString(" iSeg ") + QString(xstr(ISEG_VERSION)) + QString(" - ") + - TruncateFileName(savefilename)); + setCaption(QString(" iSeg ") + QString(xstr(ISEG_VERSION)) + + QString(" - ") + TruncateFileName(savefilename)); //m_saveprojfilename = tempFileName; //AddLoadProj(tempFileName); @@ -3748,7 +3492,7 @@ void MainWindow::execute_saveprojas() unsigned short saveProjVersion = 12; fp = TissueInfos::SaveTissues(fp, saveProjVersion); unsigned short combinedVersion = - (unsigned short)iseg::CombineTissuesVersion(saveProjVersion, 1); + (unsigned short)iseg::CombineTissuesVersion(saveProjVersion, 1); fwrite(&combinedVersion, 1, sizeof(unsigned short), fp); /*for(size_t i=0;iSaveParams(fp,saveProjVersion); @@ -3779,17 +3523,17 @@ void MainWindow::execute_saveprojas() if (QFile::exists(sourceFileNameWithoutExtension + ".xmf")) QFile::remove(sourceFileNameWithoutExtension + ".xmf"); QFile::rename(tempFileNameWithoutExtension + ".xmf", - sourceFileNameWithoutExtension + ".xmf"); + sourceFileNameWithoutExtension + ".xmf"); if (QFile::exists(sourceFileNameWithoutExtension + ".prj")) QFile::remove(sourceFileNameWithoutExtension + ".prj"); QFile::rename(tempFileNameWithoutExtension + ".prj", - sourceFileNameWithoutExtension + ".prj"); + sourceFileNameWithoutExtension + ".prj"); if (QFile::exists(sourceFileNameWithoutExtension + ".h5")) QFile::remove(sourceFileNameWithoutExtension + ".h5"); QFile::rename(tempFileNameWithoutExtension + ".h5", - sourceFileNameWithoutExtension + ".h5"); + sourceFileNameWithoutExtension + ".h5"); progress.setValue(numTasks); } @@ -3806,12 +3550,11 @@ void MainWindow::execute_savecopyas() emit begin_dataexport(dataSelection, this); QString savefilename = Q3FileDialog::getSaveFileName( - QString::null, "Projects (*.prj)\n", this); //, filename); + QString::null, "Projects (*.prj)\n", this); //, filename); if (!savefilename.isEmpty()) { - if (savefilename.length() <= 4 || - !savefilename.endsWith(QString(".prj"))) + if (savefilename.length() <= 4 || !savefilename.endsWith(QString(".prj"))) savefilename.append(".prj"); FILE* fp = handler3D->SaveProject(savefilename.ascii(), "xmf"); @@ -3819,7 +3562,7 @@ void MainWindow::execute_savecopyas() unsigned short saveProjVersion = 12; fp = TissueInfos::SaveTissues(fp, saveProjVersion); unsigned short combinedVersion = - (unsigned short)iseg::CombineTissuesVersion(saveProjVersion, 1); + (unsigned short)iseg::CombineTissuesVersion(saveProjVersion, 1); fwrite(&combinedVersion, 1, sizeof(unsigned short), fp); /*for(size_t i=0;iSaveParams(fp,saveProjVersion); @@ -3855,7 +3598,7 @@ void MainWindow::SaveSettings() return; unsigned short saveProjVersion = 12; unsigned short combinedVersion = - (unsigned short)iseg::CombineTissuesVersion(saveProjVersion, 1); + (unsigned short)iseg::CombineTissuesVersion(saveProjVersion, 1); fwrite(&combinedVersion, 1, sizeof(unsigned short), fp); bool flag; flag = WidgetInterface::get_hideparams(); @@ -3901,18 +3644,16 @@ void MainWindow::SaveSettings() fclose(fp); - QSettings settings(QSettings::IniFormat, QSettings::UserScope, "ZMT", - "iSeg"); + QSettings settings(QSettings::IniFormat, QSettings::UserScope, "ZMT", "iSeg"); settings.beginGroup("MainWindow"); settings.setValue("geometry", saveGeometry()); settings.setValue("state", saveState()); settings.setValue("NumberOfUndoSteps", - this->handler3D->GetNumberOfUndoSteps()); + this->handler3D->GetNumberOfUndoSteps()); settings.setValue("NumberOfUndoArrays", - this->handler3D->GetNumberOfUndoArrays()); + this->handler3D->GetNumberOfUndoArrays()); settings.setValue("Compression", this->handler3D->GetCompression()); - settings.setValue("ContiguousMemory", - this->handler3D->GetContiguousMemory()); + settings.setValue("ContiguousMemory", this->handler3D->GetContiguousMemory()); settings.endGroup(); settings.sync(); } @@ -3934,7 +3675,7 @@ void MainWindow::LoadSettings(const char* loadfilename) } int loadProjVersion, tissuesVersion; iseg::ExtractTissuesVersion((int)combinedVersion, loadProjVersion, - tissuesVersion); + tissuesVersion); iseg::DataSelection dataSelection; dataSelection.allSlices = true; @@ -3995,7 +3736,7 @@ void MainWindow::LoadSettings(const char* loadfilename) fp = TissueInfos::LoadTissues(fp, tissuesVersion); const char* defaultTissuesFilename = - m_tmppath.absFilePath(QString("def_tissues.txt")); + m_tmppath.absFilePath(QString("def_tissues.txt")); FILE* fpTmp = fopen(defaultTissuesFilename, "r"); if (fpTmp != NULL || TissueInfos::GetTissueCount() <= 0) { @@ -4032,25 +3773,24 @@ void MainWindow::LoadSettings(const char* loadfilename) { cerr << "LoadSettings() : restoring values..." << endl; QSettings settings(QSettings::IniFormat, QSettings::UserScope, "ZMT", - "iSeg"); + "iSeg"); settings.beginGroup("MainWindow"); restoreGeometry(settings.value("geometry").toByteArray()); restoreState(settings.value("state").toByteArray()); this->handler3D->SetNumberOfUndoSteps( - settings.value("NumberOfUndoSteps", 50).toUInt()); - cerr << "NumberOfUndoSteps = " - << this->handler3D->GetNumberOfUndoSteps() << endl; + settings.value("NumberOfUndoSteps", 50).toUInt()); + cerr << "NumberOfUndoSteps = " << this->handler3D->GetNumberOfUndoSteps() + << endl; this->handler3D->SetNumberOfUndoArrays( - settings.value("NumberOfUndoArrays", 20).toUInt()); - cerr << "NumberOfUndoArrays = " - << this->handler3D->GetNumberOfUndoArrays() << endl; - this->handler3D->SetCompression( - settings.value("Compression", 0).toInt()); + settings.value("NumberOfUndoArrays", 20).toUInt()); + cerr << "NumberOfUndoArrays = " << this->handler3D->GetNumberOfUndoArrays() + << endl; + this->handler3D->SetCompression(settings.value("Compression", 0).toInt()); cerr << "Compression = " << this->handler3D->GetCompression() << endl; this->handler3D->SetContiguousMemory( - settings.value("ContiguousMemory", true).toBool()); + settings.value("ContiguousMemory", true).toBool()); cerr << "ContiguousMemory = " << this->handler3D->GetContiguousMemory() - << endl; + << endl; settings.endGroup(); if (this->handler3D->return_nrundo() == 0) @@ -4070,7 +3810,7 @@ void MainWindow::execute_saveactiveslicesas() emit begin_dataexport(dataSelection, this); QString savefilename = Q3FileDialog::getSaveFileName( - QString::null, "Projects (*.prj)\n", this); //, filename); + QString::null, "Projects (*.prj)\n", this); //, filename); if (savefilename.length() <= 4 || !savefilename.endsWith(QString(".prj"))) savefilename.append(".prj"); @@ -4082,7 +3822,7 @@ void MainWindow::execute_saveactiveslicesas() unsigned short saveProjVersion = 12; fp = TissueInfos::SaveTissues(fp, saveProjVersion); unsigned short combinedVersion = - (unsigned short)iseg::CombineTissuesVersion(saveProjVersion, 1); + (unsigned short)iseg::CombineTissuesVersion(saveProjVersion, 1); fwrite(&combinedVersion, 1, sizeof(unsigned short), fp); /*for(size_t i=0;iSaveParams(fp,saveProjVersion); @@ -4124,8 +3864,7 @@ void MainWindow::execute_saveproj() { if (!m_S4Lcommunicationfilename.isEmpty()) { - handler3D->SaveCommunicationFile( - m_S4Lcommunicationfilename.ascii()); + handler3D->SaveCommunicationFile(m_S4Lcommunicationfilename.ascii()); } } else @@ -4136,9 +3875,9 @@ void MainWindow::execute_saveproj() QString tempFileName = QString(m_saveprojfilename); int afterDot = tempFileName.lastIndexOf('.'); if (afterDot != 0) - tempFileName = tempFileName.remove( - afterDot, tempFileName.length() - afterDot) + - "Temp.prj"; + tempFileName = + tempFileName.remove(afterDot, tempFileName.length() - afterDot) + + "Temp.prj"; else tempFileName = tempFileName + "Temp.prj"; @@ -4147,8 +3886,7 @@ void MainWindow::execute_saveproj() QString sourceFileNameWithoutExtension; afterDot = m_saveprojfilename.lastIndexOf('.'); if (afterDot != -1) - sourceFileNameWithoutExtension = - m_saveprojfilename.mid(0, afterDot); + sourceFileNameWithoutExtension = m_saveprojfilename.mid(0, afterDot); QString tempFileNameWithoutExtension; afterDot = tempFileName.lastIndexOf('.'); @@ -4156,16 +3894,16 @@ void MainWindow::execute_saveproj() tempFileNameWithoutExtension = tempFileName.mid(0, afterDot); int numTasks = 3; - QProgressDialog progress("Save in progress...", "Cancel", 0, - numTasks, this); + QProgressDialog progress("Save in progress...", "Cancel", 0, numTasks, + this); progress.show(); QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); progress.setWindowModality(Qt::WindowModal); progress.setModal(true); progress.setValue(1); - setCaption(QString(" iSeg ") + QString(xstr(ISEG_VERSION)) + QString(" - ") + - TruncateFileName(m_saveprojfilename)); + setCaption(QString(" iSeg ") + QString(xstr(ISEG_VERSION)) + + QString(" - ") + TruncateFileName(m_saveprojfilename)); m_saveprojfilename = tempFileName; @@ -4175,7 +3913,7 @@ void MainWindow::execute_saveproj() unsigned short saveProjVersion = 12; fp = TissueInfos::SaveTissues(fp, saveProjVersion); unsigned short combinedVersion = - (unsigned short)iseg::CombineTissuesVersion(saveProjVersion, 1); + (unsigned short)iseg::CombineTissuesVersion(saveProjVersion, 1); fwrite(&combinedVersion, 1, sizeof(unsigned short), fp); /*for(size_t i=0;iSaveParams(fp,saveProjVersion); @@ -4205,17 +3943,16 @@ void MainWindow::execute_saveproj() QMessageBox mBox; mBox.setWindowTitle("Saving project"); - mBox.setText( - "The project you are trying to save is open somewhere else. " - "Please, close it before continuing and press OK or press " - "Cancel to stop saving process."); + mBox.setText("The project you are trying to save is open somewhere else. " + "Please, close it before continuing and press OK or press " + "Cancel to stop saving process."); mBox.addButton(QMessageBox::Ok); mBox.addButton(QMessageBox::Cancel); if (QFile::exists(sourceFileNameWithoutExtension + ".xmf")) { bool removeSuccess = - QFile::remove(sourceFileNameWithoutExtension + ".xmf"); + QFile::remove(sourceFileNameWithoutExtension + ".xmf"); while (!removeSuccess) { int ret = mBox.exec(); @@ -4223,16 +3960,16 @@ void MainWindow::execute_saveproj() return; removeSuccess = - QFile::remove(sourceFileNameWithoutExtension + ".xmf"); + QFile::remove(sourceFileNameWithoutExtension + ".xmf"); } } QFile::rename(tempFileNameWithoutExtension + ".xmf", - sourceFileNameWithoutExtension + ".xmf"); + sourceFileNameWithoutExtension + ".xmf"); if (QFile::exists(sourceFileNameWithoutExtension + ".prj")) { bool removeSuccess = - QFile::remove(sourceFileNameWithoutExtension + ".prj"); + QFile::remove(sourceFileNameWithoutExtension + ".prj"); while (!removeSuccess) { int ret = mBox.exec(); @@ -4240,28 +3977,27 @@ void MainWindow::execute_saveproj() return; removeSuccess = - QFile::remove(sourceFileNameWithoutExtension + ".prj"); + QFile::remove(sourceFileNameWithoutExtension + ".prj"); } } QFile::rename(tempFileNameWithoutExtension + ".prj", - sourceFileNameWithoutExtension + ".prj"); + sourceFileNameWithoutExtension + ".prj"); if (QFile::exists(sourceFileNameWithoutExtension + ".h5")) { bool removeSuccess = - QFile::remove(sourceFileNameWithoutExtension + ".h5"); + QFile::remove(sourceFileNameWithoutExtension + ".h5"); while (!removeSuccess) { int ret = mBox.exec(); if (ret == QMessageBox::Cancel) return; - removeSuccess = - QFile::remove(sourceFileNameWithoutExtension + ".h5"); + removeSuccess = QFile::remove(sourceFileNameWithoutExtension + ".h5"); } } QFile::rename(tempFileNameWithoutExtension + ".h5", - sourceFileNameWithoutExtension + ".h5"); + sourceFileNameWithoutExtension + ".h5"); m_saveprojfilename = sourceFileNameWithoutExtension + ".prj"; @@ -4301,8 +4037,8 @@ void MainWindow::loadproj(const QString& loadfilename) if (!loadfilename.isEmpty()) { m_saveprojfilename = loadfilename; - setCaption(QString(" iSeg ") + QString(xstr(ISEG_VERSION)) + QString(" - ") + - TruncateFileName(loadfilename)); + setCaption(QString(" iSeg ") + QString(xstr(ISEG_VERSION)) + + QString(" - ") + TruncateFileName(loadfilename)); AddLoadProj(m_saveprojfilename); int tissuesVersion = 0; fp = handler3D->LoadProject(loadfilename.ascii(), tissuesVersion); @@ -4330,7 +4066,7 @@ void MainWindow::loadproj(const QString& loadfilename) { int loadProjVersion, tissuesVersion; iseg::ExtractTissuesVersion((int)combinedVersion, loadProjVersion, - tissuesVersion); + tissuesVersion); /*for(size_t i=0;iLoadParams(fp,version); }*/ @@ -4354,10 +4090,9 @@ void MainWindow::loadproj(const QString& loadfilename) if (loadProjVersion >= 3) { fp = TissueInfos::LoadTissueLocks(fp); - tissues_size_t currTissueType = - tissueTreeWidget->get_current_type(); + tissues_size_t currTissueType = tissueTreeWidget->get_current_type(); cb_tissuelock->setChecked( - TissueInfos::GetTissueLocked(currTissueType + 1)); + TissueInfos::GetTissueLocked(currTissueType + 1)); tissueTreeWidget->update_tissue_icons(); tissueTreeWidget->update_folder_icons(); } @@ -4435,30 +4170,28 @@ void MainWindow::execute_mergeprojects() // Get save file name QString savefilename = - Q3FileDialog::getSaveFileName(QString::null, "Projects (*.prj)", this, - "iSeg", "Save merged project as"); + Q3FileDialog::getSaveFileName(QString::null, "Projects (*.prj)", this, + "iSeg", "Save merged project as"); if (savefilename.length() <= 4 || !savefilename.endsWith(QString(".prj"))) savefilename.append(".prj"); if (!savefilename.isEmpty() && mergefilenames.size() > 0) { - FILE* fp = - handler3D->MergeProjects(savefilename.ascii(), mergefilenames); + FILE* fp = handler3D->MergeProjects(savefilename.ascii(), mergefilenames); if (!fp) { - QMessageBox::warning( - this, "iSeg", - "Merge projects failed.\n\nPlease make sure that " - "all projects have the same xy extents\nand their " - "image data is contained in a .h5 and .xmf file.", - QMessageBox::Ok | QMessageBox::Default); + QMessageBox::warning(this, "iSeg", + "Merge projects failed.\n\nPlease make sure that " + "all projects have the same xy extents\nand their " + "image data is contained in a .h5 and .xmf file.", + QMessageBox::Ok | QMessageBox::Default); return; } fp = bitstack_widget->save_proj(fp); unsigned short saveProjVersion = 12; fp = TissueInfos::SaveTissues(fp, saveProjVersion); unsigned short combinedVersion = - (unsigned short)iseg::CombineTissuesVersion(saveProjVersion, 1); + (unsigned short)iseg::CombineTissuesVersion(saveProjVersion, 1); fwrite(&combinedVersion, 1, sizeof(unsigned short), fp); /*for(size_t i=0;iSaveParams(fp,saveProjVersion); @@ -4486,9 +4219,9 @@ void MainWindow::execute_mergeprojects() // Load merged project if (QMessageBox::question(this, "iSeg", - "Would you like to load the merged project?", - QMessageBox::Yes | QMessageBox::Default, - QMessageBox::No) == QMessageBox::Yes) + "Would you like to load the merged project?", + QMessageBox::Yes | QMessageBox::Default, + QMessageBox::No) == QMessageBox::Yes) { loadproj(savefilename); } @@ -4499,9 +4232,9 @@ void MainWindow::execute_mergeprojects() void MainWindow::execute_boneconnectivity() { boneConnectivityDialog = new CheckBoneConnectivityDialog( - handler3D, "Bone Connectivity", this, Qt::Window); + handler3D, "Bone Connectivity", this, Qt::Window); QObject::connect(boneConnectivityDialog, SIGNAL(slice_changed()), this, - SLOT(update_slice())); + SLOT(update_slice())); boneConnectivityDialog->show(); boneConnectivityDialog->raise(); @@ -4516,9 +4249,9 @@ void MainWindow::execute_loadproj() maybeSafe(); QString loadfilename = Q3FileDialog::getOpenFileName(QString::null, - "Projects (*.prj)\n" - "All(*.*)", - this); //, filename); + "Projects (*.prj)\n" + "All(*.*)", + this); //, filename); if (!loadfilename.isEmpty()) { @@ -4576,11 +4309,10 @@ void MainWindow::execute_loadproj4() void MainWindow::execute_loadatlas(int i) { - AtlasWidget* AW = - new AtlasWidget(m_atlasfilename.m_atlasdir - .absFilePath(m_atlasfilename.m_atlasfilename[i]) - .ascii(), - m_picpath); + AtlasWidget* AW = new AtlasWidget( + m_atlasfilename.m_atlasdir.absFilePath(m_atlasfilename.m_atlasfilename[i]) + .ascii(), + m_picpath); if (AW->isOK) { AW->show(); @@ -4707,7 +4439,7 @@ void MainWindow::execute_createatlas() emit begin_dataexport(dataSelection, this); QString savefilename = Q3FileDialog::getSaveFileName( - QString::null, "Atlas file (*.atl)", this); //, filename); + QString::null, "Atlas file (*.atl)", this); //, filename); if (savefilename.length() > 4 && !savefilename.endsWith(QString(".atl"))) savefilename.append(".atl"); @@ -4729,7 +4461,7 @@ void MainWindow::execute_reloadatlases() void MainWindow::execute_savetissues() { QString savefilename = Q3FileDialog::getSaveFileName( - QString::null, QString::null, this); //, filename); + QString::null, QString::null, this); //, filename); if (!savefilename.isEmpty()) { @@ -4741,7 +4473,7 @@ void MainWindow::execute_savetissues() void MainWindow::execute_exportsurfacegenerationtoolxml() { QString savefilename = Q3FileDialog::getSaveFileName( - QString::null, QString::null, this); //, filename); + QString::null, QString::null, this); //, filename); if (!savefilename.isEmpty()) { @@ -4756,7 +4488,7 @@ void MainWindow::execute_exportlabelfield() emit begin_dataexport(dataSelection, this); QString savefilename = Q3FileDialog::getSaveFileName( - QString::null, "AmiraMesh Ascii (*.am)", this); //, filename); + QString::null, "AmiraMesh Ascii (*.am)", this); //, filename); if (savefilename.length() > 4 && !savefilename.endsWith(QString(".am"))) savefilename.append(".am"); @@ -4778,7 +4510,7 @@ void MainWindow::execute_exportmat() emit begin_dataexport(dataSelection, this); QString savefilename = Q3FileDialog::getSaveFileName( - QString::null, "Matlab (*.mat)", this); //, filename); + QString::null, "Matlab (*.mat)", this); //, filename); if (savefilename.length() > 4 && !savefilename.endsWith(QString(".mat"))) savefilename.append(".mat"); @@ -4800,7 +4532,7 @@ void MainWindow::execute_exporthdf() emit begin_dataexport(dataSelection, this); QString savefilename = Q3FileDialog::getSaveFileName( - QString::null, "HDF (*.h5)", this); //, filename); + QString::null, "HDF (*.h5)", this); //, filename); if (savefilename.length() > 3 && !savefilename.endsWith(QString(".h5"))) savefilename.append(".h5"); @@ -4820,10 +4552,10 @@ void MainWindow::execute_exportvtkascii() emit begin_dataexport(dataSelection, this); QString savefilename = Q3FileDialog::getSaveFileName( - QString::null, "VTK Ascii (*.vti *.vtk)", this); //, filename); + QString::null, "VTK Ascii (*.vti *.vtk)", this); //, filename); if (savefilename.length() > 4 && !(savefilename.endsWith(QString(".vti")) || - savefilename.endsWith(QString(".vtk")))) + savefilename.endsWith(QString(".vtk")))) savefilename.append(".vti"); if (!savefilename.isEmpty()) @@ -4841,10 +4573,10 @@ void MainWindow::execute_exportvtkbinary() emit begin_dataexport(dataSelection, this); QString savefilename = Q3FileDialog::getSaveFileName( - QString::null, "VTK bin (*.vti *.vtk)", this); //, filename); + QString::null, "VTK bin (*.vti *.vtk)", this); //, filename); if (savefilename.length() > 4 && !(savefilename.endsWith(QString(".vti")) || - savefilename.endsWith(QString(".vtk")))) + savefilename.endsWith(QString(".vtk")))) savefilename.append(".vti"); if (!savefilename.isEmpty()) @@ -4862,7 +4594,7 @@ void MainWindow::execute_exportvtkcompressedascii() emit begin_dataexport(dataSelection, this); QString savefilename = Q3FileDialog::getSaveFileName( - QString::null, "VTK comp (*.vti)", this); //, filename); + QString::null, "VTK comp (*.vti)", this); //, filename); if (savefilename.length() > 4 && !savefilename.endsWith(QString(".vti"))) savefilename.append(".vti"); @@ -4882,7 +4614,7 @@ void MainWindow::execute_exportvtkcompressedbinary() emit begin_dataexport(dataSelection, this); QString savefilename = Q3FileDialog::getSaveFileName( - QString::null, "VTK comp (*.vti)", this); //, filename); + QString::null, "VTK comp (*.vti)", this); //, filename); if (savefilename.length() > 4 && !savefilename.endsWith(QString(".vti"))) savefilename.append(".vti"); @@ -4901,16 +4633,16 @@ void MainWindow::execute_exportxmlregionextent() dataSelection.tissues = true; emit begin_dataexport(dataSelection, this); - QString savefilename = Q3FileDialog::getSaveFileName( - QString::null, "XML extent (*.xml)", this); + QString savefilename = + Q3FileDialog::getSaveFileName(QString::null, "XML extent (*.xml)", this); if (savefilename.length() > 4 && !savefilename.endsWith(QString(".xml"))) savefilename.append(".xml"); QString relfilename = QString(""); if (!m_saveprojfilename.isEmpty()) - relfilename = m_saveprojfilename.right( - m_saveprojfilename.length() - m_saveprojfilename.findRev("/") - 1); + relfilename = m_saveprojfilename.right(m_saveprojfilename.length() - + m_saveprojfilename.findRev("/") - 1); if (!savefilename.isEmpty()) { @@ -4918,7 +4650,7 @@ void MainWindow::execute_exportxmlregionextent() handler3D->print_xmlregionextent(savefilename.ascii(), true); else handler3D->print_xmlregionextent(savefilename.ascii(), true, - relfilename.ascii()); + relfilename.ascii()); } emit end_dataexport(this); @@ -4930,15 +4662,15 @@ void MainWindow::execute_exporttissueindex() emit begin_dataexport(dataSelection, this); QString savefilename = Q3FileDialog::getSaveFileName( - QString::null, "tissue index (*.txt)", this); + QString::null, "tissue index (*.txt)", this); if (savefilename.length() > 4 && !savefilename.endsWith(QString(".txt"))) savefilename.append(".txt"); QString relfilename = QString(""); if (!m_saveprojfilename.isEmpty()) - relfilename = m_saveprojfilename.right( - m_saveprojfilename.length() - m_saveprojfilename.findRev("/") - 1); + relfilename = m_saveprojfilename.right(m_saveprojfilename.length() - + m_saveprojfilename.findRev("/") - 1); if (!savefilename.isEmpty()) { @@ -4946,7 +4678,7 @@ void MainWindow::execute_exporttissueindex() handler3D->print_tissueindex(savefilename.ascii(), true); else handler3D->print_tissueindex(savefilename.ascii(), true, - relfilename.ascii()); + relfilename.ascii()); } emit end_dataexport(this); @@ -4955,17 +4687,17 @@ void MainWindow::execute_exporttissueindex() void MainWindow::execute_loadtissues() { QString loadfilename = Q3FileDialog::getOpenFileName( - QString::null, QString::null, this); //, filename); + QString::null, QString::null, this); //, filename); if (!loadfilename.isEmpty()) { QMessageBox msgBox; msgBox.setText("Do you want to append the new tissues or to replace " - "the old tissues?"); + "the old tissues?"); QPushButton* appendButton = - msgBox.addButton(tr("Append"), QMessageBox::AcceptRole); + msgBox.addButton(tr("Append"), QMessageBox::AcceptRole); QPushButton* replaceButton = - msgBox.addButton(tr("Replace"), QMessageBox::AcceptRole); + msgBox.addButton(tr("Replace"), QMessageBox::AcceptRole); QPushButton* abortButton = msgBox.addButton(QMessageBox::Abort); msgBox.setIcon(QMessageBox::Question); @@ -4975,12 +4707,11 @@ void MainWindow::execute_loadtissues() if (msgBox.clickedButton() == appendButton) { TissueInfos::LoadTissuesReadable(loadfilename.ascii(), handler3D, - removeTissuesRange); + removeTissuesRange); int nr = tissueTreeWidget->get_current_type() - 1; tissueTreeWidget->update_tree_widget(); - tissues_size_t currTissueType = - tissueTreeWidget->get_current_type(); + tissues_size_t currTissueType = tissueTreeWidget->get_current_type(); if (nr != currTissueType - 1) { tissuenr_changed(currTissueType - 1); @@ -4988,25 +4719,23 @@ void MainWindow::execute_loadtissues() } else if (msgBox.clickedButton() == replaceButton) { - if (TissueInfos::LoadTissuesReadable(loadfilename.ascii(), - handler3D, removeTissuesRange)) + if (TissueInfos::LoadTissuesReadable(loadfilename.ascii(), handler3D, + removeTissuesRange)) { if (removeTissuesRange > 0) { #if 1 // Version: Ask user whether to delete tissues int ret = QMessageBox::question( - this, "iSeg", - "Some of the previously existing tissues are\nnot " - "contained in " - "the loaded tissue list.\n\nDo you want to delete " - "them?", - QMessageBox::Yes | QMessageBox::Default, - QMessageBox::No); + this, "iSeg", + "Some of the previously existing tissues are\nnot " + "contained in " + "the loaded tissue list.\n\nDo you want to delete " + "them?", + QMessageBox::Yes | QMessageBox::Default, QMessageBox::No); if (ret == QMessageBox::Yes) { std::set removeTissues; - for (tissues_size_t type = 1; - type <= removeTissuesRange; ++type) + for (tissues_size_t type = 1; type <= removeTissuesRange; ++type) { removeTissues.insert(type); } @@ -5019,8 +4748,7 @@ void MainWindow::execute_loadtissues() } #else std::set removeTissues; - for (tissues_size_t type = 1; type <= removeTissuesRange; - ++type) + for (tissues_size_t type = 1; type <= removeTissuesRange; ++type) { removeTissues.insert(type); } @@ -5045,7 +4773,7 @@ void MainWindow::execute_loadtissues() void MainWindow::execute_settissuesasdef() { TissueInfos::SaveDefaultTissueList( - m_tmppath.absFilePath(QString("def_tissues.txt"))); + m_tmppath.absFilePath(QString("def_tissues.txt"))); } void MainWindow::execute_removedeftissues() @@ -5075,7 +4803,8 @@ void MainWindow::execute_new() emit end_datachange(this, iseg::ClearUndo); m_saveprojfilename = QString(""); - setCaption(QString(" iSeg ") + QString(xstr(ISEG_VERSION)) + QString(" - No Filename")); + setCaption(QString(" iSeg ") + QString(xstr(ISEG_VERSION)) + + QString(" - No Filename")); m_notes->clear(); reset_brightnesscontrast(); @@ -5092,8 +4821,7 @@ void MainWindow::execute_3Dsurfaceviewer() if (SV3D == NULL) { SV3D = new surfaceviewer3D(handler3D, false, 0); - QObject::connect(SV3D, SIGNAL(hasbeenclosed()), this, - SLOT(SV3D_closed())); + QObject::connect(SV3D, SIGNAL(hasbeenclosed()), this, SLOT(SV3D_closed())); } SV3D->show(); @@ -5112,7 +4840,7 @@ void MainWindow::execute_3Dsurfaceviewerbmp() { SV3Dbmp = new surfaceviewer3D(handler3D, true, 0); QObject::connect(SV3Dbmp, SIGNAL(hasbeenclosed()), this, - SLOT(SV3Dbmp_closed())); + SLOT(SV3Dbmp_closed())); } SV3Dbmp->show(); @@ -5130,8 +4858,7 @@ void MainWindow::execute_3Dvolumeviewertissue() if (VV3D == NULL) { VV3D = new volumeviewer3D(handler3D, false, true, true, 0); - QObject::connect(VV3D, SIGNAL(hasbeenclosed()), this, - SLOT(VV3D_closed())); + QObject::connect(VV3D, SIGNAL(hasbeenclosed()), this, SLOT(VV3D_closed())); } VV3D->show(); @@ -5150,7 +4877,7 @@ void MainWindow::execute_3Dvolumeviewerbmp() { VV3Dbmp = new volumeviewer3D(handler3D, true, true, true, 0); QObject::connect(VV3Dbmp, SIGNAL(hasbeenclosed()), this, - SLOT(VV3Dbmp_closed())); + SLOT(VV3Dbmp_closed())); } VV3Dbmp->show(); @@ -5178,19 +4905,6 @@ void MainWindow::update_bmp() } } -void MainWindow::update_bmp(QRect rect) -{ - bmp_show->update(rect); - if (xsliceshower != NULL) - { - xsliceshower->bmp_changed(); - } - if (ysliceshower != NULL) - { - ysliceshower->bmp_changed(); - } -} - void MainWindow::update_work() { work_show->update(); @@ -5205,20 +4919,6 @@ void MainWindow::update_work() } } -void MainWindow::update_work(QRect rect) -{ - work_show->update(rect); - - if (xsliceshower != NULL) - { - xsliceshower->work_changed(); - } - if (ysliceshower != NULL) - { - ysliceshower->work_changed(); - } -} - void MainWindow::update_tissue() { bmp_show->tissue_changed(); @@ -5233,36 +4933,22 @@ void MainWindow::update_tissue() SV3D->tissue_changed(); } -void MainWindow::update_tissue(QRect rect) -{ - bmp_show->tissue_changed(rect); - work_show->tissue_changed(rect); - if (xsliceshower != NULL) - xsliceshower->tissue_changed(); - if (ysliceshower != NULL) - ysliceshower->tissue_changed(); - if (VV3D != NULL) - VV3D->tissue_changed(); - if (SV3D != NULL) - SV3D->tissue_changed(); -} - void MainWindow::xslice_closed() { if (xsliceshower != NULL) { - QObject::disconnect( - bmp_show, SIGNAL(scaleoffsetfactor_changed(float, float, bool)), - xsliceshower, SLOT(set_scale(float, float, bool))); - QObject::disconnect( - work_show, SIGNAL(scaleoffsetfactor_changed(float, float, bool)), - xsliceshower, SLOT(set_scale(float, float, bool))); + QObject::disconnect(bmp_show, + SIGNAL(scaleoffsetfactor_changed(float, float, bool)), + xsliceshower, SLOT(set_scale(float, float, bool))); + QObject::disconnect(work_show, + SIGNAL(scaleoffsetfactor_changed(float, float, bool)), + xsliceshower, SLOT(set_scale(float, float, bool))); QObject::disconnect(xsliceshower, SIGNAL(slice_changed(int)), this, - SLOT(xshower_slicechanged())); + SLOT(xshower_slicechanged())); QObject::disconnect(xsliceshower, SIGNAL(hasbeenclosed()), this, - SLOT(xslice_closed())); + SLOT(xslice_closed())); QObject::disconnect(zoom_widget, SIGNAL(set_zoom(double)), xsliceshower, - SLOT(set_zoom(double))); + SLOT(set_zoom(double))); if (ysliceshower != NULL) { @@ -5280,18 +4966,18 @@ void MainWindow::yslice_closed() { if (ysliceshower != NULL) { - QObject::disconnect( - bmp_show, SIGNAL(scaleoffsetfactor_changed(float, float, bool)), - ysliceshower, SLOT(set_scale(float, float, bool))); - QObject::disconnect( - work_show, SIGNAL(scaleoffsetfactor_changed(float, float, bool)), - ysliceshower, SLOT(set_scale(float, float, bool))); + QObject::disconnect(bmp_show, + SIGNAL(scaleoffsetfactor_changed(float, float, bool)), + ysliceshower, SLOT(set_scale(float, float, bool))); + QObject::disconnect(work_show, + SIGNAL(scaleoffsetfactor_changed(float, float, bool)), + ysliceshower, SLOT(set_scale(float, float, bool))); QObject::disconnect(ysliceshower, SIGNAL(slice_changed(int)), this, - SLOT(yshower_slicechanged())); + SLOT(yshower_slicechanged())); QObject::disconnect(ysliceshower, SIGNAL(hasbeenclosed()), this, - SLOT(yslice_closed())); + SLOT(yslice_closed())); QObject::disconnect(zoom_widget, SIGNAL(set_zoom(double)), ysliceshower, - SLOT(set_zoom(double))); + SLOT(set_zoom(double))); if (xsliceshower != NULL) { @@ -5310,7 +4996,7 @@ void MainWindow::SV3D_closed() if (SV3D != NULL) { QObject::disconnect(SV3D, SIGNAL(hasbeenclosed()), this, - SLOT(SV3D_closed())); + SLOT(SV3D_closed())); delete SV3D; SV3D = NULL; } @@ -5321,7 +5007,7 @@ void MainWindow::SV3Dbmp_closed() if (SV3Dbmp != NULL) { QObject::disconnect(SV3D, SIGNAL(hasbeenclosed()), this, - SLOT(SV3Dbmp_closed())); + SLOT(SV3Dbmp_closed())); delete SV3Dbmp; SV3Dbmp = NULL; } @@ -5332,7 +5018,7 @@ void MainWindow::VV3D_closed() if (VV3D != NULL) { QObject::disconnect(VV3D, SIGNAL(hasbeenclosed()), this, - SLOT(VV3D_closed())); + SLOT(VV3D_closed())); delete VV3D; VV3D = NULL; } @@ -5343,7 +5029,7 @@ void MainWindow::VV3Dbmp_closed() if (VV3Dbmp != NULL) { QObject::disconnect(VV3Dbmp, SIGNAL(hasbeenclosed()), this, - SLOT(VV3Dbmp_closed())); + SLOT(VV3Dbmp_closed())); delete VV3Dbmp; VV3Dbmp = NULL; } @@ -5412,21 +5098,21 @@ void MainWindow::execute_scale() { ScaleWork SW(handler3D, m_picpath, this); QObject::connect( - &SW, SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), - this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); - QObject::connect( - &SW, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, - SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); + &SW, SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), + this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + QObject::connect(&SW, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), + this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); SW.move(QCursor::pos()); SW.exec(); QObject::disconnect( - &SW, SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), - this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + &SW, SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), + this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); QObject::disconnect( - &SW, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, - SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); + &SW, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); return; } @@ -5435,21 +5121,21 @@ void MainWindow::execute_imagemath() { ImageMath IM(handler3D, this); QObject::connect( - &IM, SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), - this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); - QObject::connect( - &IM, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, - SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); + &IM, SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), + this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + QObject::connect(&IM, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), + this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); IM.move(QCursor::pos()); IM.exec(); QObject::disconnect( - &IM, SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), - this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + &IM, SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), + this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); QObject::disconnect( - &IM, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, - SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); + &IM, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); return; } @@ -5471,21 +5157,21 @@ void MainWindow::execute_overlay() { ImageOverlay IO(handler3D, this); QObject::connect( - &IO, SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), - this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); - QObject::connect( - &IO, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, - SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); + &IO, SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), + this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + QObject::connect(&IO, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), + this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); IO.move(QCursor::pos()); IO.exec(); QObject::disconnect( - &IO, SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), - this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + &IO, SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), + this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); QObject::disconnect( - &IO, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, - SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); + &IO, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); return; } @@ -5592,7 +5278,7 @@ void MainWindow::execute_activeslicesconf() unsigned short slicenr = handler3D->get_activeslice() + 1; if (handler3D->return_startslice() >= slicenr || - handler3D->return_endslice() + 1 <= slicenr) + handler3D->return_endslice() + 1 <= slicenr) { lb_inactivewarning->setText(QString(" 3D Inactive Slice! ")); lb_inactivewarning->setPaletteBackgroundColor(QColor(0, 255, 0)); @@ -5601,7 +5287,7 @@ void MainWindow::execute_activeslicesconf() { lb_inactivewarning->setText(QString(" ")); lb_inactivewarning->setPaletteBackgroundColor( - this->paletteBackgroundColor()); + this->paletteBackgroundColor()); } return; @@ -5767,7 +5453,8 @@ void MainWindow::execute_showtabtoggled(bool) showpb_tab[i] = showtab_action[i]->isOn(); } - WidgetInterface* currentwidget = (WidgetInterface*)methodTab->visibleWidget(); + WidgetInterface* currentwidget = + (WidgetInterface*)methodTab->visibleWidget(); unsigned short i = 0; while ((i < nrtabbuttons) && (currentwidget != tabwidgets[i])) i++; @@ -5802,8 +5489,8 @@ void MainWindow::execute_xslice() if (xsliceshower == NULL) { xsliceshower = new SliceViewerWidget( - handler3D, true, handler3D->get_slicethickness(), - zoom_widget->get_zoom(), 0, 0, Qt::WStyle_StaysOnTop); + handler3D, true, handler3D->get_slicethickness(), + zoom_widget->get_zoom(), 0, 0, Qt::WStyle_StaysOnTop); xsliceshower->zpos_changed(); if (ysliceshower != NULL) { @@ -5820,17 +5507,17 @@ void MainWindow::execute_xslice() work_show->get_scaleoffsetfactor(offset1, factor1); xsliceshower->set_scale(offset1, factor1, false); QObject::connect(bmp_show, - SIGNAL(scaleoffsetfactor_changed(float, float, bool)), - xsliceshower, SLOT(set_scale(float, float, bool))); + SIGNAL(scaleoffsetfactor_changed(float, float, bool)), + xsliceshower, SLOT(set_scale(float, float, bool))); QObject::connect(work_show, - SIGNAL(scaleoffsetfactor_changed(float, float, bool)), - xsliceshower, SLOT(set_scale(float, float, bool))); + SIGNAL(scaleoffsetfactor_changed(float, float, bool)), + xsliceshower, SLOT(set_scale(float, float, bool))); QObject::connect(xsliceshower, SIGNAL(slice_changed(int)), this, - SLOT(xshower_slicechanged())); + SLOT(xshower_slicechanged())); QObject::connect(xsliceshower, SIGNAL(hasbeenclosed()), this, - SLOT(xslice_closed())); + SLOT(xslice_closed())); QObject::connect(zoom_widget, SIGNAL(set_zoom(double)), xsliceshower, - SLOT(set_zoom(double))); + SLOT(set_zoom(double))); } xsliceshower->show(); @@ -5850,8 +5537,8 @@ void MainWindow::execute_yslice() if (ysliceshower == NULL) { ysliceshower = new SliceViewerWidget( - handler3D, false, handler3D->get_slicethickness(), - zoom_widget->get_zoom(), 0, 0, Qt::WStyle_StaysOnTop); + handler3D, false, handler3D->get_slicethickness(), + zoom_widget->get_zoom(), 0, 0, Qt::WStyle_StaysOnTop); ysliceshower->zpos_changed(); if (xsliceshower != NULL) { @@ -5868,17 +5555,17 @@ void MainWindow::execute_yslice() work_show->get_scaleoffsetfactor(offset1, factor1); ysliceshower->set_scale(offset1, factor1, false); QObject::connect(bmp_show, - SIGNAL(scaleoffsetfactor_changed(float, float, bool)), - ysliceshower, SLOT(set_scale(float, float, bool))); + SIGNAL(scaleoffsetfactor_changed(float, float, bool)), + ysliceshower, SLOT(set_scale(float, float, bool))); QObject::connect(work_show, - SIGNAL(scaleoffsetfactor_changed(float, float, bool)), - ysliceshower, SLOT(set_scale(float, float, bool))); + SIGNAL(scaleoffsetfactor_changed(float, float, bool)), + ysliceshower, SLOT(set_scale(float, float, bool))); QObject::connect(ysliceshower, SIGNAL(slice_changed(int)), this, - SLOT(yshower_slicechanged())); + SLOT(yshower_slicechanged())); QObject::connect(ysliceshower, SIGNAL(hasbeenclosed()), this, - SLOT(yslice_closed())); + SLOT(yslice_closed())); QObject::connect(zoom_widget, SIGNAL(set_zoom(double)), ysliceshower, - SLOT(set_zoom(double))); + SLOT(set_zoom(double))); } ysliceshower->show(); @@ -5890,9 +5577,9 @@ void MainWindow::execute_yslice() void MainWindow::execute_removetissues() { QString filename = Q3FileDialog::getOpenFileName(QString::null, - "Text (*.txt)\n" - "All(*.*)", - this); + "Text (*.txt)\n" + "All(*.*)", + this); if (!filename.isEmpty()) { std::vector types; @@ -5900,7 +5587,7 @@ void MainWindow::execute_removetissues() { // this actually goes through slices and removes it from segmentation handler3D->remove_tissues( - std::set(types.begin(), types.end())); + std::set(types.begin(), types.end())); tissueTreeWidget->update_tree_widget(); tissuenr_changed(tissueTreeWidget->get_current_type() - 1); @@ -5908,8 +5595,8 @@ void MainWindow::execute_removetissues() else { QMessageBox::warning(this, "iSeg", - "Error: not all tissues are in tissue list", - QMessageBox::Ok | QMessageBox::Default); + "Error: not all tissues are in tissue list", + QMessageBox::Ok | QMessageBox::Default); } } } @@ -5919,14 +5606,14 @@ void MainWindow::execute_grouptissues() vector olds, news; QString filename = Q3FileDialog::getOpenFileName(QString::null, - "Text (*.txt)\n" - "All(*.*)", - this); + "Text (*.txt)\n" + "All(*.*)", + this); if (!filename.isEmpty()) { bool fail_on_unknown_tissue = true; if (read_grouptissuescapped(filename.ascii(), olds, news, - fail_on_unknown_tissue)) + fail_on_unknown_tissue)) { iseg::DataSelection dataSelection; dataSelection.allSlices = true; @@ -5940,8 +5627,8 @@ void MainWindow::execute_grouptissues() else { QMessageBox::warning(this, "iSeg", - "Error: not all tissues are in tissue list", - QMessageBox::Ok | QMessageBox::Default); + "Error: not all tissues are in tissue list", + QMessageBox::Ok | QMessageBox::Default); } } } @@ -5949,7 +5636,8 @@ void MainWindow::execute_grouptissues() void MainWindow::execute_about() { std::ostringstream ss; - ss << "\n\niSeg\n" << std::string(xstr(ISEG_DESCRIPTION)); + ss << "\n\niSeg\n" + << std::string(xstr(ISEG_DESCRIPTION)); QMessageBox::about(this, "About", QString(ss.str().c_str())); } @@ -6014,7 +5702,7 @@ void MainWindow::select_tissue(Point p) (*i)->setSelected(false); } tissueTreeWidget->set_current_tissue( - handler3D->get_tissue_pt(p, handler3D->get_activeslice())); + handler3D->get_tissue_pt(p, handler3D->get_activeslice())); } void MainWindow::next_featuring_slice() @@ -6034,8 +5722,7 @@ void MainWindow::next_featuring_slice() } else { - QMessageBox::information(this, "iSeg", - "The selected tissue its empty.\n"); + QMessageBox::information(this, "iSeg", "The selected tissue its empty.\n"); } } @@ -6061,7 +5748,7 @@ void MainWindow::add_tissue_connected(Point p) tissues_size_t currTissueType = tissueTreeWidget->get_current_type(); handler3D->add2tissue_connected(currTissueType, p, - cb_addsuboverride->isChecked()); + cb_addsuboverride->isChecked()); emit end_datachange(this); } @@ -6108,10 +5795,10 @@ void MainWindow::subtract_tissue(Point p) void MainWindow::add_tissue_clicked(Point p) { QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), this, - SLOT(add_tissue_clicked(Point))); + SLOT(add_tissue_clicked(Point))); pb_add->setOn(false); QObject::connect(work_show, SIGNAL(mousereleased_sign(Point)), this, - SLOT(reconnectmouse_afterrelease(Point))); + SLOT(reconnectmouse_afterrelease(Point))); addhold_tissue_clicked(p); } @@ -6129,20 +5816,19 @@ void MainWindow::addhold_tissue_clicked(Point p) QApplication::setOverrideCursor(QCursor(Qt::waitCursor)); if (cb_addsubconn->isChecked()) handler3D->add2tissueall_connected(currTissueType, p, - cb_addsuboverride->isChecked()); + cb_addsuboverride->isChecked()); else handler3D->add2tissueall(currTissueType, p, - cb_addsuboverride->isChecked()); + cb_addsuboverride->isChecked()); QApplication::restoreOverrideCursor(); } else { if (cb_addsubconn->isChecked()) handler3D->add2tissue_connected(currTissueType, p, - cb_addsuboverride->isChecked()); + cb_addsuboverride->isChecked()); else - handler3D->add2tissue(currTissueType, p, - cb_addsuboverride->isChecked()); + handler3D->add2tissue(currTissueType, p, cb_addsuboverride->isChecked()); } emit end_datachange(this); @@ -6159,10 +5845,10 @@ void MainWindow::addhold_tissue_clicked(Point p) void MainWindow::subtract_tissue_clicked(Point p) { QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), this, - SLOT(subtract_tissue_clicked(Point))); + SLOT(subtract_tissue_clicked(Point))); pb_sub->setOn(false); QObject::connect(work_show, SIGNAL(mousereleased_sign(Point)), this, - SLOT(reconnectmouse_afterrelease(Point))); + SLOT(reconnectmouse_afterrelease(Point))); subtracthold_tissue_clicked(p); } @@ -6210,40 +5896,34 @@ void MainWindow::add_tissue_pushed() if (pb_sub->isOn()) { QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), this, - SLOT(subtract_tissue_clicked(Point))); + SLOT(subtract_tissue_clicked(Point))); pb_sub->setOn(false); } if (pb_subhold->isOn()) { QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), this, - SLOT(subtracthold_tissue_clicked(Point))); + SLOT(subtracthold_tissue_clicked(Point))); pb_subhold->setOn(false); } if (pb_addhold->isOn()) { QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), this, - SLOT(addhold_tissue_clicked(Point))); + SLOT(addhold_tissue_clicked(Point))); pb_addhold->setOn(false); } if (pb_add->isOn()) { - // pb_add->setDown(false); QObject::connect(work_show, SIGNAL(mousepressed_sign(Point)), this, - SLOT(add_tissue_clicked(Point))); + SLOT(add_tissue_clicked(Point))); disconnect_mouseclick(); } else { - // pb_add->setDown(true); QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), this, - SLOT(add_tissue_clicked(Point))); + SLOT(add_tissue_clicked(Point))); connect_mouseclick(); } - /* if(pb_add3D->isDown()){ - QObject::disconnect(work_show,SIGNAL(mousepressed_sign(Point)),this,SLOT(add_tissue_3D_clicked(Point))); - pb_add3D->setDown(false); - }*/ } void MainWindow::add_tissue_shortkey() @@ -6267,26 +5947,26 @@ void MainWindow::addhold_tissue_pushed() if (pb_sub->isOn()) { QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), this, - SLOT(subtract_tissue_clicked(Point))); + SLOT(subtract_tissue_clicked(Point))); pb_sub->setOn(false); } if (pb_subhold->isOn()) { QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), this, - SLOT(subtracthold_tissue_clicked(Point))); + SLOT(subtracthold_tissue_clicked(Point))); pb_subhold->setOn(false); } if (pb_add->isOn()) { QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), this, - SLOT(add_tissue_clicked(Point))); + SLOT(add_tissue_clicked(Point))); pb_add->setOn(false); } if (pb_addhold->isOn()) { QObject::connect(work_show, SIGNAL(mousepressed_sign(Point)), this, - SLOT(addhold_tissue_clicked(Point))); + SLOT(addhold_tissue_clicked(Point))); disconnect_mouseclick(); // pb_addhold->setDown(false); } @@ -6294,7 +5974,7 @@ void MainWindow::addhold_tissue_pushed() { // pb_addhold->setDown(true); QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), this, - SLOT(addhold_tissue_clicked(Point))); + SLOT(addhold_tissue_clicked(Point))); connect_mouseclick(); } /* if(pb_add3D->isDown()){ @@ -6327,32 +6007,32 @@ void MainWindow::subtract_tissue_pushed() if (pb_add->isOn()) { QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), this, - SLOT(add_tissue_clicked(Point))); + SLOT(add_tissue_clicked(Point))); pb_add->setOn(false); } if (pb_sub->isOn()) { QObject::connect(work_show, SIGNAL(mousepressed_sign(Point)), this, - SLOT(subtract_tissue_clicked(Point))); + SLOT(subtract_tissue_clicked(Point))); disconnect_mouseclick(); } else { QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), this, - SLOT(subtract_tissue_clicked(Point))); + SLOT(subtract_tissue_clicked(Point))); connect_mouseclick(); } if (pb_subhold->isOn()) { QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), this, - SLOT(subtracthold_tissue_clicked(Point))); + SLOT(subtracthold_tissue_clicked(Point))); // pb_subhold->setDown(false); pb_subhold->setOn(false); } if (pb_addhold->isOn()) { QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), this, - SLOT(addhold_tissue_clicked(Point))); + SLOT(addhold_tissue_clicked(Point))); // pb_addhold->setOn(false); pb_addhold->setOn(false); } @@ -6372,31 +6052,31 @@ void MainWindow::subtracthold_tissue_pushed() if (pb_add->isOn()) { QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), this, - SLOT(add_tissue_clicked(Point))); + SLOT(add_tissue_clicked(Point))); pb_add->setOn(false); } if (pb_subhold->isOn()) { QObject::connect(work_show, SIGNAL(mousepressed_sign(Point)), this, - SLOT(subtracthold_tissue_clicked(Point))); + SLOT(subtracthold_tissue_clicked(Point))); disconnect_mouseclick(); } else { QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), this, - SLOT(subtracthold_tissue_clicked(Point))); + SLOT(subtracthold_tissue_clicked(Point))); connect_mouseclick(); } if (pb_sub->isOn()) { QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), this, - SLOT(subtract_tissue_clicked(Point))); + SLOT(subtract_tissue_clicked(Point))); pb_sub->setOn(false); } if (pb_addhold->isOn()) { QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), this, - SLOT(addhold_tissue_clicked(Point))); + SLOT(addhold_tissue_clicked(Point))); pb_addhold->setOn(false); } // pb_subhold->setDown(!pb_subhold->isDown()); @@ -6415,25 +6095,25 @@ void MainWindow::stophold_tissue_pushed() if (pb_add->isDown()) { QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), this, - SLOT(add_tissue_clicked(Point))); + SLOT(add_tissue_clicked(Point))); pb_add->setDown(false); } if (pb_subhold->isOn()) { QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), this, - SLOT(subtracthold_tissue_clicked(Point))); + SLOT(subtracthold_tissue_clicked(Point))); pb_subhold->setOn(false); } if (pb_sub->isDown()) { QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), this, - SLOT(subtract_tissue_clicked(Point))); + SLOT(subtract_tissue_clicked(Point))); pb_sub->setDown(false); } if (pb_addhold->isOn()) { QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), this, - SLOT(addhold_tissue_clicked(Point))); + SLOT(addhold_tissue_clicked(Point))); pb_addhold->setOn(false); } } @@ -6494,9 +6174,9 @@ void MainWindow::do_work2tissue_grouped() vector olds, news; QString filename = Q3FileDialog::getOpenFileName(QString::null, - "Text (*.txt)\n" - "All(*.*)", - this); + "Text (*.txt)\n" + "All(*.*)", + this); if (!filename.isEmpty()) { @@ -6513,12 +6193,10 @@ void MainWindow::do_work2tissue_grouped() tissues_size_t m; handler3D->get_rangetissue(&m); handler3D->buildmissingtissues(m); - // handler3D->build255tissues(); tissueTreeWidget->update_tree_widget(); - tissues_size_t currTissueType = - tissueTreeWidget->get_current_type(); - tissuenr_changed(currTissueType); + tissues_size_t currTissueType = tissueTreeWidget->get_current_type(); + tissuenr_changed(currTissueType - 1); // TODO BL is this a bug? (I added the -1) emit end_datachange(this); } @@ -6546,20 +6224,19 @@ void MainWindow::merge() QList list_ = tissueTreeWidget->selectedItems(); for (auto a = list_.begin(); a != list_.end() && !anyLocked; ++a) { - anyLocked |= - TissueInfos::GetTissueLocked(tissueTreeWidget->get_type(*a)); + anyLocked |= TissueInfos::GetTissueLocked(tissueTreeWidget->get_type(*a)); } if (anyLocked) { QMessageBox::warning(this, "iSeg", "Locked tissues can not be merged.", - QMessageBox::Ok | QMessageBox::Default); + QMessageBox::Ok | QMessageBox::Default); return; } int ret = QMessageBox::warning( - this, "iSeg", "Do you really want to merge the selected tissues?", - QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, - QMessageBox::Cancel | QMessageBox::Escape); + this, "iSeg", "Do you really want to merge the selected tissues?", + QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, + QMessageBox::Cancel | QMessageBox::Escape); if (ret == QMessageBox::Yes) { bool tmp; @@ -6628,8 +6305,8 @@ void MainWindow::modifFolder() { bool ok = false; QString newFolderName = QInputDialog::getText( - "Folder name", "Enter a name for the folder:", QLineEdit::Normal, - tissueTreeWidget->get_current_name(), &ok, this); + "Folder name", "Enter a name for the folder:", QLineEdit::Normal, + tissueTreeWidget->get_current_name(), &ok, this); if (ok) { tissueTreeWidget->set_current_folder_name(newFolderName); @@ -6654,21 +6331,20 @@ void MainWindow::removeselected() QList list_ = tissueTreeWidget->selectedItems(); for (auto a = list_.begin(); a != list_.end() && !anyLocked; ++a) { - anyLocked |= - TissueInfos::GetTissueLocked(tissueTreeWidget->get_type(*a)); + anyLocked |= TissueInfos::GetTissueLocked(tissueTreeWidget->get_type(*a)); } if (anyLocked) { QMessageBox::warning(this, "iSeg", "Locked tissues can not be removed.", - QMessageBox::Ok | QMessageBox::Default); + QMessageBox::Ok | QMessageBox::Default); return; } bool removeCompletely = false; int ret = QMessageBox::warning( - this, "iSeg", "Do you really want to remove the selected tissues?", - QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, - QMessageBox::Cancel | QMessageBox::Escape); + this, "iSeg", "Do you really want to remove the selected tissues?", + QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, + QMessageBox::Cancel | QMessageBox::Escape); if (ret == QMessageBox::Yes) { removeCompletely = true; @@ -6686,11 +6362,11 @@ void MainWindow::removeselected() { // There are more than one instance of the same tissue in the tree int ret = QMessageBox::question( - this, "iSeg", - "There are multiple occurrences\nof a selected tissue in the " - "hierarchy.\nDo you want to remove them all?", - QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, - QMessageBox::Cancel | QMessageBox::Escape); + this, "iSeg", + "There are multiple occurrences\nof a selected tissue in the " + "hierarchy.\nDo you want to remove them all?", + QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, + QMessageBox::Cancel | QMessageBox::Escape); if (ret == QMessageBox::Yes) { removeCompletely = true; @@ -6715,10 +6391,9 @@ void MainWindow::removeselected() tissues_size_t tissueCount = TissueInfos::GetTissueCount(); if (tissueCount < 2) { - QMessageBox::information( - this, "iSeg", - "It is not possible to erase this tissue.\nAt " - "least one tissue must be defined."); + QMessageBox::information(this, "iSeg", + "It is not possible to erase this tissue.\nAt " + "least one tissue must be defined."); return; } @@ -6775,11 +6450,10 @@ void MainWindow::removeFolder() { QMessageBox msgBox; msgBox.setText("Remove Folder"); - msgBox.setInformativeText( - "Do you want to keep all tissues\nand folders " - "contained in this folder?"); + msgBox.setInformativeText("Do you want to keep all tissues\nand folders " + "contained in this folder?"); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No | - QMessageBox::Cancel); + QMessageBox::Cancel); msgBox.setDefaultButton(QMessageBox::Yes); int ret = msgBox.exec(); if (ret == QMessageBox::Yes) @@ -6796,11 +6470,11 @@ void MainWindow::removeFolder() bool anyLocked = false; std::set removeTissues; for (std::map::iterator iter = - childTissues.begin(); - iter != childTissues.end(); ++iter) + childTissues.begin(); + iter != childTissues.end(); ++iter) { if (iter->second == - tissueTreeWidget->get_tissue_instance_count(iter->first)) + tissueTreeWidget->get_tissue_instance_count(iter->first)) { anyLocked |= TissueInfos::GetTissueLocked(iter->first); removeTissues.insert(iter->first); @@ -6808,17 +6482,15 @@ void MainWindow::removeFolder() } if (anyLocked) { - QMessageBox::warning(this, "iSeg", - "Locked tissues can not be removed.", - QMessageBox::Ok | QMessageBox::Default); + QMessageBox::warning(this, "iSeg", "Locked tissues can not be removed.", + QMessageBox::Ok | QMessageBox::Default); return; } if (removeTissues.size() >= TissueInfos::GetTissueCount()) { - QMessageBox::information( - this, "iSeg", - "It is not possible to erase this folder.\nAt " - "least one tissue must be defined."); + QMessageBox::information(this, "iSeg", + "It is not possible to erase this folder.\nAt " + "least one tissue must be defined."); return; } @@ -6835,8 +6507,7 @@ void MainWindow::removeFolder() emit end_datachange(this, iseg::ClearUndo); - tissues_size_t currTissueType = - tissueTreeWidget->get_current_type(); + tissues_size_t currTissueType = tissueTreeWidget->get_current_type(); tissuenr_changed(currTissueType - 1); } } @@ -6852,20 +6523,19 @@ void MainWindow::removeTissueFolderAllPressed() QList list_ = tissueTreeWidget->get_all_items(); for (auto a = list_.begin(); a != list_.end() && !anyLocked; ++a) { - anyLocked |= - TissueInfos::GetTissueLocked(tissueTreeWidget->get_type(*a)); + anyLocked |= TissueInfos::GetTissueLocked(tissueTreeWidget->get_type(*a)); } if (anyLocked) { QMessageBox::warning(this, "iSeg", "Locked tissues can not be removed.", - QMessageBox::Ok | QMessageBox::Default); + QMessageBox::Ok | QMessageBox::Default); return; } int ret = QMessageBox::warning( - this, "iSeg", "Do you really want to remove all tissues and folders?", - QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, - QMessageBox::Cancel | QMessageBox::Escape); + this, "iSeg", "Do you really want to remove all tissues and folders?", + QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, + QMessageBox::Cancel | QMessageBox::Escape); if (ret == QMessageBox::Yes) { iseg::DataSelection dataSelection; @@ -6960,20 +6630,19 @@ void MainWindow::cleartissues() QList list_ = tissueTreeWidget->get_all_items(); for (auto a = list_.begin(); a != list_.end() && !anyLocked; ++a) { - anyLocked |= - TissueInfos::GetTissueLocked(tissueTreeWidget->get_type(*a)); + anyLocked |= TissueInfos::GetTissueLocked(tissueTreeWidget->get_type(*a)); } if (anyLocked) { QMessageBox::warning(this, "iSeg", "Locked tissues can not be cleared.", - QMessageBox::Ok | QMessageBox::Default); + QMessageBox::Ok | QMessageBox::Default); return; } int ret = QMessageBox::warning( - this, "iSeg", "Do you really want to clear all tissues?", - QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, - QMessageBox::Cancel | QMessageBox::Escape); + this, "iSeg", "Do you really want to clear all tissues?", + QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, + QMessageBox::Cancel | QMessageBox::Escape); if (ret == QMessageBox::Yes) { iseg::DataSelection dataSelection; @@ -6999,18 +6668,18 @@ void MainWindow::cleartissues() void MainWindow::cleartissue() { bool isLocked = - TissueInfos::GetTissueLocked(tissueTreeWidget->get_current_type()); + TissueInfos::GetTissueLocked(tissueTreeWidget->get_current_type()); if (isLocked) { QMessageBox::warning(this, "iSeg", "Locked tissue can not be removed.", - QMessageBox::Ok | QMessageBox::Default); + QMessageBox::Ok | QMessageBox::Default); return; } int ret = QMessageBox::warning( - this, "iSeg", "Do you really want to clear the tissue?", - QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, - QMessageBox::Cancel | QMessageBox::Escape); + this, "iSeg", "Do you really want to clear the tissue?", + QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, + QMessageBox::Cancel | QMessageBox::Escape); if (ret == QMessageBox::Yes) { iseg::DataSelection dataSelection; @@ -7039,20 +6708,19 @@ void MainWindow::clearselected() QList list_ = tissueTreeWidget->selectedItems(); for (auto a = list_.begin(); a != list_.end() && !anyLocked; ++a) { - anyLocked |= - TissueInfos::GetTissueLocked(tissueTreeWidget->get_type(*a)); + anyLocked |= TissueInfos::GetTissueLocked(tissueTreeWidget->get_type(*a)); } if (anyLocked) { QMessageBox::warning(this, "iSeg", "Locked tissues can not be cleared.", - QMessageBox::Ok | QMessageBox::Default); + QMessageBox::Ok | QMessageBox::Default); return; } int ret = QMessageBox::warning( - this, "iSeg", "Do you really want to clear tissues?", - QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, - QMessageBox::Cancel | QMessageBox::Escape); + this, "iSeg", "Do you really want to clear tissues?", + QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, + QMessageBox::Cancel | QMessageBox::Escape); if (ret == QMessageBox::Yes) { iseg::DataSelection dataSelection; @@ -7061,8 +6729,7 @@ void MainWindow::clearselected() dataSelection.tissues = true; emit begin_datachange(dataSelection, this); - QList list; - list = tissueTreeWidget->selectedItems(); + auto list = tissueTreeWidget->selectedItems(); for (auto a = list.begin(); a != list.end(); ++a) { QTreeWidgetItem* item = *a; @@ -7131,19 +6798,19 @@ void MainWindow::workpicturevisible_changed() void MainWindow::slice_changed() { WidgetInterface* qw = (WidgetInterface*)methodTab->visibleWidget(); - qw->slicenr_changed(); + qw->on_slicenr_changed(); unsigned short slicenr = handler3D->get_activeslice() + 1; QObject::disconnect(scb_slicenr, SIGNAL(valueChanged(int)), this, - SLOT(scb_slicenr_changed())); + SLOT(scb_slicenr_changed())); scb_slicenr->setValue(int(slicenr)); QObject::connect(scb_slicenr, SIGNAL(valueChanged(int)), this, - SLOT(scb_slicenr_changed())); + SLOT(scb_slicenr_changed())); QObject::disconnect(sb_slicenr, SIGNAL(valueChanged(int)), this, - SLOT(sb_slicenr_changed())); + SLOT(sb_slicenr_changed())); sb_slicenr->setValue(int(slicenr)); QObject::connect(sb_slicenr, SIGNAL(valueChanged(int)), this, - SLOT(sb_slicenr_changed())); + SLOT(sb_slicenr_changed())); bmp_show->slicenr_changed(); work_show->slicenr_changed(); scalewidget->slicenr_changed(); @@ -7151,7 +6818,7 @@ void MainWindow::slice_changed() imageoverlaywidget->slicenr_changed(); overlay_widget->slicenr_changed(); if (handler3D->return_startslice() >= slicenr || - handler3D->return_endslice() + 1 <= slicenr) + handler3D->return_endslice() + 1 <= slicenr) { lb_inactivewarning->setText(QString(" 3D Inactive Slice! ")); lb_inactivewarning->setPaletteBackgroundColor(QColor(0, 255, 0)); @@ -7160,7 +6827,7 @@ void MainWindow::slice_changed() { lb_inactivewarning->setText(QString(" ")); lb_inactivewarning->setPaletteBackgroundColor( - this->paletteBackgroundColor()); + this->paletteBackgroundColor()); } if (xsliceshower != NULL) @@ -7192,34 +6859,34 @@ void MainWindow::slices3d_changed(bool new_bitstack) if (handler3D->return_nrslices() != nrslices) { QObject::disconnect(scb_slicenr, SIGNAL(valueChanged(int)), this, - SLOT(scb_slicenr_changed())); + SLOT(scb_slicenr_changed())); scb_slicenr->setMaxValue((int)handler3D->return_nrslices()); QObject::connect(scb_slicenr, SIGNAL(valueChanged(int)), this, - SLOT(scb_slicenr_changed())); + SLOT(scb_slicenr_changed())); QObject::disconnect(sb_slicenr, SIGNAL(valueChanged(int)), this, - SLOT(sb_slicenr_changed())); + SLOT(sb_slicenr_changed())); sb_slicenr->setMaxValue((int)handler3D->return_nrslices()); QObject::connect(sb_slicenr, SIGNAL(valueChanged(int)), this, - SLOT(sb_slicenr_changed())); + SLOT(sb_slicenr_changed())); lb_slicenr->setText(QString(" of ") + - QString::number((int)handler3D->return_nrslices())); + QString::number((int)handler3D->return_nrslices())); interpolwidget->handler3D_changed(); nrslices = handler3D->return_nrslices(); } unsigned short slicenr = handler3D->get_activeslice() + 1; QObject::disconnect(scb_slicenr, SIGNAL(valueChanged(int)), this, - SLOT(scb_slicenr_changed())); + SLOT(scb_slicenr_changed())); scb_slicenr->setValue(int(slicenr)); QObject::connect(scb_slicenr, SIGNAL(valueChanged(int)), this, - SLOT(scb_slicenr_changed())); + SLOT(scb_slicenr_changed())); QObject::disconnect(sb_slicenr, SIGNAL(valueChanged(int)), this, - SLOT(sb_slicenr_changed())); + SLOT(sb_slicenr_changed())); sb_slicenr->setValue(int(slicenr)); QObject::connect(sb_slicenr, SIGNAL(valueChanged(int)), this, - SLOT(sb_slicenr_changed())); + SLOT(sb_slicenr_changed())); if (handler3D->return_startslice() >= slicenr || - handler3D->return_endslice() + 1 <= slicenr) + handler3D->return_endslice() + 1 <= slicenr) { lb_inactivewarning->setText(QString(" 3D Inactive Slice! ")); lb_inactivewarning->setPaletteBackgroundColor(QColor(0, 255, 0)); @@ -7228,7 +6895,7 @@ void MainWindow::slices3d_changed(bool new_bitstack) { lb_inactivewarning->setText(QString(" ")); lb_inactivewarning->setPaletteBackgroundColor( - this->paletteBackgroundColor()); + this->paletteBackgroundColor()); } if (xsliceshower != NULL) @@ -7350,15 +7017,13 @@ void MainWindow::slicethickness_changed1() void MainWindow::tissuenr_changed(int i) { QWidget* qw = methodTab->visibleWidget(); - - if (qw == iftrg_widget) - iftrg_widget->tissuenr_changed(i); - else if (qw == interpolwidget) - interpolwidget->tissuenr_changed(i); + if (auto tool = dynamic_cast(qw)) + { + tool->on_tissuenr_changed(i); + } bmp_show->color_changed(i); work_show->color_changed(i); - OutlineCorrect_widget->tissuenr_changed(i); bitstack_widget->tissuenr_changed(i); cb_tissuelock->setChecked(TissueInfos::GetTissueLocked(i + 1)); @@ -7421,8 +7086,10 @@ void MainWindow::tree_widget_contextmenu(const QPoint& pos) contextMenu.insertSeparator(); contextMenu.insertItem("New Tissue...", this, SLOT(newTissuePressed())); contextMenu.insertItem("New Folder...", this, SLOT(newFolderPressed())); - contextMenu.insertItem("Mod. Folder...", this, SLOT(modifTissueFolderPressed())); - contextMenu.insertItem("Del. Folder...", this, SLOT(removeTissueFolderPressed())); + contextMenu.insertItem("Mod. Folder...", this, + SLOT(modifTissueFolderPressed())); + contextMenu.insertItem("Del. Folder...", this, + SLOT(removeTissueFolderPressed())); } else { @@ -7430,21 +7097,26 @@ void MainWindow::tree_widget_contextmenu(const QPoint& pos) contextMenu.insertSeparator(); contextMenu.insertItem("New Tissue...", this, SLOT(newTissuePressed())); contextMenu.insertItem("New Folder...", this, SLOT(newFolderPressed())); - contextMenu.insertItem("Mod. Tissue...", this, SLOT(modifTissueFolderPressed())); - contextMenu.insertItem("Del. Tissue...", this, SLOT(removeTissueFolderPressed())); + contextMenu.insertItem("Mod. Tissue...", this, + SLOT(modifTissueFolderPressed())); + contextMenu.insertItem("Del. Tissue...", this, + SLOT(removeTissueFolderPressed())); contextMenu.insertSeparator(); contextMenu.insertItem("Get Tissue", this, SLOT(tissue2work())); contextMenu.insertItem("Clear Tissue", this, SLOT(cleartissue())); contextMenu.insertSeparator(); - contextMenu.insertItem("Next Feat. Slice", this, SLOT(next_featuring_slice())); + contextMenu.insertItem("Next Feat. Slice", this, + SLOT(next_featuring_slice())); } contextMenu.insertSeparator(); - int itemId = - contextMenu.insertItem("Show Tissue Indices", tissueTreeWidget, SLOT(toggle_show_tissue_indices())); - contextMenu.setItemChecked( - itemId, !tissueTreeWidget->get_tissue_indices_hidden()); - contextMenu.insertItem("Sort By Name", tissueTreeWidget, SLOT(sort_by_tissue_name())); - contextMenu.insertItem("Sort By Index", tissueTreeWidget, SLOT(sort_by_tissue_index())); + int itemId = contextMenu.insertItem("Show Tissue Indices", tissueTreeWidget, + SLOT(toggle_show_tissue_indices())); + contextMenu.setItemChecked(itemId, + !tissueTreeWidget->get_tissue_indices_hidden()); + contextMenu.insertItem("Sort By Name", tissueTreeWidget, + SLOT(sort_by_tissue_name())); + contextMenu.insertItem("Sort By Index", tissueTreeWidget, + SLOT(sort_by_tissue_index())); contextMenu.exec(tissueTreeWidget->viewport()->mapToGlobal(pos)); } else // multi-selection @@ -7469,11 +7141,10 @@ void MainWindow::tissuelock_toggled() std::map childTissues; tissueTreeWidget->get_current_child_tissues(childTissues); for (std::map::iterator iter = - childTissues.begin(); - iter != childTissues.end(); ++iter) + childTissues.begin(); + iter != childTissues.end(); ++iter) { - TissueInfos::SetTissueLocked(iter->first, - cb_tissuelock->isChecked()); + TissueInfos::SetTissueLocked(iter->first, cb_tissuelock->isChecked()); } } else @@ -7485,8 +7156,7 @@ void MainWindow::tissuelock_toggled() QTreeWidgetItem* item = *a; tissues_size_t currTissueType = tissueTreeWidget->get_type(item); //tissues_size_t currTissueType = tissueTreeWidget->get_current_type(); - TissueInfos::SetTissueLocked(currTissueType, - cb_tissuelock->isChecked()); + TissueInfos::SetTissueLocked(currTissueType, cb_tissuelock->isChecked()); } } tissueTreeWidget->update_tissue_icons(); @@ -7584,241 +7254,154 @@ void MainWindow::do_clearundo() void MainWindow::tab_changed(QWidget* qw) { - // int index=methodTab->currentPageIndex(); if (qw != tab_old) { std::cerr << "Starting widget: " << qw->metaObject()->className() << std::endl; - /* if(qw==threshold_widget||qw==wshed_widget||qw==hyst_widget||qw==iftrg_widget|| - qw==FMF_widget||qw==OutlineCorrect_widget){ - bmp_show->set_workbordervisible(true); - cb_bmpoutlinevisible->setChecked(true); - } else { - bmp_show->set_workbordervisible(false); - cb_bmpoutlinevisible->setChecked(false); - }*/ + // disconnect signal-slots of previous widget + + if (tab_old) // generic slots from WidgetInterface + { + tab_old->cleanup(); + + QObject::disconnect(bmp_show, SIGNAL(mousepressed_sign(Point)), tab_old, + SLOT(mouse_clicked(Point))); + QObject::disconnect(bmp_show, SIGNAL(mousemoved_sign(Point)), tab_old, + SLOT(mouse_moved(Point))); + QObject::disconnect(bmp_show, SIGNAL(mousereleased_sign(Point)), tab_old, + SLOT(mouse_released(Point))); + QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), tab_old, + SLOT(mouse_clicked(Point))); + QObject::disconnect(work_show, SIGNAL(mousemoved_sign(Point)), tab_old, + SLOT(mouse_moved(Point))); + QObject::disconnect(work_show, SIGNAL(mousereleased_sign(Point)), tab_old, + SLOT(mouse_released(Point))); + } if (tab_old == threshold_widget) { QObject::disconnect(this, SIGNAL(bmp_changed()), threshold_widget, - SLOT(bmp_changed())); + SLOT(bmp_changed())); } else if (tab_old == measurement_widget) { - measurement_widget->cleanup(); - // QObject::connect(this,SIGNAL(marks_changed()),work_show,SLOT(mark_changed())); - QObject::disconnect(this, SIGNAL(marks_changed()), - measurement_widget, SLOT(marks_changed())); - QObject::disconnect(bmp_show, SIGNAL(mousepressed_sign(Point)), - measurement_widget, SLOT(pt_clicked(Point))); - QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), - measurement_widget, SLOT(pt_clicked(Point))); + QObject::disconnect(this, SIGNAL(marks_changed()), measurement_widget, + SLOT(marks_changed())); QObject::disconnect(measurement_widget, - SIGNAL(vp1_changed(std::vector*)), - bmp_show, SLOT(set_vp1(std::vector*))); + SIGNAL(vp1_changed(std::vector*)), bmp_show, + SLOT(set_vp1(std::vector*))); QObject::disconnect(measurement_widget, - SIGNAL(vp1_changed(std::vector*)), - work_show, SLOT(set_vp1(std::vector*))); + SIGNAL(vp1_changed(std::vector*)), work_show, + SLOT(set_vp1(std::vector*))); QObject::disconnect(measurement_widget, - SIGNAL(vpdyn_changed(std::vector*)), - bmp_show, SLOT(set_vpdyn(std::vector*))); - QObject::disconnect( - measurement_widget, SIGNAL(vpdyn_changed(std::vector*)), - work_show, SLOT(set_vpdyn(std::vector*))); - QObject::disconnect( - measurement_widget, - SIGNAL(vp1dyn_changed(std::vector*, std::vector*, - bool)), - bmp_show, - SLOT(set_vp1_dyn(std::vector*, std::vector*, - bool))); - QObject::disconnect( - measurement_widget, - SIGNAL(vp1dyn_changed(std::vector*, std::vector*, - bool)), - work_show, - SLOT(set_vp1_dyn(std::vector*, std::vector*, - bool))); - QObject::disconnect(bmp_show, SIGNAL(mousemoved_sign(Point)), - measurement_widget, SLOT(pt_moved(Point))); - QObject::disconnect(work_show, SIGNAL(mousemoved_sign(Point)), - measurement_widget, SLOT(pt_moved(Point))); + SIGNAL(vpdyn_changed(std::vector*)), bmp_show, + SLOT(set_vpdyn(std::vector*))); + QObject::disconnect(measurement_widget, + SIGNAL(vpdyn_changed(std::vector*)), + work_show, SLOT(set_vpdyn(std::vector*))); + QObject::disconnect(measurement_widget, + SIGNAL(vp1dyn_changed(std::vector*, std::vector*, bool)), + bmp_show, SLOT(set_vp1_dyn(std::vector*, std::vector*, bool))); + QObject::disconnect(measurement_widget, + SIGNAL(vp1dyn_changed(std::vector*, std::vector*, bool)), + work_show, SLOT(set_vp1_dyn(std::vector*, std::vector*, bool))); work_show->setMouseTracking(false); bmp_show->setMouseTracking(false); } else if (tab_old == vesselextr_widget) { - vesselextr_widget->clean_up(); - QObject::disconnect(this, SIGNAL(marks_changed()), - measurement_widget, SLOT(marks_changed())); + QObject::disconnect(this, SIGNAL(marks_changed()), measurement_widget, + SLOT(marks_changed())); QObject::disconnect(vesselextr_widget, - SIGNAL(vp1_changed(std::vector*)), - bmp_show, SLOT(set_vp1(std::vector*))); + SIGNAL(vp1_changed(std::vector*)), bmp_show, + SLOT(set_vp1(std::vector*))); } else if (tab_old == wshed_widget) { - // QObject::connect(this,SIGNAL(marks_changed()),work_show,SLOT(mark_changed())); QObject::disconnect(this, SIGNAL(marks_changed()), wshed_widget, - SLOT(marks_changed())); + SLOT(marks_changed())); } else if (tab_old == hyst_widget) { - hyst_widget->clean_up(); - QObject::disconnect(this, SIGNAL(bmp_changed()), hyst_widget, - SLOT(bmp_changed())); - QObject::disconnect(bmp_show, SIGNAL(mousepressed_sign(Point)), - hyst_widget, SLOT(pt_clicked(Point))); - QObject::disconnect(bmp_show, SIGNAL(mousemoved_sign(Point)), - hyst_widget, SLOT(pt_moved(Point))); - QObject::disconnect(bmp_show, SIGNAL(mousereleased_sign(Point)), - hyst_widget, SLOT(pt_released(Point))); + SLOT(bmp_changed())); QObject::disconnect(hyst_widget, - SIGNAL(vp1_changed(std::vector*)), - bmp_show, SLOT(set_vp1(std::vector*))); + SIGNAL(vp1_changed(std::vector*)), bmp_show, + SLOT(set_vp1(std::vector*))); QObject::disconnect(hyst_widget, - SIGNAL(vpdyn_changed(std::vector*)), - bmp_show, SLOT(set_vpdyn(std::vector*))); + SIGNAL(vpdyn_changed(std::vector*)), bmp_show, + SLOT(set_vpdyn(std::vector*))); QObject::disconnect( - hyst_widget, - SIGNAL( - vp1dyn_changed(std::vector*, std::vector*)), - bmp_show, - SLOT(set_vp1_dyn(std::vector*, std::vector*))); + hyst_widget, + SIGNAL(vp1dyn_changed(std::vector*, std::vector*)), + bmp_show, + SLOT(set_vp1_dyn(std::vector*, std::vector*))); } else if (tab_old == lw_widget) { - lw_widget->cleanup(); - QObject::disconnect(this, SIGNAL(bmp_changed()), lw_widget, - SLOT(bmp_changed())); - QObject::disconnect(bmp_show, SIGNAL(mousepressed_sign(Point)), - lw_widget, SLOT(pt_clicked(Point))); + SLOT(bmp_changed())); QObject::disconnect(bmp_show, SIGNAL(mousedoubleclick_sign(Point)), - lw_widget, SLOT(pt_doubleclicked(Point))); + lw_widget, SLOT(pt_doubleclicked(Point))); QObject::disconnect(bmp_show, SIGNAL(mousepressedmid_sign(Point)), - lw_widget, SLOT(pt_midclicked(Point))); - QObject::disconnect(bmp_show, - SIGNAL(mousedoubleclickmid_sign(Point)), - lw_widget, SLOT(pt_doubleclickedmid(Point))); - QObject::disconnect(bmp_show, SIGNAL(mousemoved_sign(Point)), - lw_widget, SLOT(pt_moved(Point))); - QObject::disconnect(bmp_show, SIGNAL(mousereleased_sign(Point)), - lw_widget, SLOT(pt_released(Point))); + lw_widget, SLOT(pt_midclicked(Point))); + QObject::disconnect(bmp_show, SIGNAL(mousedoubleclickmid_sign(Point)), + lw_widget, SLOT(pt_doubleclickedmid(Point))); + QObject::disconnect(lw_widget, SIGNAL(vp1_changed(std::vector*)), + bmp_show, SLOT(set_vp1(std::vector*))); QObject::disconnect(lw_widget, - SIGNAL(vp1_changed(std::vector*)), - bmp_show, SLOT(set_vp1(std::vector*))); - QObject::disconnect(lw_widget, - SIGNAL(vpdyn_changed(std::vector*)), - bmp_show, SLOT(set_vpdyn(std::vector*))); + SIGNAL(vpdyn_changed(std::vector*)), bmp_show, + SLOT(set_vpdyn(std::vector*))); QObject::disconnect( - lw_widget, - SIGNAL( - vp1dyn_changed(std::vector*, std::vector*)), - bmp_show, - SLOT(set_vp1_dyn(std::vector*, std::vector*))); + lw_widget, + SIGNAL(vp1dyn_changed(std::vector*, std::vector*)), + bmp_show, + SLOT(set_vp1_dyn(std::vector*, std::vector*))); bmp_show->setMouseTracking(false); } else if (tab_old == iftrg_widget) { - iftrg_widget->cleanup(); - QObject::disconnect(this, SIGNAL(bmp_changed()), iftrg_widget, - SLOT(bmp_changed())); - - QObject::disconnect(bmp_show, SIGNAL(mousepressed_sign(Point)), - iftrg_widget, SLOT(mouse_clicked(Point))); - QObject::disconnect(bmp_show, SIGNAL(mousereleased_sign(Point)), - iftrg_widget, SLOT(mouse_released(Point))); - QObject::disconnect(bmp_show, SIGNAL(mousemoved_sign(Point)), - iftrg_widget, SLOT(mouse_moved(Point))); + SLOT(bmp_changed())); + QObject::disconnect(iftrg_widget, SIGNAL(vm_changed(std::vector*)), + bmp_show, SLOT(set_vm(std::vector*))); QObject::disconnect(iftrg_widget, - SIGNAL(vm_changed(std::vector*)), - bmp_show, SLOT(set_vm(std::vector*))); - QObject::disconnect(iftrg_widget, - SIGNAL(vmdyn_changed(std::vector*)), - bmp_show, SLOT(set_vpdyn(std::vector*))); - - // QObject::disconnect(tissueTreeWidget,SIGNAL(activated(int)),iftrg_widget,SLOT(tissuenr_changed(int))); - // QObject::disconnect(tissueTreeWidget,SIGNAL(activated(int)),this,SLOT(tissuenr_changed(int))); + SIGNAL(vmdyn_changed(std::vector*)), bmp_show, + SLOT(set_vpdyn(std::vector*))); } else if (tab_old == FMF_widget) { - FMF_widget->cleanup(); - QObject::disconnect(this, SIGNAL(bmp_changed()), FMF_widget, - SLOT(bmp_changed())); - - QObject::disconnect(bmp_show, SIGNAL(mousepressed_sign(Point)), - FMF_widget, SLOT(mouse_clicked(Point))); - QObject::disconnect(bmp_show, SIGNAL(mousereleased_sign(Point)), - FMF_widget, SLOT(mouse_released(Point))); - QObject::disconnect(bmp_show, SIGNAL(mousemoved_sign(Point)), - FMF_widget, SLOT(mouse_moved(Point))); + SLOT(bmp_changed())); QObject::disconnect(FMF_widget, - SIGNAL(vpdyn_changed(std::vector*)), - bmp_show, SLOT(set_vpdyn(std::vector*))); + SIGNAL(vpdyn_changed(std::vector*)), bmp_show, + SLOT(set_vpdyn(std::vector*))); } else if (tab_old == OutlineCorrect_widget) { - OutlineCorrect_widget->cleanup(); - QObject::disconnect(bmp_show, SIGNAL(mousepressed_sign(Point)), - OutlineCorrect_widget, - SLOT(mouse_clicked(Point))); - QObject::disconnect(bmp_show, SIGNAL(mousereleased_sign(Point)), - OutlineCorrect_widget, - SLOT(mouse_released(Point))); - QObject::disconnect(bmp_show, SIGNAL(mousemoved_sign(Point)), - OutlineCorrect_widget, - SLOT(mouse_moved(Point))); - - QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), - OutlineCorrect_widget, - SLOT(mouse_clicked(Point))); - QObject::disconnect(work_show, SIGNAL(mousereleased_sign(Point)), - OutlineCorrect_widget, - SLOT(mouse_released(Point))); - QObject::disconnect(work_show, SIGNAL(mousemoved_sign(Point)), - OutlineCorrect_widget, - SLOT(mouse_moved(Point))); - - QObject::disconnect(this, SIGNAL(work_changed()), - OutlineCorrect_widget, - SLOT(workbits_changed())); + QObject::disconnect(this, SIGNAL(work_changed()), OutlineCorrect_widget, + SLOT(workbits_changed())); QObject::disconnect(OutlineCorrect_widget, - SIGNAL(vpdyn_changed(std::vector*)), - bmp_show, SLOT(set_vpdyn(std::vector*))); + SIGNAL(vpdyn_changed(std::vector*)), bmp_show, + SLOT(set_vpdyn(std::vector*))); QObject::disconnect(OutlineCorrect_widget, - SIGNAL(vpdyn_changed(std::vector*)), - work_show, - SLOT(set_vpdyn(std::vector*))); + SIGNAL(vpdyn_changed(std::vector*)), + work_show, SLOT(set_vpdyn(std::vector*))); } else if (tab_old == feature_widget) { - QObject::disconnect(bmp_show, SIGNAL(mousepressed_sign(Point)), - feature_widget, SLOT(pt_clicked(Point))); - QObject::disconnect(bmp_show, SIGNAL(mousemoved_sign(Point)), - feature_widget, SLOT(pt_moved(Point))); - QObject::disconnect(bmp_show, SIGNAL(mousereleased_sign(Point)), - feature_widget, SLOT(pt_released(Point))); - QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), - feature_widget, SLOT(pt_clicked(Point))); - QObject::disconnect(work_show, SIGNAL(mousemoved_sign(Point)), - feature_widget, SLOT(kpt_moved(Point))); - QObject::disconnect(work_show, SIGNAL(mousereleased_sign(Point)), - feature_widget, SLOT(pt_released(Point))); QObject::disconnect(feature_widget, - SIGNAL(vpdyn_changed(std::vector*)), - bmp_show, SLOT(set_vpdyn(std::vector*))); - QObject::disconnect( - feature_widget, SIGNAL(vpdyn_changed(std::vector*)), - work_show, SLOT(set_vpdyn(std::vector*))); + SIGNAL(vpdyn_changed(std::vector*)), bmp_show, + SLOT(set_vpdyn(std::vector*))); + QObject::disconnect(feature_widget, + SIGNAL(vpdyn_changed(std::vector*)), + work_show, SLOT(set_vpdyn(std::vector*))); work_show->setMouseTracking(false); bmp_show->setMouseTracking(false); @@ -7830,291 +7413,201 @@ void MainWindow::tab_changed(QWidget* qw) } else if (tab_old == pickerwidget) { - pickerwidget->cleanup(); - QObject::disconnect(bmp_show, SIGNAL(mousepressed_sign(Point)), - pickerwidget, SLOT(pt_clicked(Point))); - QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), - pickerwidget, SLOT(pt_clicked(Point))); - QObject::disconnect(pickerwidget, - SIGNAL(vp1_changed(std::vector*)), - bmp_show, SLOT(set_vp1(std::vector*))); + SIGNAL(vp1_changed(std::vector*)), bmp_show, + SLOT(set_vp1(std::vector*))); QObject::disconnect(pickerwidget, - SIGNAL(vp1_changed(std::vector*)), - work_show, SLOT(set_vp1(std::vector*))); + SIGNAL(vp1_changed(std::vector*)), work_show, + SLOT(set_vp1(std::vector*))); } else if (tab_old == transfrmWidget) { - transfrmWidget->cleanup(); - QObject::disconnect(bmp_show, SIGNAL(mousepressed_sign(Point)), - transfrmWidget, SLOT(pt_clicked(Point))); - QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), - transfrmWidget, SLOT(pt_clicked(Point))); QObject::disconnect(this, SIGNAL(bmp_changed()), transfrmWidget, - SLOT(bmp_changed())); + SLOT(bmp_changed())); QObject::disconnect(this, SIGNAL(work_changed()), transfrmWidget, - SLOT(work_changed())); + SLOT(work_changed())); QObject::disconnect(this, SIGNAL(tissues_changed()), transfrmWidget, - SLOT(tissues_changed())); + SLOT(tissues_changed())); + } + + // connect signal-slots new widget + + if (auto widget = dynamic_cast(qw)) // generic slots from WidgetInterface + { + QObject::connect(bmp_show, SIGNAL(mousepressed_sign(Point)), qw, + SLOT(mouse_clicked(Point))); + QObject::connect(bmp_show, SIGNAL(mousemoved_sign(Point)), qw, + SLOT(mouse_moved(Point))); + QObject::connect(bmp_show, SIGNAL(mousereleased_sign(Point)), qw, + SLOT(mouse_released(Point))); + QObject::connect(work_show, SIGNAL(mousepressed_sign(Point)), qw, + SLOT(mouse_clicked(Point))); + QObject::connect(work_show, SIGNAL(mousemoved_sign(Point)), qw, + SLOT(mouse_moved(Point))); + QObject::connect(work_show, SIGNAL(mousereleased_sign(Point)), qw, + SLOT(mouse_released(Point))); } if (qw == threshold_widget) { QObject::connect(this, SIGNAL(bmp_changed()), threshold_widget, - SLOT(bmp_changed())); - // threshold_widget->init(); + SLOT(bmp_changed())); } else if (qw == measurement_widget) { QObject::connect(this, SIGNAL(marks_changed()), measurement_widget, - SLOT(marks_changed())); - QObject::connect(bmp_show, SIGNAL(mousepressed_sign(Point)), - measurement_widget, SLOT(pt_clicked(Point))); - QObject::connect(work_show, SIGNAL(mousepressed_sign(Point)), - measurement_widget, SLOT(pt_clicked(Point))); + SLOT(marks_changed())); QObject::connect(measurement_widget, - SIGNAL(vp1_changed(std::vector*)), bmp_show, - SLOT(set_vp1(std::vector*))); + SIGNAL(vp1_changed(std::vector*)), bmp_show, + SLOT(set_vp1(std::vector*))); QObject::connect(measurement_widget, - SIGNAL(vp1_changed(std::vector*)), - work_show, SLOT(set_vp1(std::vector*))); + SIGNAL(vp1_changed(std::vector*)), work_show, + SLOT(set_vp1(std::vector*))); QObject::connect(measurement_widget, - SIGNAL(vpdyn_changed(std::vector*)), - bmp_show, SLOT(set_vpdyn(std::vector*))); + SIGNAL(vpdyn_changed(std::vector*)), bmp_show, + SLOT(set_vpdyn(std::vector*))); QObject::connect(measurement_widget, - SIGNAL(vpdyn_changed(std::vector*)), - work_show, SLOT(set_vpdyn(std::vector*))); + SIGNAL(vpdyn_changed(std::vector*)), work_show, + SLOT(set_vpdyn(std::vector*))); QObject::connect(measurement_widget, - SIGNAL(vp1dyn_changed(std::vector*, - std::vector*, bool)), - bmp_show, - SLOT(set_vp1_dyn(std::vector*, - std::vector*, bool))); + SIGNAL(vp1dyn_changed(std::vector*, std::vector*, bool)), + bmp_show, SLOT(set_vp1_dyn(std::vector*, std::vector*, bool))); QObject::connect(measurement_widget, - SIGNAL(vp1dyn_changed(std::vector*, - std::vector*, bool)), - work_show, - SLOT(set_vp1_dyn(std::vector*, - std::vector*, bool))); - QObject::connect(bmp_show, SIGNAL(mousemoved_sign(Point)), - measurement_widget, SLOT(pt_moved(Point))); - QObject::connect(work_show, SIGNAL(mousemoved_sign(Point)), - measurement_widget, SLOT(pt_moved(Point))); + SIGNAL(vp1dyn_changed(std::vector*, std::vector*, bool)), + work_show, SLOT(set_vp1_dyn(std::vector*, std::vector*, bool))); + work_show->setMouseTracking(true); bmp_show->setMouseTracking(true); } else if (qw == vesselextr_widget) { QObject::connect(this, SIGNAL(marks_changed()), vesselextr_widget, - SLOT(marks_changed())); + SLOT(marks_changed())); QObject::connect(vesselextr_widget, - SIGNAL(vp1_changed(std::vector*)), bmp_show, - SLOT(set_vp1(std::vector*))); + SIGNAL(vp1_changed(std::vector*)), bmp_show, + SLOT(set_vp1(std::vector*))); } else if (qw == wshed_widget) { - // QObject::disconnect(this,SIGNAL(marks_changed()),work_show,SLOT(mark_changed())); QObject::connect(this, SIGNAL(marks_changed()), wshed_widget, - SLOT(marks_changed())); - // wshed_widget->init(); + SLOT(marks_changed())); } else if (qw == hyst_widget) { QObject::connect(this, SIGNAL(bmp_changed()), hyst_widget, - SLOT(bmp_changed())); - QObject::connect(bmp_show, SIGNAL(mousepressed_sign(Point)), - hyst_widget, SLOT(pt_clicked(Point))); - QObject::connect(bmp_show, SIGNAL(mousemoved_sign(Point)), - hyst_widget, SLOT(pt_moved(Point))); - QObject::connect(bmp_show, SIGNAL(mousereleased_sign(Point)), - hyst_widget, SLOT(pt_released(Point))); - - QObject::connect(hyst_widget, - SIGNAL(vp1_changed(std::vector*)), bmp_show, - SLOT(set_vp1(std::vector*))); - QObject::connect(hyst_widget, - SIGNAL(vpdyn_changed(std::vector*)), - bmp_show, SLOT(set_vpdyn(std::vector*))); - QObject::connect( - hyst_widget, - SIGNAL( - vp1dyn_changed(std::vector*, std::vector*)), - bmp_show, - SLOT(set_vp1_dyn(std::vector*, std::vector*))); + SLOT(bmp_changed())); - // hyst_widget->init(); + QObject::connect(hyst_widget, SIGNAL(vp1_changed(std::vector*)), + bmp_show, SLOT(set_vp1(std::vector*))); + QObject::connect(hyst_widget, SIGNAL(vpdyn_changed(std::vector*)), + bmp_show, SLOT(set_vpdyn(std::vector*))); + QObject::connect( + hyst_widget, + SIGNAL(vp1dyn_changed(std::vector*, std::vector*)), + bmp_show, + SLOT(set_vp1_dyn(std::vector*, std::vector*))); } else if (qw == lw_widget) { QObject::connect(this, SIGNAL(bmp_changed()), lw_widget, - SLOT(bmp_changed())); - QObject::connect(bmp_show, SIGNAL(mousepressed_sign(Point)), - lw_widget, SLOT(pt_clicked(Point))); + SLOT(bmp_changed())); QObject::connect(bmp_show, SIGNAL(mousedoubleclick_sign(Point)), - lw_widget, SLOT(pt_doubleclicked(Point))); - QObject::connect(bmp_show, SIGNAL(mousepressedmid_sign(Point)), - lw_widget, SLOT(pt_midclicked(Point))); + lw_widget, SLOT(pt_doubleclicked(Point))); + QObject::connect(bmp_show, SIGNAL(mousepressedmid_sign(Point)), lw_widget, + SLOT(pt_midclicked(Point))); QObject::connect(bmp_show, SIGNAL(mousedoubleclickmid_sign(Point)), - lw_widget, SLOT(pt_doubleclickedmid(Point))); - QObject::connect(bmp_show, SIGNAL(mousemoved_sign(Point)), - lw_widget, SLOT(pt_moved(Point))); - QObject::connect(bmp_show, SIGNAL(mousereleased_sign(Point)), - lw_widget, SLOT(pt_released(Point))); + lw_widget, SLOT(pt_doubleclickedmid(Point))); + QObject::connect(lw_widget, SIGNAL(vp1_changed(std::vector*)), + bmp_show, SLOT(set_vp1(std::vector*))); + QObject::connect(lw_widget, SIGNAL(vpdyn_changed(std::vector*)), + bmp_show, SLOT(set_vpdyn(std::vector*))); QObject::connect(lw_widget, - SIGNAL(vp1_changed(std::vector*)), bmp_show, - SLOT(set_vp1(std::vector*))); - QObject::connect(lw_widget, - SIGNAL(vpdyn_changed(std::vector*)), - bmp_show, SLOT(set_vpdyn(std::vector*))); - QObject::connect( - lw_widget, - SIGNAL( - vp1dyn_changed(std::vector*, std::vector*)), - bmp_show, - SLOT(set_vp1_dyn(std::vector*, std::vector*))); + SIGNAL(vp1dyn_changed(std::vector*, std::vector*)), + bmp_show, SLOT(set_vp1_dyn(std::vector*, std::vector*))); - // lw_widget->init(); bmp_show->setMouseTracking(true); } else if (qw == iftrg_widget) { - tissues_size_t currTissueType = - tissueTreeWidget->get_current_type(); - iftrg_widget->tissuenr_changed(currTissueType); - QObject::connect(this, SIGNAL(bmp_changed()), iftrg_widget, - SLOT(bmp_changed())); + SLOT(bmp_changed())); - QObject::connect(bmp_show, SIGNAL(mousepressed_sign(Point)), - iftrg_widget, SLOT(mouse_clicked(Point))); - QObject::connect(bmp_show, SIGNAL(mousereleased_sign(Point)), - iftrg_widget, SLOT(mouse_released(Point))); - QObject::connect(bmp_show, SIGNAL(mousemoved_sign(Point)), - iftrg_widget, SLOT(mouse_moved(Point))); - - QObject::connect(iftrg_widget, - SIGNAL(vm_changed(std::vector*)), bmp_show, - SLOT(set_vm(std::vector*))); + QObject::connect(iftrg_widget, SIGNAL(vm_changed(std::vector*)), + bmp_show, SLOT(set_vm(std::vector*))); QObject::connect(iftrg_widget, - SIGNAL(vmdyn_changed(std::vector*)), - bmp_show, SLOT(set_vpdyn(std::vector*))); + SIGNAL(vmdyn_changed(std::vector*)), bmp_show, + SLOT(set_vpdyn(std::vector*))); } else if (qw == FMF_widget) { QObject::connect(this, SIGNAL(bmp_changed()), FMF_widget, - SLOT(bmp_changed())); - - QObject::connect(bmp_show, SIGNAL(mousepressed_sign(Point)), - FMF_widget, SLOT(mouse_clicked(Point))); - QObject::connect(bmp_show, SIGNAL(mousereleased_sign(Point)), - FMF_widget, SLOT(mouse_released(Point))); - QObject::connect(bmp_show, SIGNAL(mousemoved_sign(Point)), - FMF_widget, SLOT(mouse_moved(Point))); - - QObject::connect(FMF_widget, - SIGNAL(vpdyn_changed(std::vector*)), - bmp_show, SLOT(set_vpdyn(std::vector*))); + SLOT(bmp_changed())); + + QObject::connect(FMF_widget, SIGNAL(vpdyn_changed(std::vector*)), + bmp_show, SLOT(set_vpdyn(std::vector*))); } else if (qw == OutlineCorrect_widget) { - QObject::connect(bmp_show, SIGNAL(mousepressed_sign(Point)), - OutlineCorrect_widget, SLOT(mouse_clicked(Point))); - QObject::connect(bmp_show, SIGNAL(mousereleased_sign(Point)), - OutlineCorrect_widget, - SLOT(mouse_released(Point))); - QObject::connect(bmp_show, SIGNAL(mousemoved_sign(Point)), - OutlineCorrect_widget, SLOT(mouse_moved(Point))); - - QObject::connect(work_show, SIGNAL(mousepressed_sign(Point)), - OutlineCorrect_widget, SLOT(mouse_clicked(Point))); - QObject::connect(work_show, SIGNAL(mousereleased_sign(Point)), - OutlineCorrect_widget, - SLOT(mouse_released(Point))); - QObject::connect(work_show, SIGNAL(mousemoved_sign(Point)), - OutlineCorrect_widget, SLOT(mouse_moved(Point))); - - QObject::connect(this, SIGNAL(work_changed()), - OutlineCorrect_widget, SLOT(workbits_changed())); + QObject::connect(this, SIGNAL(work_changed()), OutlineCorrect_widget, + SLOT(workbits_changed())); QObject::connect(OutlineCorrect_widget, - SIGNAL(vpdyn_changed(std::vector*)), - bmp_show, SLOT(set_vpdyn(std::vector*))); + SIGNAL(vpdyn_changed(std::vector*)), bmp_show, + SLOT(set_vpdyn(std::vector*))); QObject::connect(OutlineCorrect_widget, - SIGNAL(vpdyn_changed(std::vector*)), - work_show, SLOT(set_vpdyn(std::vector*))); + SIGNAL(vpdyn_changed(std::vector*)), work_show, + SLOT(set_vpdyn(std::vector*))); OutlineCorrect_widget->workbits_changed(); - // OutlineCorrect_widget->init(); } else if (qw == feature_widget) { - QObject::connect(bmp_show, SIGNAL(mousepressed_sign(Point)), - feature_widget, SLOT(pt_clicked(Point))); - QObject::connect(bmp_show, SIGNAL(mousemoved_sign(Point)), - feature_widget, SLOT(pt_moved(Point))); - QObject::connect(bmp_show, SIGNAL(mousereleased_sign(Point)), - feature_widget, SLOT(pt_released(Point))); - QObject::connect(work_show, SIGNAL(mousepressed_sign(Point)), - feature_widget, SLOT(pt_clicked(Point))); - QObject::connect(work_show, SIGNAL(mousemoved_sign(Point)), - feature_widget, SLOT(pt_moved(Point))); - QObject::connect(work_show, SIGNAL(mousereleased_sign(Point)), - feature_widget, SLOT(pt_released(Point))); QObject::connect(feature_widget, - SIGNAL(vpdyn_changed(std::vector*)), - bmp_show, SLOT(set_vpdyn(std::vector*))); + SIGNAL(vpdyn_changed(std::vector*)), bmp_show, + SLOT(set_vpdyn(std::vector*))); QObject::connect(feature_widget, - SIGNAL(vpdyn_changed(std::vector*)), - work_show, SLOT(set_vpdyn(std::vector*))); + SIGNAL(vpdyn_changed(std::vector*)), work_show, + SLOT(set_vpdyn(std::vector*))); work_show->setMouseTracking(true); bmp_show->setMouseTracking(true); - // feature_widget->init(); } else if (qw == interpolwidget) { - // QObject::connect(tissueTreeWidget,SIGNAL(activated(int)),interpolwidget,SLOT(tissuenr_changed(int))); - // QObject::connect(tissueTreeWidget,SIGNAL(activated(int)),this,SLOT(tissuenr_changed(int))); + // anything? } else if (qw == pickerwidget) { - QObject::connect(bmp_show, SIGNAL(mousepressed_sign(Point)), - pickerwidget, SLOT(pt_clicked(Point))); - QObject::connect(work_show, SIGNAL(mousepressed_sign(Point)), - pickerwidget, SLOT(pt_clicked(Point))); - QObject::connect(pickerwidget, SIGNAL(vp1_changed(vector*)), - bmp_show, SLOT(set_vp1(vector*))); + bmp_show, SLOT(set_vp1(vector*))); QObject::connect(pickerwidget, SIGNAL(vp1_changed(vector*)), - work_show, SLOT(set_vp1(vector*))); + work_show, SLOT(set_vp1(vector*))); } else if (qw == transfrmWidget) { - QObject::connect(bmp_show, SIGNAL(mousepressed_sign(Point)), - transfrmWidget, SLOT(pt_clicked(Point))); - QObject::connect(work_show, SIGNAL(mousepressed_sign(Point)), - transfrmWidget, SLOT(pt_clicked(Point))); QObject::connect(this, SIGNAL(bmp_changed()), transfrmWidget, - SLOT(bmp_changed())); + SLOT(bmp_changed())); QObject::connect(this, SIGNAL(work_changed()), transfrmWidget, - SLOT(work_changed())); + SLOT(work_changed())); QObject::connect(this, SIGNAL(tissues_changed()), transfrmWidget, - SLOT(tissues_changed())); + SLOT(tissues_changed())); } tab_old = (WidgetInterface*)qw; tab_old->init(); - bmp_show->setCursor(*(tab_old->m_cursor)); - work_show->setCursor(*(tab_old->m_cursor)); + tab_old->on_tissuenr_changed(tissueTreeWidget->get_current_type() - 1); // \todo BL: is this correct for all widgets? + + bmp_show->setCursor(*(tab_old->get_cursor())); + work_show->setCursor(*(tab_old->get_cursor())); updateMethodButtonsPressed(tab_old); } else + { tab_old = (WidgetInterface*)qw; + } tab_old->setFocus(); - - return; } void MainWindow::updateTabvisibility() @@ -8181,7 +7674,7 @@ void MainWindow::updateMethodButtonsPressed(WidgetInterface* qw) } for (unsigned short i = (nrtabbuttons + 1) / 2; counter1 < counter; - i++, counter1++) + i++, counter1++) { if (counter1 == pos) pb_tab[i]->setOn(true); @@ -8190,7 +7683,7 @@ void MainWindow::updateMethodButtonsPressed(WidgetInterface* qw) } } -void MainWindow::LoadAtlas(QDir path1) +void MainWindow::LoadAtlas(const QDir& path1) { m_atlasfilename.m_atlasdir = path1; QStringList filters; @@ -8204,7 +7697,7 @@ void MainWindow::LoadAtlas(QDir path1) m_atlasfilename.m_atlasfilename[i] = names1[i]; QFileInfo names1fi(names1[i]); atlasmenu->changeItem(m_atlasfilename.atlasnr[i], - names1fi.completeBaseName()); + names1fi.completeBaseName()); atlasmenu->setItemVisible(m_atlasfilename.atlasnr[i], true); } for (size_t i = m_atlasfilename.nratlases; i < m_atlasfilename.maxnr; i++) @@ -8216,7 +7709,7 @@ void MainWindow::LoadAtlas(QDir path1) atlasmenu->setItemVisible(m_atlasfilename.separatornr, true); } -void MainWindow::LoadLoadProj(QString path1) +void MainWindow::LoadLoadProj(const QString& path1) { unsigned short projcounter = 0; FILE* fplatestproj = fopen(path1.ascii(), "r"); @@ -8237,19 +7730,19 @@ void MainWindow::LoadLoadProj(QString path1) fclose(fplatestproj); } -void MainWindow::AddLoadProj(QString path1) +void MainWindow::AddLoadProj(const QString& path1) { if (m_loadprojfilename.m_loadprojfilename1 != path1 && - m_loadprojfilename.m_loadprojfilename2 != path1 && - m_loadprojfilename.m_loadprojfilename3 != path1 && - m_loadprojfilename.m_loadprojfilename4 != path1) + m_loadprojfilename.m_loadprojfilename2 != path1 && + m_loadprojfilename.m_loadprojfilename3 != path1 && + m_loadprojfilename.m_loadprojfilename4 != path1) { m_loadprojfilename.m_loadprojfilename4 = - m_loadprojfilename.m_loadprojfilename3; + m_loadprojfilename.m_loadprojfilename3; m_loadprojfilename.m_loadprojfilename3 = - m_loadprojfilename.m_loadprojfilename2; + m_loadprojfilename.m_loadprojfilename2; m_loadprojfilename.m_loadprojfilename2 = - m_loadprojfilename.m_loadprojfilename1; + m_loadprojfilename.m_loadprojfilename1; m_loadprojfilename.m_loadprojfilename1 = path1; } else @@ -8258,21 +7751,21 @@ void MainWindow::AddLoadProj(QString path1) { QString dummy = m_loadprojfilename.m_loadprojfilename2; m_loadprojfilename.m_loadprojfilename2 = - m_loadprojfilename.m_loadprojfilename1; + m_loadprojfilename.m_loadprojfilename1; m_loadprojfilename.m_loadprojfilename1 = dummy; } if (m_loadprojfilename.m_loadprojfilename3 == path1) { QString dummy = m_loadprojfilename.m_loadprojfilename3; m_loadprojfilename.m_loadprojfilename3 = - m_loadprojfilename.m_loadprojfilename1; + m_loadprojfilename.m_loadprojfilename1; m_loadprojfilename.m_loadprojfilename1 = dummy; } if (m_loadprojfilename.m_loadprojfilename4 == path1) { QString dummy = m_loadprojfilename.m_loadprojfilename4; m_loadprojfilename.m_loadprojfilename4 = - m_loadprojfilename.m_loadprojfilename1; + m_loadprojfilename.m_loadprojfilename1; m_loadprojfilename.m_loadprojfilename1 = dummy; } } @@ -8281,10 +7774,10 @@ void MainWindow::AddLoadProj(QString path1) { int pos = m_loadprojfilename.m_loadprojfilename1.findRev('/', -2); if (pos != -1 && - (int)m_loadprojfilename.m_loadprojfilename1.length() > pos + 1) + (int)m_loadprojfilename.m_loadprojfilename1.length() > pos + 1) { QString name1 = m_loadprojfilename.m_loadprojfilename1.right( - m_loadprojfilename.m_loadprojfilename1.length() - pos - 1); + m_loadprojfilename.m_loadprojfilename1.length() - pos - 1); file->changeItem(m_loadprojfilename.lpf1nr, name1); file->setItemVisible(m_loadprojfilename.lpf1nr, true); } @@ -8293,10 +7786,10 @@ void MainWindow::AddLoadProj(QString path1) { int pos = m_loadprojfilename.m_loadprojfilename2.findRev('/', -2); if (pos != -1 && - (int)m_loadprojfilename.m_loadprojfilename2.length() > pos + 1) + (int)m_loadprojfilename.m_loadprojfilename2.length() > pos + 1) { QString name1 = m_loadprojfilename.m_loadprojfilename2.right( - m_loadprojfilename.m_loadprojfilename2.length() - pos - 1); + m_loadprojfilename.m_loadprojfilename2.length() - pos - 1); file->changeItem(m_loadprojfilename.lpf2nr, name1); file->setItemVisible(m_loadprojfilename.lpf2nr, true); } @@ -8305,10 +7798,10 @@ void MainWindow::AddLoadProj(QString path1) { int pos = m_loadprojfilename.m_loadprojfilename3.findRev('/', -2); if (pos != -1 && - (int)m_loadprojfilename.m_loadprojfilename3.length() > pos + 1) + (int)m_loadprojfilename.m_loadprojfilename3.length() > pos + 1) { QString name1 = m_loadprojfilename.m_loadprojfilename3.right( - m_loadprojfilename.m_loadprojfilename3.length() - pos - 1); + m_loadprojfilename.m_loadprojfilename3.length() - pos - 1); file->changeItem(m_loadprojfilename.lpf3nr, name1); file->setItemVisible(m_loadprojfilename.lpf3nr, true); } @@ -8317,10 +7810,10 @@ void MainWindow::AddLoadProj(QString path1) { int pos = m_loadprojfilename.m_loadprojfilename4.findRev('/', -2); if (pos != -1 && - (int)m_loadprojfilename.m_loadprojfilename4.length() > pos + 1) + (int)m_loadprojfilename.m_loadprojfilename4.length() > pos + 1) { QString name1 = m_loadprojfilename.m_loadprojfilename4.right( - m_loadprojfilename.m_loadprojfilename4.length() - pos - 1); + m_loadprojfilename.m_loadprojfilename4.length() - pos - 1); file->changeItem(m_loadprojfilename.lpf4nr, name1); file->setItemVisible(m_loadprojfilename.lpf4nr, true); } @@ -8328,7 +7821,7 @@ void MainWindow::AddLoadProj(QString path1) file->setItemVisible(m_loadprojfilename.separatornr, true); } -void MainWindow::SaveLoadProj(QString latestprojpath) +void MainWindow::SaveLoadProj(const QString& latestprojpath) { if (latestprojpath == QString("")) return; @@ -8478,24 +7971,21 @@ void MainWindow::execute_smoothtissues() void MainWindow::execute_cleanup() { - tissues_size_t** slices = - new tissues_size_t*[handler3D->return_endslice() - - handler3D->return_startslice()]; + tissues_size_t** slices = new tissues_size_t*[handler3D->return_endslice() - handler3D->return_startslice()]; tissuelayers_size_t activelayer = handler3D->get_active_tissuelayer(); for (unsigned short i = handler3D->return_startslice(); - i < handler3D->return_endslice(); i++) + i < handler3D->return_endslice(); i++) { slices[i - handler3D->return_startslice()] = - handler3D->return_tissues(activelayer, i); + handler3D->return_tissues(activelayer, i); } TissueCleaner TC( - slices, handler3D->return_endslice() - handler3D->return_startslice(), - handler3D->return_width(), handler3D->return_height()); + slices, handler3D->return_endslice() - handler3D->return_startslice(), + handler3D->return_width(), handler3D->return_height()); if (!TC.Allocate()) { QMessageBox::information( - 0, "iSeg", - "Not enough memory.\nThis operation cannot be performed.\n"); + 0, "iSeg", "Not enough memory.\nThis operation cannot be performed.\n"); } else { @@ -8520,11 +8010,10 @@ void MainWindow::execute_cleanup() void MainWindow::wheelrotated(int delta) { - zoom_widget->zoom_changed(work_show->return_zoom() * - pow(1.2, delta / 120.0)); + zoom_widget->zoom_changed(work_show->return_zoom() * pow(1.2, delta / 120.0)); } -void MainWindow::mousePosZoom_changed(QPoint point) +void MainWindow::mousePosZoom_changed(const QPoint& point) { bmp_show->setMousePosZoom(point); work_show->setMousePosZoom(point); @@ -8561,213 +8050,58 @@ FILE* MainWindow::load_notes(FILE* fp, unsigned short version) void MainWindow::disconnect_mouseclick() { - if (tab_old == measurement_widget) - { - QObject::disconnect(bmp_show, SIGNAL(mousepressed_sign(Point)), - measurement_widget, SLOT(pt_clicked(Point))); - QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), - measurement_widget, SLOT(pt_clicked(Point))); - QObject::disconnect(bmp_show, SIGNAL(mousemoved_sign(Point)), - measurement_widget, SLOT(pt_moved(Point))); - QObject::disconnect(work_show, SIGNAL(mousemoved_sign(Point)), - measurement_widget, SLOT(pt_moved(Point))); - } - else if (tab_old == hyst_widget) - { - QObject::disconnect(bmp_show, SIGNAL(mousepressed_sign(Point)), - hyst_widget, SLOT(pt_clicked(Point))); - QObject::disconnect(bmp_show, SIGNAL(mousemoved_sign(Point)), - hyst_widget, SLOT(pt_moved(Point))); - QObject::disconnect(bmp_show, SIGNAL(mousereleased_sign(Point)), - hyst_widget, SLOT(pt_released(Point))); - } - else if (tab_old == lw_widget) - { - QObject::disconnect(bmp_show, SIGNAL(mousepressed_sign(Point)), - lw_widget, SLOT(pt_clicked(Point))); - QObject::disconnect(bmp_show, SIGNAL(mousemoved_sign(Point)), lw_widget, - SLOT(pt_moved(Point))); - QObject::disconnect(bmp_show, SIGNAL(mousereleased_sign(Point)), - lw_widget, SLOT(pt_released(Point))); - } - else if (tab_old == iftrg_widget) - { - QObject::disconnect(bmp_show, SIGNAL(mousepressed_sign(Point)), - iftrg_widget, SLOT(mouse_clicked(Point))); - QObject::disconnect(bmp_show, SIGNAL(mousereleased_sign(Point)), - iftrg_widget, SLOT(mouse_released(Point))); - QObject::disconnect(bmp_show, SIGNAL(mousemoved_sign(Point)), - iftrg_widget, SLOT(mouse_moved(Point))); - } - else if (tab_old == FMF_widget) - { - QObject::disconnect(bmp_show, SIGNAL(mousepressed_sign(Point)), - FMF_widget, SLOT(mouse_clicked(Point))); - QObject::disconnect(bmp_show, SIGNAL(mousereleased_sign(Point)), - FMF_widget, SLOT(mouse_released(Point))); - QObject::disconnect(bmp_show, SIGNAL(mousemoved_sign(Point)), - FMF_widget, SLOT(mouse_moved(Point))); - } - else if (tab_old == OutlineCorrect_widget) - { - QObject::disconnect(bmp_show, SIGNAL(mousepressed_sign(Point)), - OutlineCorrect_widget, SLOT(mouse_clicked(Point))); - QObject::disconnect(bmp_show, SIGNAL(mousereleased_sign(Point)), - OutlineCorrect_widget, SLOT(mouse_released(Point))); - QObject::disconnect(bmp_show, SIGNAL(mousemoved_sign(Point)), - OutlineCorrect_widget, SLOT(mouse_moved(Point))); - - QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), - OutlineCorrect_widget, SLOT(mouse_clicked(Point))); - QObject::disconnect(work_show, SIGNAL(mousereleased_sign(Point)), - OutlineCorrect_widget, SLOT(mouse_released(Point))); - QObject::disconnect(work_show, SIGNAL(mousemoved_sign(Point)), - OutlineCorrect_widget, SLOT(mouse_moved(Point))); - } - else if (tab_old == feature_widget) - { - QObject::disconnect(bmp_show, SIGNAL(mousepressed_sign(Point)), - feature_widget, SLOT(pt_clicked(Point))); - QObject::disconnect(bmp_show, SIGNAL(mousemoved_sign(Point)), - feature_widget, SLOT(pt_moved(Point))); - QObject::disconnect(bmp_show, SIGNAL(mousereleased_sign(Point)), - feature_widget, SLOT(pt_released(Point))); - QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), - feature_widget, SLOT(pt_clicked(Point))); - QObject::disconnect(work_show, SIGNAL(mousemoved_sign(Point)), - feature_widget, SLOT(kpt_moved(Point))); - QObject::disconnect(work_show, SIGNAL(mousereleased_sign(Point)), - feature_widget, SLOT(pt_released(Point))); - } - else if (tab_old == pickerwidget) - { - QObject::disconnect(bmp_show, SIGNAL(mousepressed_sign(Point)), - pickerwidget, SLOT(pt_clicked(Point))); - QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), - pickerwidget, SLOT(pt_clicked(Point))); - } - else if (tab_old == transfrmWidget) - { - QObject::disconnect(bmp_show, SIGNAL(mousepressed_sign(Point)), - transfrmWidget, SLOT(pt_clicked(Point))); - QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), - transfrmWidget, SLOT(pt_clicked(Point))); + if (tab_old) + { + QObject::disconnect(bmp_show, SIGNAL(mousepressed_sign(Point)), tab_old, + SLOT(mouse_clicked(Point))); + QObject::disconnect(bmp_show, SIGNAL(mousereleased_sign(Point)), tab_old, + SLOT(mouse_released(Point))); + QObject::disconnect(bmp_show, SIGNAL(mousemoved_sign(Point)), tab_old, + SLOT(mouse_moved(Point))); + + QObject::disconnect(work_show, SIGNAL(mousepressed_sign(Point)), tab_old, + SLOT(mouse_clicked(Point))); + QObject::disconnect(work_show, SIGNAL(mousereleased_sign(Point)), tab_old, + SLOT(mouse_released(Point))); + QObject::disconnect(work_show, SIGNAL(mousemoved_sign(Point)), tab_old, + SLOT(mouse_moved(Point))); } } void MainWindow::connect_mouseclick() { - if (tab_old == measurement_widget) - { - QObject::connect(bmp_show, SIGNAL(mousepressed_sign(Point)), - measurement_widget, SLOT(pt_clicked(Point))); - QObject::connect(work_show, SIGNAL(mousepressed_sign(Point)), - measurement_widget, SLOT(pt_clicked(Point))); - QObject::connect(bmp_show, SIGNAL(mousemoved_sign(Point)), - measurement_widget, SLOT(pt_moved(Point))); - QObject::connect(work_show, SIGNAL(mousemoved_sign(Point)), - measurement_widget, SLOT(pt_moved(Point))); - } - else if (tab_old == hyst_widget) - { - QObject::connect(bmp_show, SIGNAL(mousepressed_sign(Point)), - hyst_widget, SLOT(pt_clicked(Point))); - QObject::connect(bmp_show, SIGNAL(mousemoved_sign(Point)), hyst_widget, - SLOT(pt_moved(Point))); - QObject::connect(bmp_show, SIGNAL(mousereleased_sign(Point)), - hyst_widget, SLOT(pt_released(Point))); - } - else if (tab_old == lw_widget) - { - QObject::connect(bmp_show, SIGNAL(mousepressed_sign(Point)), lw_widget, - SLOT(pt_clicked(Point))); - QObject::connect(bmp_show, SIGNAL(mousemoved_sign(Point)), lw_widget, - SLOT(pt_moved(Point))); - QObject::connect(bmp_show, SIGNAL(mousereleased_sign(Point)), lw_widget, - SLOT(pt_released(Point))); - } - else if (tab_old == iftrg_widget) - { - QObject::connect(bmp_show, SIGNAL(mousepressed_sign(Point)), - iftrg_widget, SLOT(mouse_clicked(Point))); - QObject::connect(bmp_show, SIGNAL(mousereleased_sign(Point)), - iftrg_widget, SLOT(mouse_released(Point))); - QObject::connect(bmp_show, SIGNAL(mousemoved_sign(Point)), iftrg_widget, - SLOT(mouse_moved(Point))); - } - else if (tab_old == FMF_widget) - { - QObject::connect(bmp_show, SIGNAL(mousepressed_sign(Point)), FMF_widget, - SLOT(mouse_clicked(Point))); - QObject::connect(bmp_show, SIGNAL(mousereleased_sign(Point)), - FMF_widget, SLOT(mouse_released(Point))); - QObject::connect(bmp_show, SIGNAL(mousemoved_sign(Point)), FMF_widget, - SLOT(mouse_moved(Point))); - } - else if (tab_old == OutlineCorrect_widget) - { - QObject::connect(bmp_show, SIGNAL(mousepressed_sign(Point)), - OutlineCorrect_widget, SLOT(mouse_clicked(Point))); - QObject::connect(bmp_show, SIGNAL(mousereleased_sign(Point)), - OutlineCorrect_widget, SLOT(mouse_released(Point))); - QObject::connect(bmp_show, SIGNAL(mousemoved_sign(Point)), - OutlineCorrect_widget, SLOT(mouse_moved(Point))); - QObject::connect(work_show, SIGNAL(mousepressed_sign(Point)), - OutlineCorrect_widget, SLOT(mouse_clicked(Point))); - QObject::connect(work_show, SIGNAL(mousereleased_sign(Point)), - OutlineCorrect_widget, SLOT(mouse_released(Point))); - QObject::connect(work_show, SIGNAL(mousemoved_sign(Point)), - OutlineCorrect_widget, SLOT(mouse_moved(Point))); - } - else if (tab_old == feature_widget) - { - QObject::connect(bmp_show, SIGNAL(mousepressed_sign(Point)), - feature_widget, SLOT(pt_clicked(Point))); - QObject::connect(bmp_show, SIGNAL(mousemoved_sign(Point)), - feature_widget, SLOT(pt_moved(Point))); - QObject::connect(bmp_show, SIGNAL(mousereleased_sign(Point)), - feature_widget, SLOT(pt_released(Point))); - QObject::connect(work_show, SIGNAL(mousepressed_sign(Point)), - feature_widget, SLOT(pt_clicked(Point))); - QObject::connect(work_show, SIGNAL(mousemoved_sign(Point)), - feature_widget, SLOT(pt_moved(Point))); - QObject::connect(work_show, SIGNAL(mousereleased_sign(Point)), - feature_widget, SLOT(pt_released(Point))); - } - else if (tab_old == pickerwidget) - { - QObject::connect(bmp_show, SIGNAL(mousepressed_sign(Point)), - pickerwidget, SLOT(pt_clicked(Point))); - QObject::connect(work_show, SIGNAL(mousepressed_sign(Point)), - pickerwidget, SLOT(pt_clicked(Point))); - } - else if (tab_old == transfrmWidget) - { - QObject::connect(bmp_show, SIGNAL(mousepressed_sign(Point)), - transfrmWidget, SLOT(pt_clicked(Point))); - QObject::connect(work_show, SIGNAL(mousepressed_sign(Point)), - transfrmWidget, SLOT(pt_clicked(Point))); + if (tab_old) + { + QObject::connect(bmp_show, SIGNAL(mousepressed_sign(Point)), tab_old, + SLOT(mouse_clicked(Point))); + QObject::connect(bmp_show, SIGNAL(mousereleased_sign(Point)), tab_old, + SLOT(mouse_released(Point))); + QObject::connect(bmp_show, SIGNAL(mousemoved_sign(Point)), tab_old, + SLOT(mouse_moved(Point))); + QObject::connect(work_show, SIGNAL(mousepressed_sign(Point)), tab_old, + SLOT(mouse_clicked(Point))); + QObject::connect(work_show, SIGNAL(mousereleased_sign(Point)), tab_old, + SLOT(mouse_released(Point))); + QObject::connect(work_show, SIGNAL(mousemoved_sign(Point)), tab_old, + SLOT(mouse_moved(Point))); } - - return; } void MainWindow::reconnectmouse_afterrelease(Point) { QObject::disconnect(work_show, SIGNAL(mousereleased_sign(Point)), this, - SLOT(reconnectmouse_afterrelease(Point))); + SLOT(reconnectmouse_afterrelease(Point))); connect_mouseclick(); } void MainWindow::handle_begin_datachange(iseg::DataSelection& dataSelection, - QWidget* sender, bool beginUndo) + QWidget* sender, bool beginUndo) { undoStarted = beginUndo || undoStarted; changeData = dataSelection; // Handle pending transforms - if (methodTab->visibleWidget() == transfrmWidget && - sender != transfrmWidget) + if (methodTab->visibleWidget() == transfrmWidget && sender != transfrmWidget) { cancel_transform_helper(); } @@ -8778,8 +8112,8 @@ void MainWindow::handle_begin_datachange(iseg::DataSelection& dataSelection, if (changeData.allSlices) { // Start undo for all slices - canUndo3D = handler3D->return_undo3D() && - handler3D->start_undoall(changeData); + canUndo3D = + handler3D->return_undo3D() && handler3D->start_undoall(changeData); } else { @@ -8789,14 +8123,6 @@ void MainWindow::handle_begin_datachange(iseg::DataSelection& dataSelection, } } -//void MainWindow::handle_abort_datachange(QWidget *sender, bool abortUndo) -//{ -// if (abortUndo) { -// handler3D->abort_undo(); -// undoStarted = false; -// } -//} - void MainWindow::end_undo_helper(iseg::EndUndoAction undoAction) { if (undoStarted) @@ -8841,7 +8167,7 @@ void MainWindow::end_undo_helper(iseg::EndUndoAction undoAction) } void MainWindow::handle_end_datachange(QWidget* sender, - iseg::EndUndoAction undoAction) + iseg::EndUndoAction undoAction) { // End undo end_undo_helper(undoAction); @@ -8859,13 +8185,13 @@ void MainWindow::handle_end_datachange(QWidget* sender, if (sender == methodTab->visibleWidget()) { QObject::disconnect(this, SIGNAL(bmp_changed()), sender, - SLOT(bmp_changed())); + SLOT(bmp_changed())); QObject::disconnect(this, SIGNAL(work_changed()), sender, - SLOT(work_changed())); + SLOT(work_changed())); QObject::disconnect(this, SIGNAL(tissues_changed()), sender, - SLOT(tissues_changed())); + SLOT(tissues_changed())); QObject::disconnect(this, SIGNAL(marks_changed()), sender, - SLOT(marks_changed())); + SLOT(marks_changed())); } // Signal changed data @@ -8887,6 +8213,7 @@ void MainWindow::handle_end_datachange(QWidget* sender, } // Signal changed data + // \hack BL this looks like a hack, fixme if (changeData.bmp && changeData.work && changeData.allSlices) { // Do not reinitialize m_MultiDataset_widget after swapping @@ -8902,97 +8229,14 @@ void MainWindow::handle_end_datachange(QWidget* sender, if (sender == methodTab->visibleWidget()) { - QObject::connect(this, SIGNAL(bmp_changed()), sender, - SLOT(bmp_changed())); - QObject::connect(this, SIGNAL(work_changed()), sender, - SLOT(work_changed())); - QObject::connect(this, SIGNAL(tissues_changed()), sender, - SLOT(tissues_changed())); - QObject::connect(this, SIGNAL(marks_changed()), sender, - SLOT(marks_changed())); - } - - //// Data loaded - //if (changeData.allSlices && changeData.bmp && changeData.work) - //{ - // emit main_dataset_loaded(); - //} -} - -void MainWindow::handle_end_datachange(QRect rect, QWidget* sender, - iseg::EndUndoAction undoAction) -{ - // End undo - end_undo_helper(undoAction); - - // Handle 3d data change - if (changeData.allSlices) - { - slices3d_changed(sender != bitstack_widget); - } - - // Update ranges - update_ranges_helper(); - -#if 0 // TODO: Introduce signals bmp_changed(QRect rect) etc - if (changeData.bmp) - { - update_bmp(rect); - } - if (changeData.work) - { - update_work(rect); - } - //if (changeData.tissues) { - // update_tissues(rect); - //} - //if (changeData.marks) { - // upate_marks(rect); - //} -#else - // Block changed data signals for visible widget - if (sender == methodTab->visibleWidget()) - { - QObject::disconnect(this, SIGNAL(bmp_changed()), sender, - SLOT(bmp_changed())); - QObject::disconnect(this, SIGNAL(work_changed()), sender, - SLOT(work_changed())); - QObject::disconnect(this, SIGNAL(tissues_changed()), sender, - SLOT(tissues_changed())); - QObject::disconnect(this, SIGNAL(marks_changed()), sender, - SLOT(marks_changed())); - } - - // Signal changed data - if (changeData.bmp) - { - emit bmp_changed(); - } - if (changeData.work) - { - emit work_changed(); - } - if (changeData.tissues) - { - emit tissues_changed(); - } - if (changeData.marks) - { - emit marks_changed(); - } - - if (sender == methodTab->visibleWidget()) - { - QObject::connect(this, SIGNAL(bmp_changed()), sender, - SLOT(bmp_changed())); + QObject::connect(this, SIGNAL(bmp_changed()), sender, SLOT(bmp_changed())); QObject::connect(this, SIGNAL(work_changed()), sender, - SLOT(work_changed())); + SLOT(work_changed())); QObject::connect(this, SIGNAL(tissues_changed()), sender, - SLOT(tissues_changed())); + SLOT(tissues_changed())); QObject::connect(this, SIGNAL(marks_changed()), sender, - SLOT(marks_changed())); + SLOT(marks_changed())); } -#endif } void MainWindow::DatasetChanged() @@ -9034,20 +8278,20 @@ void MainWindow::update_ranges_helper() void MainWindow::cancel_transform_helper() { QObject::disconnect( - transfrmWidget, - SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + transfrmWidget, + SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); QObject::disconnect( - transfrmWidget, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), - this, SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); + transfrmWidget, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), + this, SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); transfrmWidget->CancelPushButtonClicked(); QObject::connect( - transfrmWidget, - SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, - SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); - QObject::connect( - transfrmWidget, SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), - this, SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); + transfrmWidget, + SIGNAL(begin_datachange(iseg::DataSelection&, QWidget*, bool)), this, + SLOT(handle_begin_datachange(iseg::DataSelection&, QWidget*, bool))); + QObject::connect(transfrmWidget, + SIGNAL(end_datachange(QWidget*, iseg::EndUndoAction)), this, + SLOT(handle_end_datachange(QWidget*, iseg::EndUndoAction))); // Signal changed data bool bmp, work, tissues; @@ -9067,11 +8311,11 @@ void MainWindow::cancel_transform_helper() } void MainWindow::handle_begin_dataexport(iseg::DataSelection& dataSelection, - QWidget* sender) + QWidget* sender) { // Handle pending transforms if (methodTab->visibleWidget() == transfrmWidget && - (dataSelection.bmp || dataSelection.work || dataSelection.tissues)) + (dataSelection.bmp || dataSelection.work || dataSelection.tissues)) { cancel_transform_helper(); } diff --git a/iSeg/MainWindow.h b/iSeg/MainWindow.h index a8be699f..dd607705 100755 --- a/iSeg/MainWindow.h +++ b/iSeg/MainWindow.h @@ -12,8 +12,8 @@ #include "Atlas.h" #include "Project.h" -#include "Core/DataSelection.h" -#include "Core/Point.h" +#include "Interface/DataSelection.h" +#include "Interface/Point.h" #include #include @@ -55,7 +55,7 @@ class MultiDataset_widget; class ScaleWork; class ImageMath; class ImageOverlay; -class zoomer_widget; +class ZoomWidget; class CheckBoneConnectivityDialog; class SliceViewerWidget; class PickerWidget; @@ -65,7 +65,7 @@ class OutlineCorrectionWidget; class ImageForestingTransformRegionGrowingWidget; class TransformWidget; class FastmarchingFuzzyWidget; -class livewire_widget; +class LivewireWidget; class EdgeWidget; class MorphologyWidget; class HystereticGrowingWidget; @@ -90,18 +90,18 @@ class MainWindow : public QMainWindow { Q_OBJECT public: - MainWindow(SlicesHandler* hand3D, QString locationstring, QDir picpath, - QDir tmppath, bool editingmode = false, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0, - char** argv = NULL); + MainWindow(SlicesHandler* hand3D, const QString& locationstring, const QDir& picpath, + const QDir& tmppath, bool editingmode = false, QWidget* parent = 0, + const char* name = 0, Qt::WindowFlags wFlags = 0, + char** argv = NULL); ~MainWindow(); friend class Settings; - void LoadLoadProj(QString path1); - void LoadAtlas(QDir path1); - void AddLoadProj(QString path1); - void SaveLoadProj(QString latestprojpath); + void LoadLoadProj(const QString& path1); + void LoadAtlas(const QDir& path1); + void AddLoadProj(const QString& path1); + void SaveLoadProj(const QString& latestprojpath); void SaveSettings(); void LoadSettings(const char* loadfilename); void loadproj(const QString& loadfilename); @@ -133,11 +133,11 @@ class MainWindow : public QMainWindow void tissues_changed(); void drawing_changed(); void begin_datachange(iseg::DataSelection& dataSelection, - QWidget* sender = NULL, bool beginUndo = true); + QWidget* sender = NULL, bool beginUndo = true); void end_datachange(QWidget* sender = NULL, - iseg::EndUndoAction undoAction = iseg::EndUndo); + iseg::EndUndoAction undoAction = iseg::EndUndo); void begin_dataexport(iseg::DataSelection& dataSelection, - QWidget* sender = NULL); + QWidget* sender = NULL); void end_dataexport(QWidget* sender = NULL); private: @@ -207,10 +207,10 @@ class MainWindow : public QMainWindow Q3PopupMenu* hidemenu; Q3PopupMenu* hidesubmenu; TissueTreeWidget* - tissueTreeWidget; // Widget visualizing the tissue hierarchy + tissueTreeWidget; // Widget visualizing the tissue hierarchy QLineEdit* tissueFilter; TissueHierarchyWidget* - tissueHierarchyWidget; // Widget for selecting the tissue hierarchy + tissueHierarchyWidget; // Widget for selecting the tissue hierarchy QCheckBox* cb_tissuelock; QPushButton* lockTissues; QPushButton* addTissue; @@ -245,7 +245,7 @@ class MainWindow : public QMainWindow MorphologyWidget* morph_widget; WatershedWidget* wshed_widget; HystereticGrowingWidget* hyst_widget; - livewire_widget* lw_widget; + LivewireWidget* lw_widget; ImageForestingTransformRegionGrowingWidget* iftrg_widget; FastmarchingFuzzyWidget* FMF_widget; OutlineCorrectionWidget* OutlineCorrect_widget; @@ -283,7 +283,7 @@ class MainWindow : public QMainWindow Q3ScrollView* bmp_scroller; Q3ScrollView* work_scroller; bool tomove_scroller; - zoomer_widget* zoom_widget; + ZoomWidget* zoom_widget; // float thickness; SliceViewerWidget* xsliceshower; SliceViewerWidget* ysliceshower; @@ -350,13 +350,8 @@ class MainWindow : public QMainWindow private slots: void update_bmp(); - void update_bmp(QRect rect); void update_work(); - void update_work(QRect rect); void update_tissue(); - void update_tissue(QRect rect); - // void marks_changed(); - // void drawing_changed(); void execute_bmp2work(); void execute_work2bmp(); void execute_swap_bmpwork(); @@ -568,17 +563,16 @@ private slots: void bmpcrosshairvisible_changed(); void workcrosshairvisible_changed(); void wheelrotated(int delta); - void mousePosZoom_changed(QPoint point); + void mousePosZoom_changed(const QPoint& point); void handle_begin_datachange(iseg::DataSelection& dataSelection, - QWidget* sender = NULL, bool beginUndo = true); + QWidget* sender = NULL, bool beginUndo = true); void handle_end_datachange(QWidget* sender = NULL, - iseg::EndUndoAction undoAction = iseg::EndUndo); - void handle_end_datachange(QRect rect, QWidget* sender = NULL, - iseg::EndUndoAction undoAction = iseg::EndUndo); - void handle_begin_dataexport(iseg::DataSelection& dataSelection, - QWidget* sender = NULL); + iseg::EndUndoAction undoAction = iseg::EndUndo); + + void handle_begin_dataexport(iseg::DataSelection& dataSelection, QWidget* sender = NULL); void handle_end_dataexport(QWidget* sender = NULL); + void DatasetChanged(); void provide_selected_tissue_BG(); diff --git a/iSeg/measurementwidget.cpp b/iSeg/MeasurementWidget.cpp similarity index 99% rename from iSeg/measurementwidget.cpp rename to iSeg/MeasurementWidget.cpp index 5bff4241..05eb7575 100755 --- a/iSeg/measurementwidget.cpp +++ b/iSeg/MeasurementWidget.cpp @@ -15,8 +15,9 @@ #include "TissueInfos.h" #include "bmp_read_1.h" +#include "Interface/Point.h" + #include "Core/Pair.h" -#include "Core/Point.h" #include "Core/addLine.h" #include @@ -211,7 +212,7 @@ FILE* MeasurementWidget::LoadParams(FILE* fp, int version) return fp; } -void MeasurementWidget::pt_clicked(Point p) +void MeasurementWidget::on_mouse_clicked(Point p) { if (rb_pts->isOn()) { @@ -441,6 +442,16 @@ void MeasurementWidget::pt_clicked(Point p) } } +void MeasurementWidget::on_mouse_moved(Point p) +{ + if (drawing) + { + dynamic.clear(); + addLine(&dynamic, p1, p); + emit vpdyn_changed(&dynamic); + } +} + void MeasurementWidget::set_coord(unsigned short posit, Point p, unsigned short slicenr) { @@ -880,16 +891,6 @@ float MeasurementWidget::calculatevec(unsigned short orient) return value; } -void MeasurementWidget::pt_moved(Point p) -{ - if (drawing) - { - dynamic.clear(); - addLine(&dynamic, p1, p); - emit vpdyn_changed(&dynamic); - } -} - void MeasurementWidget::cleanup() { dynamic.clear(); diff --git a/iSeg/MeasurementWidget.h b/iSeg/MeasurementWidget.h new file mode 100755 index 00000000..75944eef --- /dev/null +++ b/iSeg/MeasurementWidget.h @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2018 The Foundation for Research on Information Technologies in Society (IT'IS). + * + * This file is part of iSEG + * (see https://github.com/ITISFoundation/osparc-iseg). + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ +#ifndef MEASUREWIDGET_12DEZ07 +#define MEASUREWIDGET_12DEZ07 + +#include "SlicesHandler.h" +#include "bmp_read_1.h" + +#include "Interface/WidgetInterface.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace iseg { + +class MeasurementWidget : public WidgetInterface +{ + Q_OBJECT +public: + MeasurementWidget(SlicesHandler *hand3D, QWidget *parent = 0, + const char *name = 0, Qt::WindowFlags wFlags = 0); + ~MeasurementWidget(); + FILE *SaveParams(FILE *fp, int version) override; + FILE *LoadParams(FILE *fp, int version) override; + QSize sizeHint() const override; + void init() override; + void cleanup() override; + void newloaded() override; + float calculatevec(unsigned short orient); + std::string GetName() override { return std::string("Measurement"); } + QIcon GetIcon(QDir picdir) override { return QIcon(picdir.absFilePath(QString("measurement.png"))); } + +private: + void on_mouse_clicked(Point p) override; + void on_mouse_moved(Point p) override; + + void getlabels(); + float calculate(); + void set_coord(unsigned short posit, Point p, unsigned short slicenr); + + bmphandler *bmphand; + SlicesHandler *handler3D; + std::vector labels; + unsigned short activeslice; + Q3HBox *hboxoverall; + Q3VBox *vboxmethods; + Q3HBox *hbox2; + Q3HBox *hbox3; + Q3HBox *hbox4; + Q3VBox *vbox1; + QLabel *txt_displayer; + QLabel *txt_ccb1; + QLabel *txt_ccb2; + QLabel *txt_ccb3; + QLabel *txt_ccb4; + QRadioButton *rb_vector; + QRadioButton *rb_dist; + QRadioButton *rb_thick; + QRadioButton *rb_angle; + QRadioButton *rb_4ptangle; + QRadioButton *rb_vol; + QButtonGroup *modegroup; + QRadioButton *rb_pts; + QRadioButton *rb_lbls; + QButtonGroup *inputgroup; + QComboBox *cbb_lb1; + QComboBox *cbb_lb2; + QComboBox *cbb_lb3; + QComboBox *cbb_lb4; + int state; + int pt[4][3]; + bool drawing; + std::vector established; + std::vector dynamic; + Point p1; + +signals: + void vp1_changed(std::vector *vp1); + void vpdyn_changed(std::vector *vpdyn); + void vp1dyn_changed(std::vector *vp1, std::vector *vpdyn, + bool also_points = false); + +private slots: + void marks_changed(); + void bmphand_changed(bmphandler *bmph); + void cbb_changed(int); + void method_changed(int); + void inputtype_changed(int); + void update_visualization(); +}; + +} // namespace iseg + +#endif diff --git a/iSeg/MorphologyWidget.cpp b/iSeg/MorphologyWidget.cpp index 7d789580..b19ea4f5 100755 --- a/iSeg/MorphologyWidget.cpp +++ b/iSeg/MorphologyWidget.cpp @@ -14,7 +14,7 @@ #include "SlicesHandler.h" #include "bmp_read_1.h" -#include "Core/Point.h" +#include "Interface/Point.h" #include #include @@ -34,17 +34,17 @@ using namespace iseg; MorphologyWidget::MorphologyWidget(SlicesHandler* hand3D, QWidget* parent, - const char* name, Qt::WindowFlags wFlags) - : WidgetInterface(parent, name, wFlags), handler3D(hand3D) + const char* name, Qt::WindowFlags wFlags) + : WidgetInterface(parent, name, wFlags), handler3D(hand3D) { setToolTip( - Format("Apply morphological operations to the Target image. " - "Morphological operations are " - "based on expanding or shrinking (Dilate/Erode) regions by " - "a given number of pixel layers (n)." - "
" - "The functions act on the Target image (to modify a tissue " - "use Get Tissue and Adder).")); + Format("Apply morphological operations to the Target image. " + "Morphological operations are " + "based on expanding or shrinking (Dilate/Erode) regions by " + "a given number of pixel layers (n)." + "
" + "The functions act on the Target image (to modify a tissue " + "use Get Tissue and Adder).")); activeslice = handler3D->get_activeslice(); bmphand = handler3D->get_activebmphandler(); @@ -63,30 +63,30 @@ MorphologyWidget::MorphologyWidget(SlicesHandler* hand3D, QWidget* parent, connectgroup = new QButtonGroup(this); connectgroup->insert( - rb_4connect = new QRadioButton(QString("4-connectivity"), hbox2)); + rb_4connect = new QRadioButton(QString("4-connectivity"), hbox2)); connectgroup->insert( - rb_8connect = new QRadioButton(QString("8-connectivity"), hbox2)); + rb_8connect = new QRadioButton(QString("8-connectivity"), hbox2)); rb_4connect->setChecked(TRUE); modegroup = new QButtonGroup(this); modegroup->insert(rb_open = new QRadioButton(QString("Open"), vboxmethods)); modegroup->insert(rb_close = - new QRadioButton(QString("Close"), vboxmethods)); + new QRadioButton(QString("Close"), vboxmethods)); modegroup->insert(rb_erode = - new QRadioButton(QString("Erode"), vboxmethods)); + new QRadioButton(QString("Erode"), vboxmethods)); modegroup->insert(rb_dilate = - new QRadioButton(QString("Dilate"), vboxmethods)); + new QRadioButton(QString("Dilate"), vboxmethods)); rb_open->setChecked(TRUE); rb_open->setToolTip(Format( - "First shrinking before growing is called Open and results in the " - "deletion of small islands and thin links between structures.")); + "First shrinking before growing is called Open and results in the " + "deletion of small islands and thin links between structures.")); rb_close->setToolTip(Format("Growing followed by shrinking results in the " - "closing of small (< 2n) gaps and holes.")); + "closing of small (< 2n) gaps and holes.")); rb_erode->setToolTip(Format( - "Erode or shrink the boundaries of regions of foreground pixels.")); + "Erode or shrink the boundaries of regions of foreground pixels.")); rb_dilate->setToolTip( - Format("Enlarge the boundaries of regions of foreground pixels.")); + Format("Enlarge the boundaries of regions of foreground pixels.")); vboxmethods->setMargin(5); vbox1->setMargin(5); @@ -169,18 +169,15 @@ void MorphologyWidget::execute() QSize MorphologyWidget::sizeHint() const { return vbox1->sizeHint(); } -void MorphologyWidget::slicenr_changed() +void MorphologyWidget::on_slicenr_changed() { - // if(activeslice!=handler3D->get_activeslice()){ activeslice = handler3D->get_activeslice(); bmphand_changed(handler3D->get_activebmphandler()); - // } } void MorphologyWidget::bmphand_changed(bmphandler* bmph) { bmphand = bmph; - return; } void MorphologyWidget::init() diff --git a/iSeg/MorphologyWidget.h b/iSeg/MorphologyWidget.h index ced57e54..0adbb3a9 100755 --- a/iSeg/MorphologyWidget.h +++ b/iSeg/MorphologyWidget.h @@ -13,7 +13,7 @@ #include "SlicesHandler.h" #include "bmp_read_1.h" -#include "Plugin/WidgetInterface.h" +#include "Interface/WidgetInterface.h" #include #include @@ -36,21 +36,20 @@ class MorphologyWidget : public WidgetInterface Q_OBJECT public: MorphologyWidget(SlicesHandler* hand3D, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0); + const char* name = 0, Qt::WindowFlags wFlags = 0); ~MorphologyWidget(); - QSize sizeHint() const; - void init(); - void newloaded(); - FILE* SaveParams(FILE* fp, int version); - FILE* LoadParams(FILE* fp, int version); - void hideparams_changed(); - std::string GetName() { return std::string("Morpho"); }; - virtual QIcon GetIcon(QDir picdir) - { - return QIcon(picdir.absFilePath(QString("morphology.png")).ascii()); - }; + QSize sizeHint() const override; + void init() override; + void newloaded() override; + FILE* SaveParams(FILE* fp, int version) override; + FILE* LoadParams(FILE* fp, int version) override; + void hideparams_changed() override; + std::string GetName() override { return std::string("Morpho"); } + QIcon GetIcon(QDir picdir) override { return QIcon(picdir.absFilePath(QString("morphology.png"))); } private: + void on_slicenr_changed() override; + bmphandler* bmphand; SlicesHandler* handler3D; unsigned short activeslice; @@ -72,15 +71,6 @@ class MorphologyWidget : public WidgetInterface QButtonGroup* modegroup; QCheckBox* allslices; -signals: - void begin_datachange(iseg::DataSelection& dataSelection, - QWidget* sender = NULL, bool beginUndo = true); - void end_datachange(QWidget* sender = NULL, - iseg::EndUndoAction undoAction = iseg::EndUndo); - -public slots: - void slicenr_changed(); - private slots: void bmphand_changed(bmphandler* bmph); void execute(); diff --git a/iSeg/OutlineCorrectionWidget.cpp b/iSeg/OutlineCorrectionWidget.cpp index cd01bf3d..a18cc423 100755 --- a/iSeg/OutlineCorrectionWidget.cpp +++ b/iSeg/OutlineCorrectionWidget.cpp @@ -14,7 +14,8 @@ #include "SlicesHandler.h" #include "bmp_read_1.h" -#include "Core/Point.h" +#include "Interface/Point.h" + #include "Core/addLine.h" #include @@ -377,7 +378,7 @@ void OutlineCorrectionWidget::draw_circle(Point p) vpdyn.clear(); } -void OutlineCorrectionWidget::mouse_clicked(Point p) +void OutlineCorrectionWidget::on_mouse_clicked(Point p) { if (selectobj) { @@ -472,7 +473,7 @@ void OutlineCorrectionWidget::mouse_clicked(Point p) } } -void OutlineCorrectionWidget::mouse_moved(Point p) +void OutlineCorrectionWidget::on_mouse_moved(Point p) { if (!selectobj) { @@ -542,13 +543,13 @@ void OutlineCorrectionWidget::mouse_moved(Point p) rect.setTop(max(0, dummy1 - sb_radius->value())); rect.setBottom(min((int)bmphand->return_height() - 1, dummy2 + sb_radius->value())); - emit end_datachange(rect, this, iseg::NoUndo); + emit end_datachange(this, iseg::NoUndo); last_pt = p; } } } -void OutlineCorrectionWidget::mouse_released(Point p) +void OutlineCorrectionWidget::on_mouse_released(Point p) { if (selectobj) { @@ -1130,7 +1131,7 @@ void OutlineCorrectionWidget::workbits_changed() } } -void OutlineCorrectionWidget::slicenr_changed() +void OutlineCorrectionWidget::on_slicenr_changed() { if (activeslice != handler3D->get_activeslice()) { @@ -1152,7 +1153,7 @@ void OutlineCorrectionWidget::bmphand_changed(bmphandler* bmph) void OutlineCorrectionWidget::init() { - slicenr_changed(); + on_slicenr_changed(); hideparams_changed(); } @@ -1163,7 +1164,7 @@ void OutlineCorrectionWidget::newloaded() bmphand = handler3D->get_activebmphandler(); } -void OutlineCorrectionWidget::tissuenr_changed(int tissuenr1) +void OutlineCorrectionWidget::on_tissuenr_changed(int tissuenr1) { tissuenr = (tissues_size_t)(tissuenr1 + 1); } diff --git a/iSeg/OutlineCorrectionWidget.h b/iSeg/OutlineCorrectionWidget.h index 3429af00..101c653d 100755 --- a/iSeg/OutlineCorrectionWidget.h +++ b/iSeg/OutlineCorrectionWidget.h @@ -13,9 +13,7 @@ #include "SlicesHandler.h" #include "bmp_read_1.h" -#include "Core/Point.h" - -#include "Plugin/WidgetInterface.h" +#include "Interface/WidgetInterface.h" #include #include @@ -39,25 +37,32 @@ class OutlineCorrectionWidget : public WidgetInterface Q_OBJECT public: OutlineCorrectionWidget(SlicesHandler* hand3D, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0); + const char* name = 0, Qt::WindowFlags wFlags = 0); ~OutlineCorrectionWidget(); - QSize sizeHint() const; - void init(); - void newloaded(); - void cleanup(); - FILE* SaveParams(FILE* fp, int version); - FILE* LoadParams(FILE* fp, int version); - void hideparams_changed(); - std::string GetName() { return std::string("OLC"); }; - virtual QIcon GetIcon(QDir picdir) - { - return QIcon(picdir.absFilePath(QString("olc.png")).ascii()); - }; + QSize sizeHint() const override; + void cleanup() override; + + void init() override; + void newloaded() override; + FILE* SaveParams(FILE* fp, int version) override; + FILE* LoadParams(FILE* fp, int version) override; + void hideparams_changed() override; + std::string GetName() override { return std::string("OLC"); } + QIcon GetIcon(QDir picdir) override { return QIcon(picdir.absFilePath(QString("olc.png"))); } void Select_selected_tissue_BG(QString tissueName, tissues_size_t nr); void Select_selected_tissue_TS(QString tissueName, tissues_size_t nr); private: + void on_tissuenr_changed(int i) override; + void on_slicenr_changed() override; + + void on_mouse_clicked(Point p) override; + void on_mouse_released(Point p) override; + void on_mouse_moved(Point p) override; + + void draw_circle(Point p); + tissues_size_t tissuenr; tissues_size_t tissuenrnew; float f; @@ -116,7 +121,6 @@ class OutlineCorrectionWidget : public WidgetInterface QPushButton* pb_removeholes; QPushButton* pb_selectobj; QCheckBox* allslices; - void draw_circle(Point p); std::vector vpdyn; bool dontundo; @@ -131,38 +135,26 @@ class OutlineCorrectionWidget : public WidgetInterface bool backgroundSelected; bool skinSelected; -public: + //public: QCheckBox* fb; QCheckBox* bg; signals: void vpdyn_changed(std::vector* vpdyn_arg); - void begin_datachange(iseg::DataSelection& dataSelection, - QWidget* sender = NULL, bool beginUndo = true); - void end_datachange(QWidget* sender = NULL, - iseg::EndUndoAction undoAction = iseg::EndUndo); - void end_datachange(QRect rect, QWidget* sender = NULL, - iseg::EndUndoAction undoAction = iseg::EndUndo); - - void signal_request_selected_tissue_TS(); + + void signal_request_selected_tissue_TS(); // TODO BL hack void signal_request_selected_tissue_BG(); public slots: void pixmm_changed(); void workbits_changed(); - void slicenr_changed(); - void tissuenr_changed(int tissuenr1); void request_selected_tissue_BG(); void request_selected_tissue_TS(); private slots: void bmphand_changed(bmphandler* bmph); - void mouse_clicked(Point p); - void mouse_released(Point p); - void mouse_moved(Point p); void method_changed(); - // void target_changed(); void removeholes_pushed(); void selectobj_pushed(); }; diff --git a/iSeg/pickerwidget.cpp b/iSeg/PickerWidget.cpp similarity index 89% rename from iSeg/pickerwidget.cpp rename to iSeg/PickerWidget.cpp index dbaa12c9..a448ea17 100755 --- a/iSeg/pickerwidget.cpp +++ b/iSeg/PickerWidget.cpp @@ -15,7 +15,6 @@ #include "bmp_read_1.h" #include "Core/Pair.h" -#include "Core/Point.h" #include "Core/addLine.h" #include @@ -23,12 +22,12 @@ using namespace iseg; PickerWidget::PickerWidget(SlicesHandler* hand3D, QWidget* parent, - const char* name, Qt::WindowFlags wFlags) - : WidgetInterface(parent, name, wFlags), handler3D(hand3D) + const char* name, Qt::WindowFlags wFlags) + : WidgetInterface(parent, name, wFlags), handler3D(hand3D) { setToolTip(Format("Copy and erase regions. Copying can be used to transfer " - "segmented regions from one slice to another. All the " - "functions are based on the current region selection.")); + "segmented regions from one slice to another. All the " + "functions are based on the current region selection.")); bmphand = handler3D->get_activebmphandler(); @@ -55,7 +54,7 @@ PickerWidget::PickerWidget(SlicesHandler* hand3D, QWidget* parent, rb_erase->setToolTip(Format("The deleted regions will be left empty.")); rb_fill = new QRadioButton(QString("Fill"), hbox2); rb_fill->setToolTip( - Format("Fill the resulting hole based on the neighboring regions.")); + Format("Fill the resulting hole based on the neighboring regions.")); erasefillgroup = new QButtonGroup(this); erasefillgroup->insert(rb_erase); erasefillgroup->insert(rb_fill); @@ -67,13 +66,13 @@ PickerWidget::PickerWidget(SlicesHandler* hand3D, QWidget* parent, pb_paste->setToolTip(Format("Clip-board is pasted into the current slice")); pb_cut = new QPushButton("Cut", hbox3); pb_cut->setToolTip( - Format("Tissues or target image pixels inside the region " - "selection are erased but a copy " - "is placed on the clipboard.")); + Format("Tissues or target image pixels inside the region " + "selection are erased but a copy " + "is placed on the clipboard.")); pb_delete = new QPushButton("Delete", hbox3); pb_delete->setToolTip( - Format("Tissues (resp. target image pixels) inside the " - "region selection are erased.")); + Format("Tissues (resp. target image pixels) inside the " + "region selection are erased.")); hbox1->setFixedSize(hbox1->sizeHint()); hbox2->setFixedSize(hbox2->sizeHint()); @@ -86,12 +85,12 @@ PickerWidget::PickerWidget(SlicesHandler* hand3D, QWidget* parent, showborder(); QObject::connect(worktissuegroup, SIGNAL(buttonClicked(int)), this, - SLOT(worktissue_changed(int))); + SLOT(worktissue_changed(int))); QObject::connect(pb_copy, SIGNAL(clicked()), this, SLOT(copy_pressed())); QObject::connect(pb_paste, SIGNAL(clicked()), this, SLOT(paste_pressed())); QObject::connect(pb_cut, SIGNAL(clicked()), this, SLOT(cut_pressed())); QObject::connect(pb_delete, SIGNAL(clicked()), this, - SLOT(delete_pressed())); + SLOT(delete_pressed())); } PickerWidget::~PickerWidget() @@ -129,11 +128,9 @@ void PickerWidget::bmphand_changed(bmphandler* bmph) hasclipboard = false; showborder(); } - - return; } -void PickerWidget::slicenr_changed() +void PickerWidget::on_slicenr_changed() { bmphand = handler3D->get_activebmphandler(); } @@ -173,7 +170,7 @@ FILE* PickerWidget::LoadParams(FILE* fp, int version) if (version >= 6) { QObject::disconnect(worktissuegroup, SIGNAL(buttonClicked(int)), this, - SLOT(worktissue_changed(int))); + SLOT(worktissue_changed(int))); int dummy; fread(&dummy, sizeof(int), 1, fp); @@ -188,12 +185,12 @@ FILE* PickerWidget::LoadParams(FILE* fp, int version) worktissue_changed(0); QObject::connect(worktissuegroup, SIGNAL(buttonClicked(int)), this, - SLOT(worktissue_changed(int))); + SLOT(worktissue_changed(int))); } return fp; } -void PickerWidget::pt_clicked(Point p) +void PickerWidget::on_mouse_clicked(Point p) { if (!shiftpressed) { @@ -208,7 +205,7 @@ void PickerWidget::pt_clicked(Point p) bmphand->change2mask_connectedwork(currentselection, p, addorsub); else bmphand->change2mask_connectedtissue( - handler3D->get_active_tissuelayer(), currentselection, p, addorsub); + handler3D->get_active_tissuelayer(), currentselection, p, addorsub); showborder(); } @@ -320,7 +317,7 @@ void PickerWidget::copy_pressed() else { tissues_size_t* tissues = - bmphand->return_tissues(handler3D->get_active_tissuelayer()); + bmphand->return_tissues(handler3D->get_active_tissuelayer()); for (unsigned int i = 0; i < area; i++) { valuedistrib[i] = (float)tissues[i]; @@ -360,7 +357,7 @@ void PickerWidget::paste_pressed() valuedistrib2[i] = (tissues_size_t)valuedistrib[i]; } bmphand->copy2tissue(handler3D->get_active_tissuelayer(), valuedistrib2, - mask); + mask); delete[] valuedistrib2; } @@ -386,10 +383,10 @@ void PickerWidget::delete_pressed() { if (rb_erase->isOn()) bmphand->erasetissue(handler3D->get_active_tissuelayer(), - currentselection); + currentselection); else bmphand->floodtissue(handler3D->get_active_tissuelayer(), - currentselection); + currentselection); } emit end_datachange(this); diff --git a/iSeg/pickerwidget.h b/iSeg/PickerWidget.h similarity index 71% rename from iSeg/pickerwidget.h rename to iSeg/PickerWidget.h index 9c0e8420..9cff3bed 100755 --- a/iSeg/pickerwidget.h +++ b/iSeg/PickerWidget.h @@ -13,9 +13,7 @@ #include "SlicesHandler.h" #include "bmp_read_1.h" -#include "Plugin/WidgetInterface.h" - -#include "Core/DataSelection.h" +#include "Interface/WidgetInterface.h" #include #include @@ -38,24 +36,25 @@ class PickerWidget : public WidgetInterface Q_OBJECT public: PickerWidget(SlicesHandler* hand3D, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0); + const char* name = 0, Qt::WindowFlags wFlags = 0); ~PickerWidget(); - FILE* SaveParams(FILE* fp, int version); - FILE* LoadParams(FILE* fp, int version); - QSize sizeHint() const; - void init(); - void cleanup(); - void newloaded(); - std::string GetName() { return std::string("Picker"); }; - virtual QIcon GetIcon(QDir picdir) - { - return QIcon(picdir.absFilePath(QString("picker.png")).ascii()); - }; - -public slots: - void slicenr_changed(); + FILE* SaveParams(FILE* fp, int version) override; + FILE* LoadParams(FILE* fp, int version) override; + QSize sizeHint() const override; + void init() override; + void cleanup() override; + void newloaded() override; + std::string GetName() override { return std::string("Picker"); }; + QIcon GetIcon(QDir picdir) override { return QIcon(picdir.absFilePath(QString("picker.png"))); } private: + void on_slicenr_changed() override; + + void on_mouse_clicked(Point p) override; + + void update_active(); + void showborder(); + bmphandler* bmphand; SlicesHandler* handler3D; unsigned int width; @@ -82,15 +81,9 @@ public slots: QRadioButton* rb_fill; QButtonGroup* erasefillgroup; std::vector selection; - void update_active(); - void showborder(); signals: void vp1_changed(std::vector* vp1); - void begin_datachange(iseg::DataSelection& dataSelection, - QWidget* sender = NULL, bool beginUndo = true); - void end_datachange(QWidget* sender = NULL, - iseg::EndUndoAction undoAction = iseg::EndUndo); private slots: void copy_pressed(); @@ -100,7 +93,6 @@ private slots: void worktissue_changed(int); void bmphand_changed(bmphandler* bmph); - void pt_clicked(Point); protected: void keyPressEvent(QKeyEvent* event); diff --git a/iSeg/RadiotherapyStructureSetImporter.h b/iSeg/RadiotherapyStructureSetImporter.h index 70f2dcc0..39692971 100755 --- a/iSeg/RadiotherapyStructureSetImporter.h +++ b/iSeg/RadiotherapyStructureSetImporter.h @@ -40,6 +40,9 @@ class RadiotherapyStructureSetImporter : public QDialog ~RadiotherapyStructureSetImporter(); private: + void storeparams(); + void updatevisibility(); + SlicesHandler* handler3D; Q3HBox* hbox1; Q3HBox* hbox2; @@ -63,12 +66,9 @@ class RadiotherapyStructureSetImporter : public QDialog std::vector vectissuenrs; std::vector vecpriorities; std::vector vectissuenames; - void storeparams(); - void updatevisibility(); int currentitem; signals: - // void rtstruct_loaded(); void begin_datachange(iseg::DataSelection& dataSelection, QWidget* sender = NULL, bool beginUndo = true); void end_datachange(QWidget* sender = NULL, diff --git a/iSeg/SaveOutlinesWidget.h b/iSeg/SaveOutlinesWidget.h index 327c8985..dd14c456 100755 --- a/iSeg/SaveOutlinesWidget.h +++ b/iSeg/SaveOutlinesWidget.h @@ -10,9 +10,9 @@ #ifndef SOW_19April05 #define SOW_19April05 -#include "Core/Point.h" #include "SlicesHandler.h" #include "bmp_read_1.h" + #include #include #include diff --git a/iSeg/slicetransform.cpp b/iSeg/SliceTransform.cpp similarity index 100% rename from iSeg/slicetransform.cpp rename to iSeg/SliceTransform.cpp diff --git a/iSeg/slicetransform.h b/iSeg/SliceTransform.h similarity index 100% rename from iSeg/slicetransform.h rename to iSeg/SliceTransform.h diff --git a/iSeg/SliceViewerWidget.cpp b/iSeg/SliceViewerWidget.cpp index d6a6aa6a..2acea1c8 100755 --- a/iSeg/SliceViewerWidget.cpp +++ b/iSeg/SliceViewerWidget.cpp @@ -13,7 +13,6 @@ #include "SlicesHandler.h" #include "TissueInfos.h" -#include "Core/Point.h" #include #include diff --git a/iSeg/SliceViewerWidget.h b/iSeg/SliceViewerWidget.h index b85b690d..98ad697e 100755 --- a/iSeg/SliceViewerWidget.h +++ b/iSeg/SliceViewerWidget.h @@ -12,7 +12,7 @@ #include "SlicesHandler.h" -#include "Core/Point.h" +#include "Interface/Point.h" #include #include diff --git a/iSeg/SlicesHandler.cpp b/iSeg/SlicesHandler.cpp index 6048ced6..dac50ebc 100755 --- a/iSeg/SlicesHandler.cpp +++ b/iSeg/SlicesHandler.cpp @@ -482,10 +482,10 @@ int SlicesHandler::LoadDIBitmap(std::vector filenames, Point p, } } +// TODO BL this function has a terrible impl, e.g. using member variables rgb, width/height, etc. int SlicesHandler::LoadPng(std::vector filenames) { - UpdateColorLookupTable( - nullptr); // BL: here we could quantize colors instead and build color + UpdateColorLookupTable(nullptr); // BL: here we could quantize colors instead and build color activeslice = 0; active_tissuelayer = 0; @@ -500,10 +500,10 @@ int SlicesHandler::LoadPng(std::vector filenames) { ChannelMixer channelMixer(filenames, NULL); channelMixer.move(QCursor::pos()); - if (!channelMixer.exec()) - //return 0; + if (!channelMixer.exec()) // TODO BL check this works + return 0; - redFactor = channelMixer.GetRedFactor(); + redFactor = channelMixer.GetRedFactor(); greenFactor = channelMixer.GetGreenFactor(); blueFactor = channelMixer.GetBlueFactor(); diff --git a/iSeg/SlicesHandler.h b/iSeg/SlicesHandler.h index fe3532d5..a1296fda 100755 --- a/iSeg/SlicesHandler.h +++ b/iSeg/SlicesHandler.h @@ -10,7 +10,7 @@ #ifndef HANDLER3DSLICES #define HANDLER3DSLICES -#include "Plugin/SlicesHandlerInterface.h" +#include "Interface/SlicesHandlerInterface.h" #include "Core/Outline.h" // BL TODO get rid of this #include "Core/RGB.h" diff --git a/iSeg/SmoothingWidget.cpp b/iSeg/SmoothingWidget.cpp index 33c1c3e2..1b416633 100755 --- a/iSeg/SmoothingWidget.cpp +++ b/iSeg/SmoothingWidget.cpp @@ -14,8 +14,6 @@ #include "SmoothingWidget.h" #include "bmp_read_1.h" -#include "Core/Point.h" - #include #include #include @@ -36,8 +34,8 @@ using namespace iseg; SmoothingWidget::SmoothingWidget(SlicesHandler* hand3D, QWidget* parent, - const char* name, Qt::WindowFlags wFlags) - : WidgetInterface(parent, name, wFlags), handler3D(hand3D) + const char* name, Qt::WindowFlags wFlags) + : WidgetInterface(parent, name, wFlags), handler3D(hand3D) { setToolTip(Format("Smoothing and noise removal filters.")); @@ -67,8 +65,8 @@ SmoothingWidget::SmoothingWidget(SlicesHandler* hand3D, QWidget* parent, sl_sigma->setRange(1, 100); sl_sigma->setValue(20); sl_sigma->setToolTip( - "Sigma gives the radius of the smoothing filter. Larger " - "values remove more details."); + "Sigma gives the radius of the smoothing filter. Larger " + "values remove more details."); txt_sigma2 = new QLabel(" 5", hbox2); txt_dt = new QLabel("dt: 1 ", hbox3); @@ -81,12 +79,12 @@ SmoothingWidget::SmoothingWidget(SlicesHandler* hand3D, QWidget* parent, sl_k->setRange(0, 100); sl_k->setValue(50); sl_k->setToolTip( - "Together with value on the right, defines the Sigma of the " - "smoothing filter."); + "Together with value on the right, defines the Sigma of the " + "smoothing filter."); sb_kmax = new QSpinBox(1, 100, 1, hbox4); sb_kmax->setValue(10); sb_kmax->setToolTip("Gives the max. radius of the smoothing filter. This " - "value defines the scale used in the slider bar."); + "value defines the scale used in the slider bar."); txt_restrain1 = new QLabel("Restraint: 0 ", hbox5); sl_restrain = new QSlider(Qt::Horizontal, hbox5); @@ -96,22 +94,22 @@ SmoothingWidget::SmoothingWidget(SlicesHandler* hand3D, QWidget* parent, rb_gaussian = new QRadioButton(QString("Gaussian"), vboxmethods); rb_gaussian->setToolTip("Gaussian smoothing blurs the image and can remove " - "noise and details (high frequency)."); + "noise and details (high frequency)."); rb_average = new QRadioButton(QString("Average"), vboxmethods); rb_average->setToolTip( - "Mean smoothing blurs the image and can remove noise and details."); + "Mean smoothing blurs the image and can remove noise and details."); rb_median = new QRadioButton(QString("Median"), vboxmethods); rb_median->setToolTip( - "Median filtering can remove (speckle or salt-and-pepper) noise."); + "Median filtering can remove (speckle or salt-and-pepper) noise."); rb_sigmafilter = new QRadioButton(QString("Sigma Filter"), vboxmethods); rb_sigmafilter->setToolTip( - "Sigma filtering is a mixture between Gaussian and Average filtering. " - "It " - "preserves edges better than Average filtering."); + "Sigma filtering is a mixture between Gaussian and Average filtering. " + "It " + "preserves edges better than Average filtering."); rb_anisodiff = - new QRadioButton(QString("Anisotropic Diffusion"), vboxmethods); + new QRadioButton(QString("Anisotropic Diffusion"), vboxmethods); rb_anisodiff->setToolTip("Anisotropic diffusion can remove noise, while " - "preserving significant details, such as edges."); + "preserving significant details, such as edges."); modegroup = new QButtonGroup(this); modegroup->insert(rb_gaussian); @@ -145,25 +143,25 @@ SmoothingWidget::SmoothingWidget(SlicesHandler* hand3D, QWidget* parent, method_changed(0); QObject::connect(modegroup, SIGNAL(buttonClicked(int)), this, - SLOT(method_changed(int))); + SLOT(method_changed(int))); QObject::connect(pushexec, SIGNAL(clicked()), this, SLOT(execute())); QObject::connect(contdiff, SIGNAL(clicked()), this, SLOT(continue_diff())); QObject::connect(sl_sigma, SIGNAL(valueChanged(int)), this, - SLOT(sigmaslider_changed(int))); + SLOT(sigmaslider_changed(int))); QObject::connect(sl_sigma, SIGNAL(sliderPressed()), this, - SLOT(slider_pressed())); + SLOT(slider_pressed())); QObject::connect(sl_sigma, SIGNAL(sliderReleased()), this, - SLOT(slider_released())); + SLOT(slider_released())); QObject::connect(sl_k, SIGNAL(valueChanged(int)), this, - SLOT(kslider_changed(int))); + SLOT(kslider_changed(int))); QObject::connect(sl_k, SIGNAL(sliderPressed()), this, - SLOT(slider_pressed())); + SLOT(slider_pressed())); QObject::connect(sl_k, SIGNAL(sliderReleased()), this, - SLOT(slider_released())); + SLOT(slider_released())); QObject::connect(sb_n, SIGNAL(valueChanged(int)), this, - SLOT(n_changed(int))); + SLOT(n_changed(int))); QObject::connect(sb_kmax, SIGNAL(valueChanged(int)), this, - SLOT(kmax_changed(int))); + SLOT(kmax_changed(int))); return; } @@ -199,14 +197,14 @@ void SmoothingWidget::execute() else if (rb_sigmafilter->isOn()) { handler3D->sigmafilter( - (sl_k->value() + 1) * 0.01f * sb_kmax->value(), - (short unsigned)sb_n->value(), (short unsigned)sb_n->value()); + (sl_k->value() + 1) * 0.01f * sb_kmax->value(), + (short unsigned)sb_n->value(), (short unsigned)sb_n->value()); } else { handler3D->aniso_diff(1.0f, sb_iter->value(), f2, - sl_k->value() * 0.01f * sb_kmax->value(), - sl_restrain->value() * 0.01f); + sl_k->value() * 0.01f * sb_kmax->value(), + sl_restrain->value() * 0.01f); } } else @@ -226,14 +224,14 @@ void SmoothingWidget::execute() else if (rb_sigmafilter->isOn()) { bmphand->sigmafilter((sl_k->value() + 1) * 0.01f * sb_kmax->value(), - (short unsigned)sb_n->value(), - (short unsigned)sb_n->value()); + (short unsigned)sb_n->value(), + (short unsigned)sb_n->value()); } else { bmphand->aniso_diff(1.0f, sb_iter->value(), f2, - sl_k->value() * 0.01f * sb_kmax->value(), - sl_restrain->value() * 0.01f); + sl_k->value() * 0.01f * sb_kmax->value(), + sl_restrain->value() * 0.01f); } } emit end_datachange(this); @@ -323,14 +321,14 @@ void SmoothingWidget::continue_diff() if (allslices->isChecked()) { handler3D->cont_anisodiff(1.0f, sb_iter->value(), f2, - sl_k->value() * 0.01f * sb_kmax->value(), - sl_restrain->value() * 0.01f); + sl_k->value() * 0.01f * sb_kmax->value(), + sl_restrain->value() * 0.01f); } else { bmphand->cont_anisodiff(1.0f, sb_iter->value(), f2, - sl_k->value() * 0.01f * sb_kmax->value(), - sl_restrain->value() * 0.01f); + sl_k->value() * 0.01f * sb_kmax->value(), + sl_restrain->value() * 0.01f); } emit end_datachange(this); @@ -358,12 +356,12 @@ void SmoothingWidget::kslider_changed(int newval) { if (allslices->isChecked()) handler3D->sigmafilter( - (sl_k->value() + 1) * 0.01f * sb_kmax->value(), - (short unsigned)sb_n->value(), (short unsigned)sb_n->value()); + (sl_k->value() + 1) * 0.01f * sb_kmax->value(), + (short unsigned)sb_n->value(), (short unsigned)sb_n->value()); else bmphand->sigmafilter((sl_k->value() + 1) * 0.01f * sb_kmax->value(), - (short unsigned)sb_n->value(), - (short unsigned)sb_n->value()); + (short unsigned)sb_n->value(), + (short unsigned)sb_n->value()); emit end_datachange(this, iseg::NoUndo); } @@ -385,14 +383,14 @@ void SmoothingWidget::n_changed(int newval) if (allslices->isChecked()) { handler3D->sigmafilter( - (sl_k->value() + 1) * 0.01f * sb_kmax->value(), - (short unsigned)sb_n->value(), (short unsigned)sb_n->value()); + (sl_k->value() + 1) * 0.01f * sb_kmax->value(), + (short unsigned)sb_n->value(), (short unsigned)sb_n->value()); } else { bmphand->sigmafilter((sl_k->value() + 1) * 0.01f * sb_kmax->value(), - (short unsigned)sb_n->value(), - (short unsigned)sb_n->value()); + (short unsigned)sb_n->value(), + (short unsigned)sb_n->value()); } } else if (rb_average) @@ -424,14 +422,14 @@ void SmoothingWidget::kmax_changed(int newval) if (allslices->isChecked()) { handler3D->sigmafilter( - (sl_k->value() + 1) * 0.01f * sb_kmax->value(), - (short unsigned)sb_n->value(), (short unsigned)sb_n->value()); + (sl_k->value() + 1) * 0.01f * sb_kmax->value(), + (short unsigned)sb_n->value(), (short unsigned)sb_n->value()); } else { bmphand->sigmafilter((sl_k->value() + 1) * 0.01f * sb_kmax->value(), - (short unsigned)sb_n->value(), - (short unsigned)sb_n->value()); + (short unsigned)sb_n->value(), + (short unsigned)sb_n->value()); } } emit end_datachange(this); @@ -439,23 +437,20 @@ void SmoothingWidget::kmax_changed(int newval) QSize SmoothingWidget::sizeHint() const { return vbox1->sizeHint(); } -void SmoothingWidget::slicenr_changed() +void SmoothingWidget::on_slicenr_changed() { - // if(activeslice!=handler3D->get_activeslice()){ activeslice = handler3D->get_activeslice(); bmphand_changed(handler3D->get_activebmphandler()); - // } } void SmoothingWidget::bmphand_changed(bmphandler* bmph) { bmphand = bmph; - return; } void SmoothingWidget::init() { - slicenr_changed(); + on_slicenr_changed(); hideparams_changed(); } @@ -524,15 +519,15 @@ FILE* SmoothingWidget::LoadParams(FILE* fp, int version) if (version >= 2) { QObject::disconnect(modegroup, SIGNAL(buttonClicked(int)), this, - SLOT(method_changed(int))); + SLOT(method_changed(int))); QObject::disconnect(sl_sigma, SIGNAL(valueChanged(int)), this, - SLOT(sigmaslider_changed(int))); + SLOT(sigmaslider_changed(int))); QObject::disconnect(sl_k, SIGNAL(valueChanged(int)), this, - SLOT(kslider_changed(int))); + SLOT(kslider_changed(int))); QObject::disconnect(sb_n, SIGNAL(valueChanged(int)), this, - SLOT(n_changed(int))); + SLOT(n_changed(int))); QObject::disconnect(sb_kmax, SIGNAL(valueChanged(int)), this, - SLOT(kmax_changed(int))); + SLOT(kmax_changed(int))); int dummy; fread(&dummy, sizeof(int), 1, fp); @@ -563,15 +558,15 @@ FILE* SmoothingWidget::LoadParams(FILE* fp, int version) method_changed(0); QObject::connect(modegroup, SIGNAL(buttonClicked(int)), this, - SLOT(method_changed(int))); + SLOT(method_changed(int))); QObject::connect(sl_sigma, SIGNAL(valueChanged(int)), this, - SLOT(sigmaslider_changed(int))); + SLOT(sigmaslider_changed(int))); QObject::connect(sl_k, SIGNAL(valueChanged(int)), this, - SLOT(kslider_changed(int))); + SLOT(kslider_changed(int))); QObject::connect(sb_n, SIGNAL(valueChanged(int)), this, - SLOT(n_changed(int))); + SLOT(n_changed(int))); QObject::connect(sb_kmax, SIGNAL(valueChanged(int)), this, - SLOT(kmax_changed(int))); + SLOT(kmax_changed(int))); } return fp; } diff --git a/iSeg/SmoothingWidget.h b/iSeg/SmoothingWidget.h index c77ab23e..a0407a9d 100755 --- a/iSeg/SmoothingWidget.h +++ b/iSeg/SmoothingWidget.h @@ -13,7 +13,7 @@ #include "SlicesHandler.h" #include "bmp_read_1.h" -#include "Plugin/WidgetInterface.h" +#include "Interface/WidgetInterface.h" #include #include @@ -38,21 +38,20 @@ class SmoothingWidget : public WidgetInterface Q_OBJECT public: SmoothingWidget(SlicesHandler* hand3D, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0); + const char* name = 0, Qt::WindowFlags wFlags = 0); ~SmoothingWidget(); - QSize sizeHint() const; - void init(); - void newloaded(); - FILE* SaveParams(FILE* fp, int version); - FILE* LoadParams(FILE* fp, int version); - void hideparams_changed(); - std::string GetName() { return std::string("Smooth"); }; - virtual QIcon GetIcon(QDir picdir) - { - return QIcon(picdir.absFilePath(QString("smoothing.png")).ascii()); - }; + QSize sizeHint() const override; + void init() override; + void newloaded() override; + FILE* SaveParams(FILE* fp, int version) override; + FILE* LoadParams(FILE* fp, int version) override; + void hideparams_changed() override; + std::string GetName() override { return std::string("Smooth"); } + QIcon GetIcon(QDir picdir) override { return QIcon(picdir.absFilePath(QString("smoothing.png"))); } private: + void on_slicenr_changed() override; + bmphandler* bmphand; SlicesHandler* handler3D; unsigned short activeslice; @@ -92,15 +91,6 @@ class SmoothingWidget : public WidgetInterface QCheckBox* allslices; bool dontundo; -signals: - void begin_datachange(iseg::DataSelection& dataSelection, - QWidget* sender = NULL, bool beginUndo = true); - void end_datachange(QWidget* sender = NULL, - iseg::EndUndoAction undoAction = iseg::EndUndo); - -public slots: - void slicenr_changed(); - private slots: void bmphand_changed(bmphandler* bmph); void execute(); diff --git a/iSeg/ThresholdWidget.cpp b/iSeg/ThresholdWidget.cpp index fed47dae..6f3121b7 100755 --- a/iSeg/ThresholdWidget.cpp +++ b/iSeg/ThresholdWidget.cpp @@ -15,9 +15,6 @@ #include "bmp_read_1.h" #include "Core/Pair.h" -#include "Core/Point.h" - -#include "Plugin/WidgetInterface.h" #include #include @@ -607,7 +604,7 @@ void ThresholdWidget::getrange() return; } -void ThresholdWidget::tissuenr_changed(int newval) +void ThresholdWidget::on_tissuenr_changed(int newval) { if (rb_manual->isOn()) { @@ -766,7 +763,7 @@ void ThresholdWidget::bmp_changed() QSize ThresholdWidget::sizeHint() const { return vbox1->sizeHint(); } -void ThresholdWidget::slicenr_changed() +void ThresholdWidget::on_slicenr_changed() { // if(activeslice!=handler3D->get_activeslice()){ activeslice = handler3D->get_activeslice(); @@ -1029,7 +1026,7 @@ FILE* ThresholdWidget::LoadParams(FILE* fp, int version) nrtissues_changed(sb_nrtissues->value()); dim_changed(sb_dim->value()); sb_tissuenr->setValue(dummy); - tissuenr_changed(dummy); + on_tissuenr_changed(dummy); QObject::connect(subsect, SIGNAL(clicked()), this, SLOT(subsect_toggled())); diff --git a/iSeg/ThresholdWidget.h b/iSeg/ThresholdWidget.h index cafc0c4c..9e5fbe14 100755 --- a/iSeg/ThresholdWidget.h +++ b/iSeg/ThresholdWidget.h @@ -7,13 +7,12 @@ * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ -#ifndef THRESHWIDGET_24Feb05 -#define THRESHWIDGET_24Feb05 +#pragma once #include "SlicesHandler.h" #include "bmp_read_1.h" -#include "Plugin/WidgetInterface.h" +#include "Interface/WidgetInterface.h" #include #include @@ -40,120 +39,110 @@ class ThresholdWidget : public WidgetInterface { Q_OBJECT public: - ThresholdWidget(SlicesHandler* hand3D, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0); + ThresholdWidget(SlicesHandler *hand3D, QWidget *parent = 0, + const char *name = 0, Qt::WindowFlags wFlags = 0); ~ThresholdWidget(); - FILE* SaveParams(FILE* fp, int version); - FILE* LoadParams(FILE* fp, int version); - QSize sizeHint() const; - void init(); - void newloaded(); - void hideparams_changed(); - std::string GetName() { return std::string("Threshold"); }; - virtual QIcon GetIcon(QDir picdir) - { - return QIcon(picdir.absFilePath(QString("thresholding.png")).ascii()); - }; + FILE *SaveParams(FILE *fp, int version) override; + FILE *LoadParams(FILE *fp, int version) override; + QSize sizeHint() const override; + void init() override; + void newloaded() override; + void hideparams_changed() override; + std::string GetName() override { return std::string("Threshold"); } + QIcon GetIcon(QDir picdir) override { return QIcon(picdir.absFilePath(QString("thresholding.png"))); } private: - bmphandler* bmphand; - SlicesHandler* handler3D; + void on_tissuenr_changed(int i) override; + void on_slicenr_changed() override; + + bmphandler *bmphand; + SlicesHandler *handler3D; unsigned short activeslice; std::vector filenames; - Q3HBox* hboxoverall; - Q3VBox* vboxmethods; - Q3HBox* hbox1; - Q3HBox* hbox1b; - Q3HBox* hbox2; - Q3HBox* hbox2a; - Q3HBox* hbox3; - Q3HBox* hbox4; - Q3HBox* hbox5; + Q3HBox *hboxoverall; + Q3VBox *vboxmethods; + Q3HBox *hbox1; + Q3HBox *hbox1b; + Q3HBox *hbox2; + Q3HBox *hbox2a; + Q3HBox *hbox3; + Q3HBox *hbox4; + Q3HBox *hbox5; // Q3HBox *hbox6; - Q3HBox* hbox7; - Q3HBox* hbox8; - Q3HBox* hboxfilenames; - Q3VBox* vbox1; - Q3VBox* vbox2; - Q3VBox* vbox3; - Q3VBox* vbox4; - Q3VBox* vbox5; - QLabel* txt_nrtissues; - QLabel* txt_dim; - QLabel* txt_useCenterFile; - QLabel* txt_tissuenr; - QLabel* txt_px; - QLabel* txt_py; - QLabel* txt_lx; - QLabel* txt_ly; - QLabel* txt_iternr; - QLabel* txt_converge; - QLabel* txt_minpix; - QLabel* txt_slider; - QLabel* txt_ratio; - QLabel* txt_lower; - QLabel* txt_upper; - QLabel* txt_filename; - QSlider* slider; - QSlider* ratio; - QSpinBox* sb_nrtissues; - QSpinBox* sb_dim; - QSpinBox* sb_tissuenr; - QSpinBox* sb_px; - QSpinBox* sb_py; - QSpinBox* sb_lx; - QSpinBox* sb_ly; - QSpinBox* sb_iternr; - QSpinBox* sb_converge; - QSpinBox* sb_minpix; - QPushButton* pushexec; - QPushButton* pushfilename; + Q3HBox *hbox7; + Q3HBox *hbox8; + Q3HBox *hboxfilenames; + Q3VBox *vbox1; + Q3VBox *vbox2; + Q3VBox *vbox3; + Q3VBox *vbox4; + Q3VBox *vbox5; + QLabel *txt_nrtissues; + QLabel *txt_dim; + QLabel *txt_useCenterFile; + QLabel *txt_tissuenr; + QLabel *txt_px; + QLabel *txt_py; + QLabel *txt_lx; + QLabel *txt_ly; + QLabel *txt_iternr; + QLabel *txt_converge; + QLabel *txt_minpix; + QLabel *txt_slider; + QLabel *txt_ratio; + QLabel *txt_lower; + QLabel *txt_upper; + QLabel *txt_filename; + QSlider *slider; + QSlider *ratio; + QSpinBox *sb_nrtissues; + QSpinBox *sb_dim; + QSpinBox *sb_tissuenr; + QSpinBox *sb_px; + QSpinBox *sb_py; + QSpinBox *sb_lx; + QSpinBox *sb_ly; + QSpinBox *sb_iternr; + QSpinBox *sb_converge; + QSpinBox *sb_minpix; + QPushButton *pushexec; + QPushButton *pushfilename; // QPushButton *pushrange; - QCheckBox* subsect; - QRadioButton* rb_manual; - QRadioButton* rb_histo; - QRadioButton* rb_kmeans; - QRadioButton* rb_EM; - QButtonGroup* modegroup; - QCheckBox* allslices; + QCheckBox *subsect; + QRadioButton *rb_manual; + QRadioButton *rb_histo; + QRadioButton *rb_kmeans; + QRadioButton *rb_EM; + QButtonGroup *modegroup; + QCheckBox *allslices; float lower, upper; float threshs[21]; float weights[20]; - float* bits[20]; + float *bits[20]; unsigned bits1[20]; bool dontundo; - QLineEdit* le_borderval; - QLineEdit* le_filename; - QPushButton* pb_saveborders; - QPushButton* pb_loadborders; + QLineEdit *le_borderval; + QLineEdit *le_filename; + QPushButton *pb_saveborders; + QPushButton *pb_loadborders; //QButtonGroup *buttonGroup; - QCheckBox* buttonR; - QCheckBox* buttonG; - QCheckBox* buttonB; - QCheckBox* buttonA; - QCheckBox* cb_useCenterFile; - QLineEdit* le_centerFilename; - QPushButton* pushcenterFilename; + QCheckBox *buttonR; + QCheckBox *buttonG; + QCheckBox *buttonB; + QCheckBox *buttonA; + QCheckBox *cb_useCenterFile; + QLineEdit *le_centerFilename; + QPushButton *pushcenterFilename; QString centerFilename; -signals: - void begin_datachange(iseg::DataSelection& dataSelection, - QWidget* sender = NULL, bool beginUndo = true); - void end_datachange(QWidget* sender = NULL, - iseg::EndUndoAction undoAction = iseg::EndUndo); - -public slots: - void slicenr_changed(); - private slots: - void bmphand_changed(bmphandler* bmph); + void bmphand_changed(bmphandler *bmph); void subsect_toggled(); void execute(); void method_changed(int); void getrange(); void dim_changed(int newval); void nrtissues_changed(int newval); - void tissuenr_changed(int newval); void slider_changed(int newval); void slider_pressed(); void slider_released(); @@ -168,5 +157,3 @@ private slots: }; } // namespace iseg - -#endif diff --git a/iSeg/tissuecleaner.cpp b/iSeg/TissueCleaner.cpp similarity index 100% rename from iSeg/tissuecleaner.cpp rename to iSeg/TissueCleaner.cpp diff --git a/iSeg/tissuecleaner.h b/iSeg/TissueCleaner.h similarity index 100% rename from iSeg/tissuecleaner.h rename to iSeg/TissueCleaner.h diff --git a/iSeg/tissueinfos.cpp b/iSeg/TissueInfos.cpp similarity index 100% rename from iSeg/tissueinfos.cpp rename to iSeg/TissueInfos.cpp diff --git a/iSeg/tissueinfos.h b/iSeg/TissueInfos.h similarity index 99% rename from iSeg/tissueinfos.h rename to iSeg/TissueInfos.h index 53fecb67..734be799 100755 --- a/iSeg/tissueinfos.h +++ b/iSeg/TissueInfos.h @@ -11,8 +11,10 @@ #define TISSUEINFOS #include "Core/Types.h" -#include + #include // BL TODO get rid of this + +#include #include #include diff --git a/iSeg/tissuelayerinfos.cpp b/iSeg/TissueLayerInfos.cpp similarity index 100% rename from iSeg/tissuelayerinfos.cpp rename to iSeg/TissueLayerInfos.cpp diff --git a/iSeg/tissuelayerinfos.h b/iSeg/TissueLayerInfos.h similarity index 100% rename from iSeg/tissuelayerinfos.h rename to iSeg/TissueLayerInfos.h diff --git a/iSeg/transformwidget.cpp b/iSeg/TransformWidget.cpp similarity index 89% rename from iSeg/transformwidget.cpp rename to iSeg/TransformWidget.cpp index f3ed6340..a9e872fc 100755 --- a/iSeg/transformwidget.cpp +++ b/iSeg/TransformWidget.cpp @@ -13,8 +13,6 @@ #include "SlicesHandler.h" #include "TransformWidget.h" -#include "Core/Point.h" - #include #include #include @@ -33,8 +31,8 @@ using namespace std; using namespace iseg; TransformWidget::TransformWidget(SlicesHandler* hand3D, QWidget* parent, - const char* name, Qt::WindowFlags wFlags) - : WidgetInterface(parent, name, wFlags), handler3D(hand3D) + const char* name, Qt::WindowFlags wFlags) + : WidgetInterface(parent, name, wFlags), handler3D(hand3D) { setToolTip(Format("Shift/rotate/scale the Source, Target or Tissue.")); @@ -56,7 +54,7 @@ TransformWidget::TransformWidget(SlicesHandler* hand3D, QWidget* parent, // Transformation selection radio buttons translateRadioButton = - new QRadioButton(QString("Translate"), vBoxTransforms); + new QRadioButton(QString("Translate"), vBoxTransforms); rotateRadioButton = new QRadioButton(QString("Rotate"), vBoxTransforms); scaleRadioButton = new QRadioButton(QString("Scale"), vBoxTransforms); shearRadioButton = new QRadioButton(QString("Shear"), vBoxTransforms); @@ -75,7 +73,7 @@ TransformWidget::TransformWidget(SlicesHandler* hand3D, QWidget* parent, transformSourceCheckBox = new QCheckBox(QString("Source"), hBoxSelectData); transformTargetCheckBox = new QCheckBox(QString("Target"), hBoxSelectData); transformTissuesCheckBox = - new QCheckBox(QString("Tissues"), hBoxSelectData); + new QCheckBox(QString("Tissues"), hBoxSelectData); transformSourceCheckBox->setChecked(TRUE); transformTargetCheckBox->setChecked(TRUE); transformTissuesCheckBox->setChecked(TRUE); @@ -112,7 +110,7 @@ TransformWidget::TransformWidget(SlicesHandler* hand3D, QWidget* parent, hBoxExecute = new Q3HBox(vBoxParams); executePushButton = new QPushButton("Execute", hBoxExecute); allSlicesCheckBox = - new QCheckBox(QString("Apply to all slices"), hBoxExecute); + new QCheckBox(QString("Apply to all slices"), hBoxExecute); allSlicesCheckBox->setLayoutDirection(Qt::RightToLeft); cancelPushButton = new QPushButton("Cancel", vBoxParams); @@ -151,31 +149,31 @@ TransformWidget::TransformWidget(SlicesHandler* hand3D, QWidget* parent, // Signals QObject::connect(transformButtonGroup, SIGNAL(buttonClicked(int)), this, - SLOT(TransformChanged(int))); + SLOT(TransformChanged(int))); QObject::connect(transformSourceCheckBox, SIGNAL(stateChanged(int)), this, - SLOT(SelectSourceChanged(int))); + SLOT(SelectSourceChanged(int))); QObject::connect(transformTargetCheckBox, SIGNAL(stateChanged(int)), this, - SLOT(SelectTargetChanged(int))); + SLOT(SelectTargetChanged(int))); QObject::connect(transformTissuesCheckBox, SIGNAL(stateChanged(int)), this, - SLOT(SelectTissuesChanged(int))); + SLOT(SelectTissuesChanged(int))); QObject::connect(slider1, SIGNAL(valueChanged(int)), this, - SLOT(Slider1Changed(int))); + SLOT(Slider1Changed(int))); QObject::connect(slider2, SIGNAL(valueChanged(int)), this, - SLOT(Slider2Changed(int))); + SLOT(Slider2Changed(int))); QObject::connect(lineEdit1, SIGNAL(editingFinished()), this, - SLOT(LineEdit1Edited())); + SLOT(LineEdit1Edited())); QObject::connect(lineEdit2, SIGNAL(editingFinished()), this, - SLOT(LineEdit2Edited())); + SLOT(LineEdit2Edited())); QObject::connect(flipPushButton, SIGNAL(clicked()), this, - SLOT(FlipPushButtonClicked())); + SLOT(FlipPushButtonClicked())); QObject::connect(executePushButton, SIGNAL(clicked()), this, - SLOT(ExecutePushButtonClicked())); + SLOT(ExecutePushButtonClicked())); QObject::connect(cancelPushButton, SIGNAL(clicked()), this, - SLOT(CancelPushButtonClicked())); + SLOT(CancelPushButtonClicked())); } TransformWidget::~TransformWidget() { delete sliceTransform; } @@ -203,7 +201,7 @@ void TransformWidget::Slider1Changed(int value) // Scale: Logarithmic scale: y = 10^(x/50-1), x in [0, 100] updateParameter1 = std::pow(10, value / 50.0 - 1.0); updateParameter1 = std::floor(updateParameter1 * 100) / - 100.0; // Round to two fractional digits + 100.0; // Round to two fractional digits lineEdit1->setText(QString("%1").arg(updateParameter1, 0, 'f', 2)); } else if (shearRadioButton->isChecked()) @@ -236,7 +234,7 @@ void TransformWidget::Slider2Changed(int value) // Scale: Logarithmic scale: y = 10^(x/50-1), x in [0, 100] updateParameter2 = std::pow(10, value / 50.0 - 1.0); updateParameter2 = std::floor(updateParameter2 * 100) / - 100.0; // Round to two fractional digits + 100.0; // Round to two fractional digits lineEdit2->setText(QString("%1").arg(updateParameter2, 0, 'f', 2)); } @@ -254,13 +252,13 @@ void TransformWidget::LineEdit1Edited() double value = lineEdit1->text().toDouble(); if (translateRadioButton->isChecked() || rotateRadioButton->isChecked() || - shearRadioButton->isChecked()) + shearRadioButton->isChecked()) { // Translate: Linear scale: y = x, x in [-width, width] // Rotate: Linear scale: y = x, x in [-180, 180] // Shear: Linear scale: y = x, x in [-45, 45] updateParameter1 = max((double)slider1->minimum(), - min(value, (double)slider1->maximum())); + min(value, (double)slider1->maximum())); slider1->setValue(std::floor(updateParameter1 + 0.5)); lineEdit1->setText(QString("%1").arg(updateParameter1, 0, 'f', 2)); } @@ -269,7 +267,7 @@ void TransformWidget::LineEdit1Edited() // Scale: Logarithmic scale: y = 10^(x/50-1), x in [0, 100] updateParameter1 = max(0.1, min(value, 10.0)); slider1->setValue( - std::floor((std::log10(updateParameter1) + 1) * 50.0 + 0.5)); + std::floor((std::log10(updateParameter1) + 1) * 50.0 + 0.5)); lineEdit1->setText(QString("%1").arg(updateParameter1, 0, 'f', 2)); } @@ -290,7 +288,7 @@ void TransformWidget::LineEdit2Edited() { // Translate: Linear scale: y = x, x in [-height, height] updateParameter2 = max((double)slider2->minimum(), - min(value, (double)slider2->maximum())); + min(value, (double)slider2->maximum())); slider2->setValue(std::floor(updateParameter2 + 0.5)); lineEdit2->setText(QString("%1").arg(updateParameter2, 0, 'f', 2)); } @@ -299,7 +297,7 @@ void TransformWidget::LineEdit2Edited() // Scale: Logarithmic scale: y = 10^(x/50-1), x in [0, 100] updateParameter2 = max(0.1, min(value, 10.0)); slider2->setValue( - std::floor((std::log10(updateParameter2) + 1) * 50.0 + 0.5)); + std::floor((std::log10(updateParameter2) + 1) * 50.0 + 0.5)); lineEdit2->setText(QString("%1").arg(updateParameter2, 0, 'f', 2)); } @@ -328,8 +326,8 @@ void TransformWidget::UpdatePreview() { // Translate sliceTransform->Translate( - updateParameter1 - transformParameters.translationOffset[0], - updateParameter2 - transformParameters.translationOffset[1]); + updateParameter1 - transformParameters.translationOffset[0], + updateParameter2 - transformParameters.translationOffset[1]); transformParameters.translationOffset[0] = updateParameter1; transformParameters.translationOffset[1] = updateParameter2; } @@ -337,19 +335,19 @@ void TransformWidget::UpdatePreview() { // Rotate sliceTransform->Rotate(updateParameter1 - - transformParameters.rotationAngle, - transformParameters.transformCenter[0], - transformParameters.transformCenter[1]); + transformParameters.rotationAngle, + transformParameters.transformCenter[0], + transformParameters.transformCenter[1]); transformParameters.rotationAngle = updateParameter1; } else if (scaleRadioButton->isOn()) { // Scale sliceTransform->Scale( - updateParameter1 / transformParameters.scalingFactor[0], - updateParameter2 / transformParameters.scalingFactor[1], - transformParameters.transformCenter[0], - transformParameters.transformCenter[1]); + updateParameter1 / transformParameters.scalingFactor[0], + updateParameter2 / transformParameters.scalingFactor[1], + transformParameters.transformCenter[0], + transformParameters.transformCenter[1]); transformParameters.scalingFactor[0] = updateParameter1; transformParameters.scalingFactor[1] = updateParameter2; } @@ -359,14 +357,14 @@ void TransformWidget::UpdatePreview() if (xAxisRadioButton->isChecked()) { sliceTransform->Shear(updateParameter1 - - transformParameters.shearingAngle, - true, transformParameters.transformCenter[0]); + transformParameters.shearingAngle, + true, transformParameters.transformCenter[0]); } else { sliceTransform->Shear( - updateParameter1 - transformParameters.shearingAngle, false, - transformParameters.transformCenter[1]); + updateParameter1 - transformParameters.shearingAngle, false, + transformParameters.transformCenter[1]); } transformParameters.shearingAngle = updateParameter1; } @@ -464,8 +462,8 @@ void TransformWidget::SelectSourceChanged(int state) // Set data to be transformed sliceTransform->SelectTransformData(transformSourceCheckBox->isChecked(), - transformTargetCheckBox->isChecked(), - transformTissuesCheckBox->isChecked()); + transformTargetCheckBox->isChecked(), + transformTissuesCheckBox->isChecked()); // Signal data change emit end_datachange(this, iseg::NoUndo); @@ -480,8 +478,8 @@ void TransformWidget::SelectTargetChanged(int state) // Set data to be transformed sliceTransform->SelectTransformData(transformSourceCheckBox->isChecked(), - transformTargetCheckBox->isChecked(), - transformTissuesCheckBox->isChecked()); + transformTargetCheckBox->isChecked(), + transformTissuesCheckBox->isChecked()); // Signal data change emit end_datachange(this, iseg::NoUndo); @@ -496,8 +494,8 @@ void TransformWidget::SelectTissuesChanged(int state) // Set data to be transformed sliceTransform->SelectTransformData(transformSourceCheckBox->isChecked(), - transformTargetCheckBox->isChecked(), - transformTissuesCheckBox->isChecked()); + transformTargetCheckBox->isChecked(), + transformTissuesCheckBox->isChecked()); // Signal data change emit end_datachange(this, iseg::NoUndo); @@ -505,7 +503,7 @@ void TransformWidget::SelectTissuesChanged(int state) QSize TransformWidget::sizeHint() const { return hBoxOverall->sizeHint(); } -void TransformWidget::slicenr_changed() +void TransformWidget::on_slicenr_changed() { iseg::DataSelection dataSelection; dataSelection.sliceNr = handler3D->get_activeslice(); @@ -571,14 +569,14 @@ bool TransformWidget::GetIsIdentityTransform() } void TransformWidget::GetDataSelection(bool& source, bool& target, - bool& tissues) + bool& tissues) { source = transformSourceCheckBox->isChecked(); target = transformTargetCheckBox->isChecked(); tissues = transformTissuesCheckBox->isChecked(); } -void TransformWidget::pt_clicked(Point p) +void TransformWidget::on_mouse_clicked(Point p) { if (centerSelectPushButton->isChecked()) { @@ -616,10 +614,10 @@ void TransformWidget::ResetWidgets() // Reset transform parameters transformParameters.translationOffset[0] = - transformParameters.translationOffset[1] = 0; + transformParameters.translationOffset[1] = 0; transformParameters.rotationAngle = 0.0; transformParameters.scalingFactor[0] = - transformParameters.scalingFactor[1] = 1.0; + transformParameters.scalingFactor[1] = 1.0; transformParameters.shearingAngle = 0.0; // Reset sliders @@ -627,12 +625,12 @@ void TransformWidget::ResetWidgets() { // Translate: Range = [-width, width], value = 0 slider1->setRange(-(int)handler3D->return_width(), - handler3D->return_width()); + handler3D->return_width()); slider1->setSteps(1, 10); slider1->setValue(0); Slider1Changed(slider1->value()); slider2->setRange(-(int)handler3D->return_height(), - handler3D->return_height()); + handler3D->return_height()); slider2->setSteps(1, 10); slider2->setValue(0); Slider2Changed(slider2->value()); diff --git a/iSeg/transformwidget.h b/iSeg/TransformWidget.h similarity index 79% rename from iSeg/transformwidget.h rename to iSeg/TransformWidget.h index b9d62ab1..ccf6c359 100755 --- a/iSeg/transformwidget.h +++ b/iSeg/TransformWidget.h @@ -7,15 +7,11 @@ * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ -#ifndef TRANSFORM_17NOV11 -#define TRANSFORM_17NOV11 +#pragma once #include "SliceTransform.h" -#include "Core/DataSelection.h" -#include "Core/Point.h" - -#include "Plugin/WidgetInterface.h" +#include "Interface/WidgetInterface.h" #include #include @@ -40,23 +36,19 @@ class TransformWidget : public WidgetInterface public: TransformWidget(SlicesHandler* hand3D, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0); + const char* name = 0, Qt::WindowFlags wFlags = 0); ~TransformWidget(); - void init(); - void cleanup(); - void newloaded(); - void hideparams_changed(); + void init() override; + void cleanup() override; + void newloaded() override; + void hideparams_changed() override; - bool GetIsIdentityTransform(); - void GetDataSelection(bool& source, bool& target, bool& tissues); + QSize sizeHint() const override; + std::string GetName() override { return std::string("Transform"); } + QIcon GetIcon(QDir picdir) override { return QIcon(picdir.absFilePath(QString("transform.png"))); } - QSize sizeHint() const; - std::string GetName() { return std::string("Transform"); }; - virtual QIcon GetIcon(QDir picdir) - { - return QIcon(picdir.absFilePath(QString("transform.png")).ascii()); - }; + void GetDataSelection(bool& source, bool& target, bool& tissues); private: struct TransformParametersStruct @@ -68,6 +60,8 @@ class TransformWidget : public WidgetInterface int transformCenter[2]; }; + bool GetIsIdentityTransform(); + void UpdatePreview(); void SetCenter(int x, int y); void SetCenterDefault(); @@ -75,6 +69,9 @@ class TransformWidget : public WidgetInterface void BitsChanged(); private: + void on_slicenr_changed() override; + void on_mouse_clicked(Point p) override; + // Image data SlicesHandler* handler3D; @@ -132,15 +129,7 @@ class TransformWidget : public WidgetInterface double updateParameter2; TransformParametersStruct transformParameters; -signals: - void begin_datachange(iseg::DataSelection& dataSelection, - QWidget* sender = NULL, bool beginUndo = true); - void end_datachange(QWidget* sender = NULL, - iseg::EndUndoAction undoAction = iseg::EndUndo); - public slots: - void slicenr_changed(); - void pt_clicked(Point p); void bmp_changed(); void work_changed(); void tissues_changed(); @@ -160,5 +149,3 @@ private slots: }; } // namespace iseg - -#endif diff --git a/iSeg/VesselWidget.cpp b/iSeg/VesselWidget.cpp index 44e0fdfb..ca09ec5e 100755 --- a/iSeg/VesselWidget.cpp +++ b/iSeg/VesselWidget.cpp @@ -12,10 +12,7 @@ #include "SlicesHandler.h" #include "VesselWidget.h" -#include "Plugin/WidgetInterface.h" - #include "Core/Pair.h" -#include "Core/Point.h" #include "Core/Vec3.h" #include @@ -29,8 +26,8 @@ using namespace std; using namespace iseg; VesselWidget::VesselWidget(SlicesHandler* hand3D, QWidget* parent, - const char* name, Qt::WindowFlags wFlags) - : WidgetInterface(parent, name, wFlags), handler3D(hand3D) + const char* name, Qt::WindowFlags wFlags) + : WidgetInterface(parent, name, wFlags), handler3D(hand3D) { vbox1 = new Q3VBox(this); hbox1 = new Q3HBox(vbox1); @@ -69,15 +66,15 @@ VesselWidget::VesselWidget(SlicesHandler* hand3D, QWidget* parent, marks_changed(); QObject::connect(sb_nrend, SIGNAL(valueChanged(int)), this, - SLOT(nrend_changed(int))); + SLOT(nrend_changed(int))); QObject::connect(sb_endnr, SIGNAL(valueChanged(int)), this, - SLOT(endnr_changed(int))); + SLOT(endnr_changed(int))); QObject::connect(pb_exec, SIGNAL(clicked()), this, SLOT(execute())); QObject::connect(pb_store, SIGNAL(clicked()), this, SLOT(savevessel())); QObject::connect(cbb_lb1, SIGNAL(activated(int)), this, - SLOT(cbb1_changed(int))); + SLOT(cbb1_changed(int))); QObject::connect(cbb_lb2, SIGNAL(activated(int)), this, - SLOT(cbb2_changed(int))); + SLOT(cbb2_changed(int))); } VesselWidget::~VesselWidget() { delete vbox1; } @@ -93,7 +90,7 @@ void VesselWidget::init() if (branchTree.getSize() > 0) { branchTree.getItem()->getCenterListSlice_inclchildren( - handler3D->get_activeslice(), vp); + handler3D->get_activeslice(), vp); } emit vp1_changed(&vp); } @@ -114,9 +111,9 @@ void VesselWidget::getlabels() { handler3D->get_labels(&labels); QObject::disconnect(cbb_lb1, SIGNAL(activated(int)), this, - SLOT(cbb1_changed(int))); + SLOT(cbb1_changed(int))); QObject::disconnect(cbb_lb2, SIGNAL(activated(int)), this, - SLOT(cbb2_changed(int))); + SLOT(cbb2_changed(int))); cbb_lb1->clear(); cbb_lb2->clear(); @@ -168,9 +165,9 @@ void VesselWidget::getlabels() } QObject::connect(cbb_lb1, SIGNAL(activated(int)), this, - SLOT(cbb1_changed(int))); + SLOT(cbb1_changed(int))); QObject::connect(cbb_lb2, SIGNAL(activated(int)), this, - SLOT(cbb2_changed(int))); + SLOT(cbb2_changed(int))); if (labels.empty()) { @@ -203,7 +200,7 @@ void VesselWidget::execute() end[1] = selectedlabels[0].p.py; end[2] = selectedlabels[0].slicenr; - std::vector seeds; // only distal seeds + std::vector seeds; // only distal seeds std::vector allSeeds; // seeds + end point // save all start seeds in s @@ -226,7 +223,7 @@ void VesselWidget::execute() allSeeds.push_back(end); if (!seeds.empty() && (handler3D->return_nrslices() > 0) && - (handler3D->return_width() > 0) && (handler3D->return_height() > 0)) + (handler3D->return_width() > 0) && (handler3D->return_height() > 0)) { Vec3 tmpbbStart; //tmpbbStart[0]=0; @@ -253,10 +250,7 @@ void VesselWidget::execute() { _world.dijkstra(seeds, end, &branchTree); pb_store->setEnabled(true); - slicenr_changed(); - /*FILE *fp=fopen("D:\\test100.txt","a"); - _world.outputBranchTree(branchTree.getItem(),"vessel",fp); - fclose(fp);*/ + on_slicenr_changed(); // BL Why? } } @@ -292,7 +286,7 @@ void VesselWidget::nrend_changed(int newval) void VesselWidget::endnr_changed(int newval) { QObject::disconnect(cbb_lb2, SIGNAL(activated(int)), this, - SLOT(cbb2_changed(int))); + SLOT(cbb2_changed(int))); size_t i = 0; while ((i < labels.size()) && (labels[i] != selectedlabels[newval])) @@ -300,7 +294,7 @@ void VesselWidget::endnr_changed(int newval) cbb_lb2->setCurrentItem(i); QObject::connect(cbb_lb2, SIGNAL(activated(int)), this, - SLOT(cbb2_changed(int))); + SLOT(cbb2_changed(int))); } void VesselWidget::cbb1_changed(int newval) @@ -323,14 +317,14 @@ void VesselWidget::reset_branchTree() pb_store->setEnabled(false); } -void VesselWidget::slicenr_changed() +void VesselWidget::on_slicenr_changed() { branchTree.resetIterator(); vp.clear(); if (branchTree.getSize() > 0) { branchTree.getItem()->getCenterListSlice_inclchildren( - handler3D->get_activeslice(), vp); + handler3D->get_activeslice(), vp); } emit vp1_changed(&vp); } @@ -338,7 +332,7 @@ void VesselWidget::slicenr_changed() void VesselWidget::savevessel() { QString savefilename = Q3FileDialog::getSaveFileName( - QString::null, "Vessel-Tracks (*.txt)\n", this); //, filename); + QString::null, "Vessel-Tracks (*.txt)\n", this); //, filename); if (savefilename.length() > 4 && !savefilename.endsWith(QString(".txt"))) savefilename.append(".txt"); @@ -350,7 +344,7 @@ void VesselWidget::savevessel() float thick = handler3D->get_slicethickness(); float epsilon = max(max(pair1.high, pair1.low), thick); branchTree.getItem()->doug_peuck_inclchildren(epsilon, pair1.high, - pair1.low, thick, vp); + pair1.low, thick, vp); FILE* fp = fopen(savefilename.ascii(), "w"); int version = 2; unsigned short w = handler3D->return_width(); @@ -375,8 +369,13 @@ void VesselWidget::savevessel() } } -void VesselWidget::clean_up() +void VesselWidget::cleanup() { vp.clear(); emit vp1_changed(&vp); } + +QIcon iseg::VesselWidget::GetIcon(QDir picdir) +{ + return QIcon(picdir.absFilePath(QString("vessel.png"))); +} diff --git a/iSeg/VesselWidget.h b/iSeg/VesselWidget.h index e24b9d14..f637d28f 100755 --- a/iSeg/VesselWidget.h +++ b/iSeg/VesselWidget.h @@ -13,7 +13,7 @@ #include "SlicesHandler.h" #include "World.h" -#include "Plugin/WidgetInterface.h" +#include "Interface/WidgetInterface.h" #include #include @@ -31,26 +31,25 @@ class VesselWidget : public WidgetInterface { Q_OBJECT public: - VesselWidget(SlicesHandler* hand3D, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0); + VesselWidget(SlicesHandler* hand3D, QWidget* parent = 0, const char* name = 0, + Qt::WindowFlags wFlags = 0); ~VesselWidget(); - FILE* SaveParams(FILE* fp, int version); - FILE* LoadParams(FILE* fp, int version); - QSize sizeHint() const; - void init(); - void newloaded(); - void slicenr_changed(); - std::string GetName() { return std::string("Vessel"); }; - virtual QIcon GetIcon(QDir picdir) - { - return QIcon(picdir.absFilePath(QString("vessel.png")).ascii()); - }; - void clean_up(); + FILE* SaveParams(FILE* fp, int version) override; + FILE* LoadParams(FILE* fp, int version) override; + QSize sizeHint() const override; + void init() override; + void newloaded() override; + std::string GetName() override { return std::string("Vessel"); } + QIcon GetIcon(QDir picdir) override; + void cleanup() override; private: - BranchTree branchTree; + void on_slicenr_changed() override; + void getlabels(); void reset_branchTree(); + + BranchTree branchTree; SlicesHandler* handler3D; std::vector labels; std::vector selectedlabels; diff --git a/iSeg/watershedwidget.cpp b/iSeg/WatershedWidget.cpp similarity index 82% rename from iSeg/watershedwidget.cpp rename to iSeg/WatershedWidget.cpp index 34ba1ebb..51346642 100755 --- a/iSeg/watershedwidget.cpp +++ b/iSeg/WatershedWidget.cpp @@ -14,8 +14,6 @@ #include "WatershedWidget.h" #include "bmp_read_1.h" -#include "Core/Point.h" - #include #include #include @@ -34,18 +32,18 @@ using namespace iseg; WatershedWidget::WatershedWidget(SlicesHandler* hand3D, QWidget* parent, - const char* name, Qt::WindowFlags wFlags) - : WidgetInterface(parent, name, wFlags), handler3D(hand3D) + const char* name, Qt::WindowFlags wFlags) + : WidgetInterface(parent, name, wFlags), handler3D(hand3D) { setToolTip( - Format("Segment a tissue (2D) by selecting points in the current slice " - "based on the Watershed method." - "
" - "The method: the gradient of the slightly smoothed image is " - "calculated. High values are interpreted as mountains and " - "low values as valleys. Subsequently, a flooding with water is " - "simulated resulting in thousands of basins. " - "Higher water causes adjacent basins to merge. ")); + Format("Segment a tissue (2D) by selecting points in the current slice " + "based on the Watershed method." + "
" + "The method: the gradient of the slightly smoothed image is " + "calculated. High values are interpreted as mountains and " + "low values as valleys. Subsequently, a flooding with water is " + "simulated resulting in thousands of basins. " + "Higher water causes adjacent basins to merge. ")); activeslice = handler3D->get_activeslice(); bmphand = handler3D->get_activebmphandler(); @@ -71,13 +69,13 @@ WatershedWidget::WatershedWidget(SlicesHandler* hand3D, QWidget* parent, sbh_old = sb_h->value(); QObject::connect(sl_h, SIGNAL(valueChanged(int)), this, - SLOT(hsl_changed())); + SLOT(hsl_changed())); QObject::connect(sl_h, SIGNAL(sliderPressed()), this, - SLOT(slider_pressed())); + SLOT(slider_pressed())); QObject::connect(sl_h, SIGNAL(sliderReleased()), this, - SLOT(slider_released())); + SLOT(slider_released())); QObject::connect(sb_h, SIGNAL(valueChanged(int)), this, - SLOT(hsb_changed(int))); + SLOT(hsb_changed(int))); QObject::connect(btn_exec, SIGNAL(clicked()), this, SLOT(execute())); } @@ -158,7 +156,7 @@ void WatershedWidget::recalc1() if (usp != NULL) { bmphand->construct_regions( - (unsigned int)(sb_h->value() * sl_h->value() * 0.005f), usp); + (unsigned int)(sb_h->value() * sl_h->value() * 0.005f), usp); } return; @@ -173,12 +171,10 @@ WatershedWidget::~WatershedWidget() free(usp); } -void WatershedWidget::slicenr_changed() +void WatershedWidget::on_slicenr_changed() { - // if(activeslice!=handler3D->get_activeslice()){ activeslice = handler3D->get_activeslice(); bmphand_changed(handler3D->get_activebmphandler()); - // } } void WatershedWidget::bmphand_changed(bmphandler* bmph) @@ -195,7 +191,7 @@ void WatershedWidget::bmphand_changed(bmphandler* bmph) void WatershedWidget::init() { - slicenr_changed(); + on_slicenr_changed(); hideparams_changed(); } @@ -242,9 +238,9 @@ FILE* WatershedWidget::LoadParams(FILE* fp, int version) if (version >= 2) { QObject::disconnect(sl_h, SIGNAL(valueChanged(int)), this, - SLOT(hsl_changed())); + SLOT(hsl_changed())); QObject::disconnect(sb_h, SIGNAL(valueChanged(int)), this, - SLOT(hsb_changed(int))); + SLOT(hsb_changed(int))); int dummy; fread(&dummy, sizeof(int), 1, fp); @@ -255,9 +251,9 @@ FILE* WatershedWidget::LoadParams(FILE* fp, int version) fread(&sbh_old, sizeof(float), 1, fp); QObject::connect(sl_h, SIGNAL(valueChanged(int)), this, - SLOT(hsl_changed())); + SLOT(hsl_changed())); QObject::connect(sb_h, SIGNAL(valueChanged(int)), this, - SLOT(hsb_changed(int))); + SLOT(hsb_changed(int))); } return fp; } diff --git a/iSeg/watershedwidget.h b/iSeg/WatershedWidget.h similarity index 62% rename from iSeg/watershedwidget.h rename to iSeg/WatershedWidget.h index 30e0145d..97f3eed4 100755 --- a/iSeg/watershedwidget.h +++ b/iSeg/WatershedWidget.h @@ -7,12 +7,9 @@ * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ -#ifndef WATERSHED_8MARCH05 -#define WATERSHED_8MARCH05 +#pragma once -#include "Plugin/WidgetInterface.h" - -#include "Core/DataSelection.h" +#include "Interface/WidgetInterface.h" #include #include @@ -39,21 +36,22 @@ class WatershedWidget : public WidgetInterface Q_OBJECT public: WatershedWidget(SlicesHandler* hand3D, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0); + const char* name = 0, Qt::WindowFlags wFlags = 0); ~WatershedWidget(); - QSize sizeHint() const; - void init(); - void newloaded(); - FILE* SaveParams(FILE* fp, int version); - FILE* LoadParams(FILE* fp, int version); - void hideparams_changed(); - std::string GetName() { return std::string("Watershed"); }; - virtual QIcon GetIcon(QDir picdir) - { - return QIcon(picdir.absFilePath(QString("watershed.png")).ascii()); - }; + QSize sizeHint() const override; + void init() override; + void newloaded() override; + FILE* SaveParams(FILE* fp, int version) override; + FILE* LoadParams(FILE* fp, int version) override; + void hideparams_changed() override; + std::string GetName() override { return std::string("Watershed"); } + QIcon GetIcon(QDir picdir) override { return QIcon(picdir.absFilePath(QString("watershed.png"))); } private: + void on_slicenr_changed() override; + + void recalc1(); + unsigned int* usp; int sbh_old; bmphandler* bmphand; @@ -68,16 +66,7 @@ class WatershedWidget : public WidgetInterface QSlider* sl_h; QPushButton* btn_exec; - void recalc1(); - -signals: - void begin_datachange(iseg::DataSelection& dataSelection, - QWidget* sender = NULL, bool beginUndo = true); - void end_datachange(QWidget* sender = NULL, - iseg::EndUndoAction undoAction = iseg::EndUndo); - public slots: - void slicenr_changed(); void marks_changed(); private slots: @@ -91,5 +80,3 @@ private slots: }; } // namespace iseg - -#endif diff --git a/iSeg/widgetcollection.cpp b/iSeg/WidgetCollection.cpp similarity index 80% rename from iSeg/widgetcollection.cpp rename to iSeg/WidgetCollection.cpp index 52be14fd..171cc366 100755 --- a/iSeg/widgetcollection.cpp +++ b/iSeg/WidgetCollection.cpp @@ -17,8 +17,6 @@ #include "bmp_read_1.h" #include "config.h" -#include "Core/Point.h" - #include #include #include @@ -66,7 +64,7 @@ using namespace std; using namespace iseg; namespace { -inline bool SearchFilter(const std::string& text, const std::string& filter) +inline bool SearchFilter(const std::string &text, const std::string &filter) { namespace algo = boost::algorithm; @@ -77,7 +75,7 @@ inline bool SearchFilter(const std::string& text, const std::string& filter) std::vector search_tokens; algo::split(search_tokens, search_text, algo::is_space(), - algo::token_compress_on); + algo::token_compress_on); for (auto tok : search_tokens) { @@ -91,10 +89,10 @@ inline bool SearchFilter(const std::string& text, const std::string& filter) } } // namespace -ScaleWork::ScaleWork(SlicesHandler* hand3D, QDir picpath, QWidget* parent, - const char* name, Qt::WindowFlags wFlags) - // : QWidget( parent, name, wFlags ),handler3D(hand3D) - : QDialog(parent, name, TRUE, wFlags), handler3D(hand3D) +ScaleWork::ScaleWork(SlicesHandler *hand3D, QDir picpath, QWidget *parent, + const char *name, Qt::WindowFlags wFlags) + // : QWidget( parent, name, wFlags ),handler3D(hand3D) + : QDialog(parent, name, TRUE, wFlags), handler3D(hand3D) { activeslice = handler3D->get_activeslice(); bmphand = handler3D->get_activebmphandler(); @@ -123,8 +121,8 @@ ScaleWork::ScaleWork(SlicesHandler* hand3D, QDir picpath, QWidget* parent, lb_brightness = new QLabel(QString("B: "), hbox3); lb_brightness->show(); lb_brightness->setPixmap( - QIcon(picpath.absFilePath(QString("icon-brightness.png")).ascii()) - .pixmap()); + QIcon(picpath.absFilePath(QString("icon-brightness.png")).ascii()) + .pixmap()); sl_brighness = new QSlider(Qt::Horizontal, hbox3); sl_brighness->setRange(0, 100); sl_brighness->setValue(30); @@ -133,8 +131,8 @@ ScaleWork::ScaleWork(SlicesHandler* hand3D, QDir picpath, QWidget* parent, lb_contrast = new QLabel(QString("C: "), hbox4); lb_contrast->show(); lb_contrast->setPixmap( - QIcon(picpath.absFilePath(QString("icon-contrast.png")).ascii()) - .pixmap()); + QIcon(picpath.absFilePath(QString("icon-contrast.png")).ascii()) + .pixmap()); sl_contrast = new QSlider(Qt::Horizontal, hbox4); sl_contrast->setRange(0, 99); sl_contrast->setValue(30); @@ -147,21 +145,21 @@ ScaleWork::ScaleWork(SlicesHandler* hand3D, QDir picpath, QWidget* parent, QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); QObject::connect(getRange, SIGNAL(clicked()), this, - SLOT(getrange_pushed())); + SLOT(getrange_pushed())); QObject::connect(doScale, SIGNAL(clicked()), this, SLOT(scale_pushed())); QObject::connect(doCrop, SIGNAL(clicked()), this, SLOT(crop_pushed())); QObject::connect(sl_brighness, SIGNAL(sliderMoved(int)), this, - SLOT(slider_changed(int))); + SLOT(slider_changed(int))); QObject::connect(sl_brighness, SIGNAL(sliderPressed()), this, - SLOT(slider_pressed())); + SLOT(slider_pressed())); QObject::connect(sl_brighness, SIGNAL(sliderReleased()), this, - SLOT(slider_released())); + SLOT(slider_released())); QObject::connect(sl_contrast, SIGNAL(sliderMoved(int)), this, - SLOT(slider_changed(int))); + SLOT(slider_changed(int))); QObject::connect(sl_contrast, SIGNAL(sliderPressed()), this, - SLOT(slider_pressed())); + SLOT(slider_pressed())); QObject::connect(sl_contrast, SIGNAL(sliderReleased()), this, - SLOT(slider_released())); + SLOT(slider_released())); getrange_pushed(); @@ -189,9 +187,9 @@ void ScaleWork::getrange_pushed() limitHigh->setText(QString::number((double)p.high, 'f', 6)); QObject::disconnect(sl_brighness, SIGNAL(sliderMoved(int)), this, - SLOT(slider_changed(int))); + SLOT(slider_changed(int))); QObject::disconnect(sl_contrast, SIGNAL(sliderMoved(int)), this, - SLOT(slider_changed(int))); + SLOT(slider_changed(int))); int brightnessint = (int)(100 * (maxval - 127.5f) / (maxval - minval)); if (brightnessint < 0) { @@ -213,9 +211,9 @@ void ScaleWork::getrange_pushed() } sl_contrast->setValue(contrastint); QObject::connect(sl_brighness, SIGNAL(sliderMoved(int)), this, - SLOT(slider_changed(int))); + SLOT(slider_changed(int))); QObject::connect(sl_contrast, SIGNAL(sliderMoved(int)), this, - SLOT(slider_changed(int))); + SLOT(slider_changed(int))); if (allslices->isChecked()) { @@ -286,7 +284,7 @@ void ScaleWork::slicenr_changed() // } } -void ScaleWork::bmphand_changed(bmphandler* bmph) +void ScaleWork::bmphand_changed(bmphandler *bmph) { bmphand = bmph; return; @@ -302,10 +300,10 @@ void ScaleWork::slider_changed(int newval) bmphand->get_range(&p1); float subpos1, subpos2; subpos1 = ((1.0f - 0.01f * sl_brighness->value()) * (maxval - minval) - - (minval1 - minval)) / - (maxval1 - minval1); + (minval1 - minval)) / + (maxval1 - minval1); subpos2 = (1.0f - 0.01f * sl_contrast->value()) * (maxval - minval) * - 0.5f / (maxval1 - minval1); + 0.5f / (maxval1 - minval1); p.low = p1.low + (p1.high - p1.low) * (subpos1 - subpos2); p.high = p1.low + (p1.high - p1.low) * (subpos1 + subpos2); @@ -353,9 +351,9 @@ void ScaleWork::slider_released() emit end_datachange(this); } -HistoWin::HistoWin(unsigned int* histo1, QWidget* parent, const char* name, - Qt::WindowFlags wFlags) - : QWidget(parent, name, wFlags) +HistoWin::HistoWin(unsigned int *histo1, QWidget *parent, const char *name, + Qt::WindowFlags wFlags) + : QWidget(parent, name, wFlags) { histo = histo1; image.create(258, 258, 8); @@ -394,14 +392,14 @@ void HistoWin::update() return; } -void HistoWin::histo_changed(unsigned int* histo1) +void HistoWin::histo_changed(unsigned int *histo1) { histo = histo1; return; } -void HistoWin::paintEvent(QPaintEvent* e) +void HistoWin::paintEvent(QPaintEvent *e) { if (image.size() != QSize(0, 0)) // is an image loaded? { @@ -411,9 +409,9 @@ void HistoWin::paintEvent(QPaintEvent* e) } } -ShowHisto::ShowHisto(SlicesHandler* hand3D, QWidget* parent, const char* name, - Qt::WindowFlags wFlags) - : QDialog(parent, name, TRUE, wFlags), handler3D(hand3D) +ShowHisto::ShowHisto(SlicesHandler *hand3D, QWidget *parent, const char *name, + Qt::WindowFlags wFlags) + : QDialog(parent, name, TRUE, wFlags), handler3D(hand3D) { activeslice = handler3D->get_activeslice(); bmphand = handler3D->get_activebmphandler(); @@ -471,9 +469,9 @@ ShowHisto::ShowHisto(SlicesHandler* hand3D, QWidget* parent, const char* name, vbox1->show(); QObject::connect(updateSubsect, SIGNAL(clicked()), this, - SLOT(subsect_update())); + SLOT(subsect_update())); QObject::connect(workpict, SIGNAL(toggled(bool)), this, - SLOT(pict_toggled(bool))); + SLOT(pict_toggled(bool))); QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); QObject::connect(subsect, SIGNAL(clicked()), this, SLOT(subsect_toggled())); @@ -528,12 +526,12 @@ void ShowHisto::draw_histo() p.px = xoffset->value(); p.py = yoffset->value(); bmphand->make_histogram( - p, - min((int)bmphand->return_width() - xoffset->value(), - xlength->value()), - min((int)bmphand->return_height() - yoffset->value(), - ylength->value()), - true); + p, + min((int)bmphand->return_width() - xoffset->value(), + xlength->value()), + min((int)bmphand->return_height() - yoffset->value(), + ylength->value()), + true); } else { @@ -549,12 +547,12 @@ void ShowHisto::draw_histo() p.px = xoffset->value(); p.py = yoffset->value(); bmphand->make_histogram( - p, - min((int)bmphand->return_width() - xoffset->value(), - xlength->value()), - min((int)bmphand->return_height() - yoffset->value(), - ylength->value()), - true); + p, + min((int)bmphand->return_width() - xoffset->value(), + xlength->value()), + min((int)bmphand->return_height() - yoffset->value(), + ylength->value()), + true); } else { @@ -574,7 +572,7 @@ void ShowHisto::slicenr_changed() // } } -void ShowHisto::bmphand_changed(bmphandler* bmph) +void ShowHisto::bmphand_changed(bmphandler *bmph) { bmphand = bmph; histwindow->histo_changed(bmphand->return_histogram()); @@ -588,9 +586,9 @@ void ShowHisto::newloaded() bmphand_changed(handler3D->get_activebmphandler()); } -colorshower::colorshower(int lx1, int ly1, QWidget* parent, const char* name, - Qt::WindowFlags wFlags) - : QWidget(parent, name, wFlags) +colorshower::colorshower(int lx1, int ly1, QWidget *parent, const char *name, + Qt::WindowFlags wFlags) + : QWidget(parent, name, wFlags) { lx = lx1; ly = ly1; @@ -614,26 +612,26 @@ void colorshower::color_changed(float fr1, float fg1, float fb1, float opac1) repaint(); } -void colorshower::paintEvent(QPaintEvent* e) +void colorshower::paintEvent(QPaintEvent *e) { QColor color; color.setRgb((int)(opac * fr * 255), (int)(opac * fg * 255), - (int)(opac * fb * 255)); + (int)(opac * fb * 255)); QPainter painter(this); painter.setClipRect(e->rect()); painter.fillRect(0, 0, lx, ly, color); color.setRgb((int)((1 - opac + opac * fr) * 255), - (int)((1 - opac + opac * fg) * 255), - (int)((1 - opac + opac * fb) * 255)); + (int)((1 - opac + opac * fg) * 255), + (int)((1 - opac + opac * fb) * 255)); painter.setClipRect(e->rect()); painter.fillRect(lx / 4, ly / 4, lx / 2, ly / 2, color); return; } -TissueTreeWidget::TissueTreeWidget(TissueHiearchy* hierarchy, QDir picpath, - QWidget* parent) - : QTreeWidget(parent), hierarchies(hierarchy) +TissueTreeWidget::TissueTreeWidget(TissueHiearchy *hierarchy, QDir picpath, + QWidget *parent) + : QTreeWidget(parent), hierarchies(hierarchy) { picturePath = picpath; sortByNameAscending = true; @@ -651,10 +649,10 @@ TissueTreeWidget::TissueTreeWidget(TissueHiearchy* hierarchy, QDir picpath, setRootIsDecorated(true); //xxxb setFixedHeight(250); //xxxb setFixedWidth(110); - QObject::connect(this, SIGNAL(itemExpanded(QTreeWidgetItem*)), this, - SLOT(resize_columns_to_contents(QTreeWidgetItem*))); - QObject::connect(this, SIGNAL(itemCollapsed(QTreeWidgetItem*)), this, - SLOT(resize_columns_to_contents(QTreeWidgetItem*))); + QObject::connect(this, SIGNAL(itemExpanded(QTreeWidgetItem *)), this, + SLOT(resize_columns_to_contents(QTreeWidgetItem *))); + QObject::connect(this, SIGNAL(itemCollapsed(QTreeWidgetItem *)), this, + SLOT(resize_columns_to_contents(QTreeWidgetItem *))); initialize(); } @@ -668,7 +666,7 @@ void TissueTreeWidget::initialize() emit hierarchy_list_changed(); } -void TissueTreeWidget::set_tissue_filter(const QString& filter) +void TissueTreeWidget::set_tissue_filter(const QString &filter) { if (filter.toStdString() != tissue_filter) { @@ -687,11 +685,11 @@ void TissueTreeWidget::update_visibility() } } -void TissueTreeWidget::update_visibility_recursive(QTreeWidgetItem* current) +void TissueTreeWidget::update_visibility_recursive(QTreeWidgetItem *current) { // setHidden hides/shows recursively bool const matches = - SearchFilter(get_name(current).toStdString(), tissue_filter); + SearchFilter(get_name(current).toStdString(), tissue_filter); bool const is_folder = get_is_folder(current); if (matches || !is_folder) { @@ -709,7 +707,7 @@ void TissueTreeWidget::update_visibility_recursive(QTreeWidgetItem* current) bool any_child_visible = false; for (unsigned int i = 0; i < current->childCount(); ++i) { - QTreeWidgetItem* child = current->child(i); + QTreeWidgetItem *child = current->child(i); update_visibility_recursive(child); if (!child->isHidden()) @@ -731,17 +729,17 @@ void TissueTreeWidget::update_hierarchy() hierarchies->set_selected_hierarchy(create_current_hierarchy()); } -TissueHierarchyItem* TissueTreeWidget::create_current_hierarchy() +TissueHierarchyItem *TissueTreeWidget::create_current_hierarchy() { // Create internal representation from current QTreeWidget - TissueHierarchyItem* root = new TissueHierarchyItem(true, QString("root")); + TissueHierarchyItem *root = new TissueHierarchyItem(true, QString("root")); for (unsigned int i = 0; i < topLevelItemCount(); ++i) { // Add top-level child - QTreeWidgetItem* currWidgetItem = topLevelItem(i); - TissueHierarchyItem* newTreeItem = - create_hierarchy_item(currWidgetItem); + QTreeWidgetItem *currWidgetItem = topLevelItem(i); + TissueHierarchyItem *newTreeItem = + create_hierarchy_item(currWidgetItem); root->AddChild(newTreeItem); // Subtree of current child @@ -755,14 +753,14 @@ TissueHierarchyItem* TissueTreeWidget::create_current_hierarchy() } void TissueTreeWidget::create_hierarchy_recursively( - QTreeWidgetItem* parentIn, TissueHierarchyItem* parentOut) + QTreeWidgetItem *parentIn, TissueHierarchyItem *parentOut) { for (unsigned int i = 0; i < parentIn->childCount(); ++i) { // Add child - QTreeWidgetItem* currWidgetItem = parentIn->child(i); - TissueHierarchyItem* newTreeItem = - create_hierarchy_item(currWidgetItem); + QTreeWidgetItem *currWidgetItem = parentIn->child(i); + TissueHierarchyItem *newTreeItem = + create_hierarchy_item(currWidgetItem); parentOut->AddChild(newTreeItem); // Subtree of current child @@ -773,11 +771,11 @@ void TissueTreeWidget::create_hierarchy_recursively( } } -TissueHierarchyItem* - TissueTreeWidget::create_hierarchy_item(QTreeWidgetItem* item) +TissueHierarchyItem * + TissueTreeWidget::create_hierarchy_item(QTreeWidgetItem *item) { return new TissueHierarchyItem(get_is_folder(item), - item->text(TISSUETREEWIDGET_COLUMN_NAME)); + item->text(TISSUETREEWIDGET_COLUMN_NAME)); } namespace { @@ -791,7 +789,7 @@ QPixmap generatePixmap(tissues_size_t tissuenr) return abc; } unsigned char r, g, b; - TissueInfoStruct* tissueInfo = TissueInfos::GetTissueInfo(tissuenr); + TissueInfoStruct *tissueInfo = TissueInfos::GetTissueInfo(tissuenr); tissueInfo->GetColorRGB(r, g, b); abc.fill(QColor(r, g, b)); if (tissueInfo->locked) @@ -819,43 +817,43 @@ QPixmap generatePixmap(tissues_size_t tissuenr) } // namespace -QTreeWidgetItem* TissueTreeWidget::create_hierarchy_item(bool isFolder, - const QString& name) +QTreeWidgetItem *TissueTreeWidget::create_hierarchy_item(bool isFolder, + const QString &name) { if (isFolder) { - QTreeWidgetItem* newFolder = new QTreeWidgetItem(); + QTreeWidgetItem *newFolder = new QTreeWidgetItem(); newFolder->setIcon( - TISSUETREEWIDGET_COLUMN_NAME, - QIcon(picturePath.absFilePath(QString("fileopen.png")).ascii())); + TISSUETREEWIDGET_COLUMN_NAME, + QIcon(picturePath.absFilePath(QString("fileopen.png")).ascii())); newFolder->setText(TISSUETREEWIDGET_COLUMN_NAME, name); newFolder->setText(TISSUETREEWIDGET_COLUMN_FOLDER, - QString::number(isFolder)); + QString::number(isFolder)); newFolder->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator); newFolder->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | - Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled); + Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled); return newFolder; } else { tissues_size_t type = TissueInfos::GetTissueType(name); - QTreeWidgetItem* newTissue = new QTreeWidgetItem(); + QTreeWidgetItem *newTissue = new QTreeWidgetItem(); newTissue->setIcon(TISSUETREEWIDGET_COLUMN_NAME, generatePixmap(type)); newTissue->setText(TISSUETREEWIDGET_COLUMN_NAME, name); newTissue->setText(TISSUETREEWIDGET_COLUMN_TYPE, QString::number(type)); newTissue->setText(TISSUETREEWIDGET_COLUMN_FOLDER, - QString::number(isFolder)); + QString::number(isFolder)); newTissue->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicator); newTissue->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | - Qt::ItemIsDragEnabled); + Qt::ItemIsDragEnabled); return newTissue; } } -void TissueTreeWidget::insert_item(bool isFolder, const QString& name) +void TissueTreeWidget::insert_item(bool isFolder, const QString &name) { - QTreeWidgetItem* currItem = currentItem(); - QTreeWidgetItem* newItem = create_hierarchy_item(isFolder, name); + QTreeWidgetItem *currItem = currentItem(); + QTreeWidgetItem *newItem = create_hierarchy_item(isFolder, name); if (get_is_folder(currItem) && currItem->isExpanded()) { @@ -865,7 +863,7 @@ void TissueTreeWidget::insert_item(bool isFolder, const QString& name) else { // Insert at current position - QTreeWidgetItem* currParent = currItem->parent(); + QTreeWidgetItem *currParent = currItem->parent(); if (currParent == 0) { insertTopLevelItem(indexOfTopLevelItem(currItem), newItem); @@ -873,7 +871,7 @@ void TissueTreeWidget::insert_item(bool isFolder, const QString& name) else { currParent->insertChild(currParent->indexOfChild(currItem), - newItem); + newItem); } } setCurrentItem(newItem); @@ -882,17 +880,17 @@ void TissueTreeWidget::insert_item(bool isFolder, const QString& name) update_hierarchy(); } -void TissueTreeWidget::insert_item(bool isFolder, const QString& name, - QTreeWidgetItem* insertAbove) +void TissueTreeWidget::insert_item(bool isFolder, const QString &name, + QTreeWidgetItem *insertAbove) { if (insertAbove == 0) { return; } - QTreeWidgetItem* newItem = create_hierarchy_item(isFolder, name); + QTreeWidgetItem *newItem = create_hierarchy_item(isFolder, name); - QTreeWidgetItem* parent = insertAbove->parent(); + QTreeWidgetItem *parent = insertAbove->parent(); if (parent == 0) { insertTopLevelItem(indexOfTopLevelItem(insertAbove), newItem); @@ -908,10 +906,10 @@ void TissueTreeWidget::insert_item(bool isFolder, const QString& name, update_hierarchy(); } -void TissueTreeWidget::insert_item(bool isFolder, const QString& name, - QTreeWidgetItem* parent, unsigned int index) +void TissueTreeWidget::insert_item(bool isFolder, const QString &name, + QTreeWidgetItem *parent, unsigned int index) { - QTreeWidgetItem* newItem = create_hierarchy_item(isFolder, name); + QTreeWidgetItem *newItem = create_hierarchy_item(isFolder, name); if (parent == 0) { @@ -928,13 +926,13 @@ void TissueTreeWidget::insert_item(bool isFolder, const QString& name, update_hierarchy(); } -void TissueTreeWidget::remove_tissue(const QString& name) +void TissueTreeWidget::remove_tissue(const QString &name) { // Removes a tissue completely from all hierarchies blockSignals(true); for (int i = 0; i < topLevelItemCount(); ++i) { - QTreeWidgetItem* currItem = topLevelItem(i); + QTreeWidgetItem *currItem = topLevelItem(i); if (get_is_folder(currItem)) { remove_tissue_recursively(currItem, name); @@ -950,9 +948,9 @@ void TissueTreeWidget::remove_tissue(const QString& name) { // Update tissue type tissues_size_t newType = TissueInfos::GetTissueType( - currItem->text(TISSUETREEWIDGET_COLUMN_NAME)); + currItem->text(TISSUETREEWIDGET_COLUMN_NAME)); currItem->setText(TISSUETREEWIDGET_COLUMN_TYPE, - QString::number(newType)); + QString::number(newType)); } } blockSignals(false); @@ -964,12 +962,12 @@ void TissueTreeWidget::remove_tissue(const QString& name) hierarchies->update_hierarchies(); } -void TissueTreeWidget::remove_tissue_recursively(QTreeWidgetItem* parent, - const QString& name) +void TissueTreeWidget::remove_tissue_recursively(QTreeWidgetItem *parent, + const QString &name) { for (int i = 0; i < parent->childCount(); ++i) { - QTreeWidgetItem* currItem = parent->child(i); + QTreeWidgetItem *currItem = parent->child(i); if (get_is_folder(currItem)) { remove_tissue_recursively(currItem, name); @@ -985,9 +983,9 @@ void TissueTreeWidget::remove_tissue_recursively(QTreeWidgetItem* parent, { // Update tissue type tissues_size_t newType = TissueInfos::GetTissueType( - currItem->text(TISSUETREEWIDGET_COLUMN_NAME)); + currItem->text(TISSUETREEWIDGET_COLUMN_NAME)); currItem->setText(TISSUETREEWIDGET_COLUMN_TYPE, - QString::number(newType)); + QString::number(newType)); } } } @@ -996,8 +994,8 @@ void TissueTreeWidget::remove_current_item(bool removeChildren) { // Removes current item in QTreeWidget and internal representations - QTreeWidgetItem* currItem = currentItem(); - QTreeWidgetItem* currParent = currItem->parent(); + QTreeWidgetItem *currItem = currentItem(); + QTreeWidgetItem *currParent = currItem->parent(); bool updateTissues = false; if (get_is_folder(currItem)) @@ -1006,7 +1004,7 @@ void TissueTreeWidget::remove_current_item(bool removeChildren) if (removeChildren) { // Delete all children of current item - QList children; + QList children; take_children_recursively(currItem, children); qDeleteAll(children); @@ -1030,14 +1028,14 @@ void TissueTreeWidget::remove_current_item(bool removeChildren) if (currParent == 0) { insertTopLevelItems(indexOfTopLevelItem(currItem), - currItem->takeChildren()); + currItem->takeChildren()); takeTopLevelItem(indexOfTopLevelItem(currItem)); delete currItem; } else { currParent->insertChildren(currParent->indexOfChild(currItem), - currItem->takeChildren()); + currItem->takeChildren()); currParent->removeChild(currItem); delete currItem; } @@ -1083,11 +1081,11 @@ void TissueTreeWidget::remove_all_folders(bool removeChildren) { for (int i = 0; i < topLevelItemCount(); ++i) { - QTreeWidgetItem* item = topLevelItem(i); + QTreeWidgetItem *item = topLevelItem(i); if (get_is_folder(item)) { // Delete all children of item - QList children; + QList children; take_children_recursively(item, children); qDeleteAll(children); @@ -1103,7 +1101,7 @@ void TissueTreeWidget::remove_all_folders(bool removeChildren) { for (int i = 0; i < topLevelItemCount(); ++i) { - QTreeWidgetItem* item = topLevelItem(i); + QTreeWidgetItem *item = topLevelItem(i); if (get_is_folder(item)) { // Insert children into parent and delete item @@ -1126,8 +1124,8 @@ void TissueTreeWidget::remove_all_folders(bool removeChildren) } } -void TissueTreeWidget::update_tissue_name(const QString& oldName, - const QString& newName) +void TissueTreeWidget::update_tissue_name(const QString &oldName, + const QString &newName) { if (oldName.compare(newName) == 0) { @@ -1135,7 +1133,7 @@ void TissueTreeWidget::update_tissue_name(const QString& oldName, } // Update tissue name in internal representations - auto& hierarchyTrees = hierarchies->hierarchies(); + auto &hierarchyTrees = hierarchies->hierarchies(); for (unsigned int i = 0; i < hierarchyTrees.size(); ++i) { hierarchyTrees[i]->UpdateTissueNameRecursively(oldName, newName); @@ -1145,9 +1143,9 @@ void TissueTreeWidget::update_tissue_name(const QString& oldName, update_tissue_name_widget(oldName, newName); } -void TissueTreeWidget::update_tissue_name_widget(const QString& oldName, - const QString& newName, - QTreeWidgetItem* parent) +void TissueTreeWidget::update_tissue_name_widget(const QString &oldName, + const QString &newName, + QTreeWidgetItem *parent) { if (parent == 0) { @@ -1171,7 +1169,7 @@ void TissueTreeWidget::update_tissue_name_widget(const QString& oldName, { // Update tissue name if (parent->text(TISSUETREEWIDGET_COLUMN_NAME).compare(oldName) == - 0) + 0) { parent->setText(TISSUETREEWIDGET_COLUMN_NAME, newName); } @@ -1179,7 +1177,7 @@ void TissueTreeWidget::update_tissue_name_widget(const QString& oldName, } } -void TissueTreeWidget::update_tissue_icons(QTreeWidgetItem* parent) +void TissueTreeWidget::update_tissue_icons(QTreeWidgetItem *parent) { if (parent == 0) { @@ -1203,12 +1201,12 @@ void TissueTreeWidget::update_tissue_icons(QTreeWidgetItem* parent) { // Update tissue icon parent->setIcon(TISSUETREEWIDGET_COLUMN_NAME, - generatePixmap(get_type(parent))); + generatePixmap(get_type(parent))); } } } -void TissueTreeWidget::update_folder_icons(QTreeWidgetItem* parent) +void TissueTreeWidget::update_folder_icons(QTreeWidgetItem *parent) { // Updates the folder icons based on the lock state of the child tissues // This only works if the tree widget is completely built @@ -1231,25 +1229,25 @@ void TissueTreeWidget::update_folder_icons(QTreeWidgetItem* parent) { // All child tissues unlocked parent->setIcon( - TISSUETREEWIDGET_COLUMN_NAME, - QIcon(picturePath.absFilePath(QString("fileopen.png")) - .ascii())); + TISSUETREEWIDGET_COLUMN_NAME, + QIcon(picturePath.absFilePath(QString("fileopen.png")) + .ascii())); } else if (lockStates == 1) { // All child tissues locked parent->setIcon( - TISSUETREEWIDGET_COLUMN_NAME, - QIcon(picturePath.absFilePath(QString("folderlock1.png")) - .ascii())); + TISSUETREEWIDGET_COLUMN_NAME, + QIcon(picturePath.absFilePath(QString("folderlock1.png")) + .ascii())); } else { // Mixed locked/unlocked parent->setIcon( - TISSUETREEWIDGET_COLUMN_NAME, - QIcon(picturePath.absFilePath(QString("folderlock2.png")) - .ascii())); + TISSUETREEWIDGET_COLUMN_NAME, + QIcon(picturePath.absFilePath(QString("folderlock2.png")) + .ascii())); } // Recursion with children @@ -1262,7 +1260,7 @@ void TissueTreeWidget::update_folder_icons(QTreeWidgetItem* parent) } // TODO: Optimize by introducing folder map / hidden flag -short TissueTreeWidget::get_child_lockstates(QTreeWidgetItem* folder) +short TissueTreeWidget::get_child_lockstates(QTreeWidgetItem *folder) { // Returns whether all child tissues (including subfolders) are // unlocked (return value 0), @@ -1274,7 +1272,7 @@ short TissueTreeWidget::get_child_lockstates(QTreeWidgetItem* folder) short lockStates = 0; // Empty folders are considered to be unlocked for (i = 0; i < folder->childCount(); ++i) { - QTreeWidgetItem* currChild = folder->child(i); + QTreeWidgetItem *currChild = folder->child(i); if (get_is_folder(currChild)) { if (currChild->childCount() > 0) @@ -1305,18 +1303,18 @@ short TissueTreeWidget::get_child_lockstates(QTreeWidgetItem* folder) // Test against lock states of other children for (int i = 1; i < folder->childCount(); ++i) { - QTreeWidgetItem* currChild = folder->child(i); + QTreeWidgetItem *currChild = folder->child(i); if (get_is_folder(currChild)) { // Skip empty folders if (currChild->childCount() > 0 && - (lockStates != get_child_lockstates(currChild))) + (lockStates != get_child_lockstates(currChild))) { return -1; } } else if ((bool)lockStates != - TissueInfos::GetTissueLocked(get_type(currChild))) + TissueInfos::GetTissueLocked(get_type(currChild))) { return -1; } @@ -1337,7 +1335,7 @@ void TissueTreeWidget::pad_tissue_indices() for (unsigned int i = 0; i < topLevelItemCount(); ++i) { - QTreeWidgetItem* item = topLevelItem(i); + QTreeWidgetItem *item = topLevelItem(i); if (get_is_folder(item)) { pad_tissue_indices_recursively(item, digits); @@ -1355,12 +1353,12 @@ void TissueTreeWidget::pad_tissue_indices() } } -void TissueTreeWidget::pad_tissue_indices_recursively(QTreeWidgetItem* parent, - unsigned short digits) +void TissueTreeWidget::pad_tissue_indices_recursively(QTreeWidgetItem *parent, + unsigned short digits) { for (unsigned int i = 0; i < parent->childCount(); ++i) { - QTreeWidgetItem* item = parent->child(i); + QTreeWidgetItem *item = parent->child(i); if (get_is_folder(item)) { pad_tissue_indices_recursively(item, digits); @@ -1382,7 +1380,7 @@ void TissueTreeWidget::update_tissue_indices() { for (unsigned int i = 0; i < topLevelItemCount(); ++i) { - QTreeWidgetItem* item = topLevelItem(i); + QTreeWidgetItem *item = topLevelItem(i); if (get_is_folder(item)) { update_tissue_indices_recursively(item); @@ -1390,18 +1388,18 @@ void TissueTreeWidget::update_tissue_indices() else { tissues_size_t type = TissueInfos::GetTissueType( - item->text(TISSUETREEWIDGET_COLUMN_NAME)); + item->text(TISSUETREEWIDGET_COLUMN_NAME)); item->setText(TISSUETREEWIDGET_COLUMN_TYPE, QString::number(type)); } } } void TissueTreeWidget::update_tissue_indices_recursively( - QTreeWidgetItem* parent) + QTreeWidgetItem *parent) { for (unsigned int i = 0; i < parent->childCount(); ++i) { - QTreeWidgetItem* item = parent->child(i); + QTreeWidgetItem *item = parent->child(i); if (get_is_folder(item)) { update_tissue_indices_recursively(item); @@ -1409,13 +1407,13 @@ void TissueTreeWidget::update_tissue_indices_recursively( else { tissues_size_t type = TissueInfos::GetTissueType( - item->text(TISSUETREEWIDGET_COLUMN_NAME)); + item->text(TISSUETREEWIDGET_COLUMN_NAME)); item->setText(TISSUETREEWIDGET_COLUMN_TYPE, QString::number(type)); } } } -void TissueTreeWidget::set_current_folder_name(const QString& name) +void TissueTreeWidget::set_current_folder_name(const QString &name) { if (get_current_is_folder()) { @@ -1426,7 +1424,7 @@ void TissueTreeWidget::set_current_folder_name(const QString& name) } } -void TissueTreeWidget::set_current_item(QTreeWidgetItem* item) +void TissueTreeWidget::set_current_item(QTreeWidgetItem *item) { if (item) { @@ -1442,9 +1440,9 @@ void TissueTreeWidget::set_current_tissue(tissues_size_t type) { if (type > 0 && type <= TissueInfos::GetTissueCount()) { - QTreeWidgetItem* item = find_tissue_item(type); + QTreeWidgetItem *item = find_tissue_item(type); setCurrentItem(item); - QTreeWidgetItem* parent = item->parent(); + QTreeWidgetItem *parent = item->parent(); if (parent != 0) { parent->setExpanded(true); @@ -1456,16 +1454,16 @@ void TissueTreeWidget::set_current_tissue(tissues_size_t type) } } -QTreeWidgetItem* TissueTreeWidget::find_tissue_item(tissues_size_t type, - QTreeWidgetItem* parent) +QTreeWidgetItem *TissueTreeWidget::find_tissue_item(tissues_size_t type, + QTreeWidgetItem *parent) { if (parent == 0) { // Recursion with top level children for (int i = 0; i < topLevelItemCount(); ++i) { - QTreeWidgetItem* recursiveRes = - find_tissue_item(type, topLevelItem(i)); + QTreeWidgetItem *recursiveRes = + find_tissue_item(type, topLevelItem(i)); if (recursiveRes != 0) { return recursiveRes; @@ -1482,15 +1480,15 @@ QTreeWidgetItem* TissueTreeWidget::find_tissue_item(tissues_size_t type, // Recursion with children for (int i = 0; i < parent->childCount(); ++i) { - QTreeWidgetItem* recursiveRes = - find_tissue_item(type, parent->child(i)); + QTreeWidgetItem *recursiveRes = + find_tissue_item(type, parent->child(i)); if (recursiveRes != 0) { return recursiveRes; } } } - return (QTreeWidgetItem*)0; + return (QTreeWidgetItem *)0; } tissues_size_t TissueTreeWidget::get_current_type() @@ -1505,7 +1503,7 @@ bool TissueTreeWidget::get_current_is_folder() return get_is_folder(currentItem()); } -bool TissueTreeWidget::get_is_folder(QTreeWidgetItem* item) +bool TissueTreeWidget::get_is_folder(QTreeWidgetItem *item) { if (item) { @@ -1514,17 +1512,17 @@ bool TissueTreeWidget::get_is_folder(QTreeWidgetItem* item) return true; } -tissues_size_t TissueTreeWidget::get_type(QTreeWidgetItem* item) +tissues_size_t TissueTreeWidget::get_type(QTreeWidgetItem *item) { if (item && !get_is_folder(item)) { return (tissues_size_t)item->text(TISSUETREEWIDGET_COLUMN_TYPE) - .toUInt(); + .toUInt(); } return 0; } -QString TissueTreeWidget::get_name(QTreeWidgetItem* item) +QString TissueTreeWidget::get_name(QTreeWidgetItem *item) { if (item) { @@ -1546,7 +1544,7 @@ bool TissueTreeWidget::get_current_has_children() } void TissueTreeWidget::get_current_child_tissues( - std::map& types) + std::map &types) { types.clear(); if (currentItem() != 0) @@ -1556,12 +1554,12 @@ void TissueTreeWidget::get_current_child_tissues( } void TissueTreeWidget::get_sublevel_child_tissues( - std::map& types) + std::map &types) { types.clear(); for (unsigned int i = 0; i < topLevelItemCount(); ++i) { - QTreeWidgetItem* item = topLevelItem(i); + QTreeWidgetItem *item = topLevelItem(i); if (get_is_folder(item)) { get_child_tissues_recursively(item, types); @@ -1570,13 +1568,13 @@ void TissueTreeWidget::get_sublevel_child_tissues( } void TissueTreeWidget::get_child_tissues_recursively( - QTreeWidgetItem* parent, std::map& types) + QTreeWidgetItem *parent, std::map &types) { for (int i = 0; i < parent->childCount(); ++i) { tissues_size_t currType = (tissues_size_t)parent->child(i) - ->text(TISSUETREEWIDGET_COLUMN_TYPE) - .toUInt(); + ->text(TISSUETREEWIDGET_COLUMN_TYPE) + .toUInt(); if (currType > 0) { // Insert tissue @@ -1607,7 +1605,7 @@ unsigned short TissueTreeWidget::get_hierarchy_count() return hierarchies->get_hierarchy_count(); } -std::vector* TissueTreeWidget::get_hierarchy_names_ptr() +std::vector *TissueTreeWidget::get_hierarchy_names_ptr() { return hierarchies->get_hierarchy_names_ptr(); } @@ -1650,7 +1648,7 @@ void TissueTreeWidget::set_hierarchy(unsigned short index) resize_columns_to_contents(); } -void TissueTreeWidget::build_tree_widget(TissueHierarchyItem* root) +void TissueTreeWidget::build_tree_widget(TissueHierarchyItem *root) { clear(); @@ -1661,30 +1659,30 @@ void TissueTreeWidget::build_tree_widget(TissueHierarchyItem* root) tissueTypes.insert(type); } - vector* children = root->GetChildren(); - for (vector::iterator iter = children->begin(); - iter != children->end(); ++iter) + vector *children = root->GetChildren(); + for (vector::iterator iter = children->begin(); + iter != children->end(); ++iter) { // Add top-level item - TissueHierarchyItem* currItem = *iter; + TissueHierarchyItem *currItem = *iter; if (currItem->GetIsFolder()) { - QTreeWidgetItem* newFolder = - create_hierarchy_item(true, currItem->GetName()); + QTreeWidgetItem *newFolder = + create_hierarchy_item(true, currItem->GetName()); addTopLevelItem(newFolder); build_tree_widget_recursively(currItem, newFolder, &tissueTypes); } else { tissues_size_t type = - TissueInfos::GetTissueType(currItem->GetName()); + TissueInfos::GetTissueType(currItem->GetName()); if (type > 0) { - QTreeWidgetItem* newTissue = - create_hierarchy_item(false, currItem->GetName()); + QTreeWidgetItem *newTissue = + create_hierarchy_item(false, currItem->GetName()); addTopLevelItem(newTissue); std::set::iterator iter = - tissueTypes.find(type); + tissueTypes.find(type); if (iter != tissueTypes.end()) { tissueTypes.erase(iter); @@ -1695,10 +1693,10 @@ void TissueTreeWidget::build_tree_widget(TissueHierarchyItem* root) // Add all missing tissues at top level for (std::set::iterator iter = tissueTypes.begin(); - iter != tissueTypes.end(); ++iter) + iter != tissueTypes.end(); ++iter) { addTopLevelItem( - create_hierarchy_item(false, TissueInfos::GetTissueName(*iter))); + create_hierarchy_item(false, TissueInfos::GetTissueName(*iter))); } // Update folder icons @@ -1708,33 +1706,33 @@ void TissueTreeWidget::build_tree_widget(TissueHierarchyItem* root) } void TissueTreeWidget::build_tree_widget_recursively( - TissueHierarchyItem* parentIn, QTreeWidgetItem* parentOut, - std::set* tissueTypes) + TissueHierarchyItem *parentIn, QTreeWidgetItem *parentOut, + std::set *tissueTypes) { - vector* children = parentIn->GetChildren(); - for (vector::iterator iter = children->begin(); - iter != children->end(); ++iter) + vector *children = parentIn->GetChildren(); + for (vector::iterator iter = children->begin(); + iter != children->end(); ++iter) { // Add item to parentOut - TissueHierarchyItem* currItem = *iter; + TissueHierarchyItem *currItem = *iter; if (currItem->GetIsFolder()) { - QTreeWidgetItem* newFolder = - create_hierarchy_item(true, currItem->GetName()); + QTreeWidgetItem *newFolder = + create_hierarchy_item(true, currItem->GetName()); parentOut->addChild(newFolder); build_tree_widget_recursively(currItem, newFolder, tissueTypes); } else { tissues_size_t type = - TissueInfos::GetTissueType(currItem->GetName()); + TissueInfos::GetTissueType(currItem->GetName()); if (type > 0) { - QTreeWidgetItem* newTissue = - create_hierarchy_item(false, currItem->GetName()); + QTreeWidgetItem *newTissue = + create_hierarchy_item(false, currItem->GetName()); parentOut->addChild(newTissue); std::set::iterator iter = - tissueTypes->find(type); + tissueTypes->find(type); if (iter != tissueTypes->end()) { tissueTypes->erase(iter); @@ -1744,7 +1742,7 @@ void TissueTreeWidget::build_tree_widget_recursively( } } -void TissueTreeWidget::add_new_hierarchy(const QString& name) +void TissueTreeWidget::add_new_hierarchy(const QString &name) { // Create and select default hierarchy hierarchies->add_new_hierarchy(name); @@ -1752,7 +1750,7 @@ void TissueTreeWidget::add_new_hierarchy(const QString& name) emit hierarchy_list_changed(); } -bool TissueTreeWidget::load_hierarchy(const QString& path) +bool TissueTreeWidget::load_hierarchy(const QString &path) { if (!hierarchies->load_hierarchy(path)) { @@ -1765,7 +1763,7 @@ bool TissueTreeWidget::load_hierarchy(const QString& path) } void TissueTreeWidget::take_children_recursively( - QTreeWidgetItem* parent, QList& appendTo) + QTreeWidgetItem *parent, QList &appendTo) { // Recursion with children for (int i = 0; i < parent->childCount(); ++i) @@ -1782,8 +1780,8 @@ void TissueTreeWidget::update_tree_widget() set_hierarchy(hierarchies->get_selected_hierarchy()); } -bool TissueTreeWidget::save_hierarchy_as(const QString& name, - const QString& path) +bool TissueTreeWidget::save_hierarchy_as(const QString &name, + const QString &path) { if (hierarchies->get_selected_hierarchy() == 0) { @@ -1823,7 +1821,7 @@ void TissueTreeWidget::remove_current_hierarchy() void TissueTreeWidget::toggle_show_tissue_indices() { setColumnHidden(TISSUETREEWIDGET_COLUMN_TYPE, - !isColumnHidden(TISSUETREEWIDGET_COLUMN_TYPE)); + !isColumnHidden(TISSUETREEWIDGET_COLUMN_TYPE)); resize_columns_to_contents(); } @@ -1870,9 +1868,9 @@ bool TissueTreeWidget::get_tissue_indices_hidden() return isColumnHidden(TISSUETREEWIDGET_COLUMN_TYPE); } -QList get_my_children(QTreeWidgetItem* item) +QList get_my_children(QTreeWidgetItem *item) { - QList my_children; + QList my_children; if (item->childCount() == 0) { @@ -1889,9 +1887,9 @@ QList get_my_children(QTreeWidgetItem* item) return my_children; } -QList TissueTreeWidget::get_all_items() +QList TissueTreeWidget::get_all_items() { - QList all_items; + QList all_items; all_items.append(get_my_children(invisibleRootItem())); auto nItems = all_items.size(); return all_items; @@ -1905,7 +1903,7 @@ void TissueTreeWidget::resize_columns_to_contents() } } -void TissueTreeWidget::resize_columns_to_contents(QTreeWidgetItem* item) +void TissueTreeWidget::resize_columns_to_contents(QTreeWidgetItem *item) { resize_columns_to_contents(); } @@ -1920,7 +1918,7 @@ unsigned short TissueTreeWidget::get_tissue_instance_count(tissues_size_t type) unsigned short res = 0; for (unsigned int i = 0; i < topLevelItemCount(); ++i) { - QTreeWidgetItem* item = topLevelItem(i); + QTreeWidgetItem *item = topLevelItem(i); if (get_is_folder(item)) { res += get_tissue_instance_count_recursively(item, type); @@ -1934,12 +1932,12 @@ unsigned short TissueTreeWidget::get_tissue_instance_count(tissues_size_t type) } unsigned short TissueTreeWidget::get_tissue_instance_count_recursively( - QTreeWidgetItem* parent, tissues_size_t type) + QTreeWidgetItem *parent, tissues_size_t type) { unsigned short res = 0; for (unsigned int i = 0; i < parent->childCount(); ++i) { - QTreeWidgetItem* item = parent->child(i); + QTreeWidgetItem *item = parent->child(i); if (get_is_folder(item)) { res += get_tissue_instance_count_recursively(item, type); @@ -1952,12 +1950,12 @@ unsigned short TissueTreeWidget::get_tissue_instance_count_recursively( return res; } -FILE* TissueTreeWidget::SaveParams(FILE* fp, int version) +FILE *TissueTreeWidget::SaveParams(FILE *fp, int version) { return hierarchies->SaveParams(fp, version); } -FILE* TissueTreeWidget::LoadParams(FILE* fp, int version) +FILE *TissueTreeWidget::LoadParams(FILE *fp, int version) { fp = hierarchies->LoadParams(fp, version); @@ -1969,12 +1967,12 @@ FILE* TissueTreeWidget::LoadParams(FILE* fp, int version) return fp; } -FILE* TissueTreeWidget::save_hierarchy(FILE* fp, unsigned short idx) +FILE *TissueTreeWidget::save_hierarchy(FILE *fp, unsigned short idx) { return hierarchies->save_hierarchy(fp, idx); } -FILE* TissueTreeWidget::load_hierarchy(FILE* fp) +FILE *TissueTreeWidget::load_hierarchy(FILE *fp) { fp = hierarchies->load_hierarchy(fp); @@ -1989,7 +1987,7 @@ FILE* TissueTreeWidget::load_hierarchy(FILE* fp) return fp; } -void TissueTreeWidget::dropEvent(QDropEvent* de) +void TissueTreeWidget::dropEvent(QDropEvent *de) { // Only accept internal move actions if (!(de->source() == this && (de->possibleActions() & Qt::MoveAction))) @@ -1998,11 +1996,11 @@ void TissueTreeWidget::dropEvent(QDropEvent* de) } if (!get_current_is_folder() && - (de->keyboardModifiers() & Qt::ShiftModifier)) + (de->keyboardModifiers() & Qt::ShiftModifier)) { // Move the item and insert a duplicate at the original position - QTreeWidgetItem* currItem = currentItem(); - QTreeWidgetItem* currParent = currItem->parent(); + QTreeWidgetItem *currItem = currentItem(); + QTreeWidgetItem *currParent = currItem->parent(); // Get original index unsigned int oldIdx = 0; @@ -2050,10 +2048,10 @@ void TissueTreeWidget::dropEvent(QDropEvent* de) update_folder_icons(); } -TissueAdder::TissueAdder(bool modifyTissue, TissueTreeWidget* tissueTree, - QWidget* parent, const char* name, - Qt::WindowFlags wFlags) - : QDialog(parent, name, TRUE, wFlags), tissueTreeWidget(tissueTree) +TissueAdder::TissueAdder(bool modifyTissue, TissueTreeWidget *tissueTree, + QWidget *parent, const char *name, + Qt::WindowFlags wFlags) + : QDialog(parent, name, TRUE, wFlags), tissueTreeWidget(tissueTree) { modify = modifyTissue; @@ -2128,8 +2126,8 @@ TissueAdder::TissueAdder(bool modifyTissue, TissueTreeWidget* tissueTree, { addTissue->setText("Modify Tissue"); - TissueInfoStruct* tissueInfo = - TissueInfos::GetTissueInfo(tissueTreeWidget->get_current_type()); + TissueInfoStruct *tissueInfo = + TissueInfos::GetTissueInfo(tissueTreeWidget->get_current_type()); nameField->setText(tissueInfo->name); r->setValue(int(tissueInfo->color[0] * 255)); g->setValue(int(tissueInfo->color[1] * 255)); @@ -2146,27 +2144,27 @@ TissueAdder::TissueAdder(bool modifyTissue, TissueTreeWidget* tissueTree, transp1 = float(sl_transp->value()) / 100; QObject::connect(r, SIGNAL(valueChanged(int)), this, - SLOT(update_color_r(int))); + SLOT(update_color_r(int))); QObject::connect(g, SIGNAL(valueChanged(int)), this, - SLOT(update_color_g(int))); + SLOT(update_color_g(int))); QObject::connect(b, SIGNAL(valueChanged(int)), this, - SLOT(update_color_b(int))); + SLOT(update_color_b(int))); QObject::connect(sl_transp, SIGNAL(valueChanged(int)), this, - SLOT(update_opac(int))); + SLOT(update_opac(int))); QObject::connect(sb_r, SIGNAL(valueChanged(int)), this, - SLOT(update_color_rsb(int))); + SLOT(update_color_rsb(int))); QObject::connect(sb_g, SIGNAL(valueChanged(int)), this, - SLOT(update_color_gsb(int))); + SLOT(update_color_gsb(int))); QObject::connect(sb_b, SIGNAL(valueChanged(int)), this, - SLOT(update_color_bsb(int))); + SLOT(update_color_bsb(int))); QObject::connect(sb_transp, SIGNAL(valueChanged(int)), this, - SLOT(update_opacsb(int))); + SLOT(update_opacsb(int))); QObject::connect(addTissue, SIGNAL(clicked()), this, - SLOT(add_pressed())); + SLOT(add_pressed())); QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); QObject::connect(this, - SIGNAL(color_changed(float, float, float, float)), cs, - SLOT(color_changed(float, float, float, float))); + SIGNAL(color_changed(float, float, float, float)), cs, + SLOT(color_changed(float, float, float, float))); emit color_changed(fr1, fg1, fb1, 1.0 - transp1); } @@ -2189,19 +2187,19 @@ TissueAdder::TissueAdder(bool modifyTissue, TissueTreeWidget* tissueTree, transp1 = float(sl_transp->value()) / 100; QObject::connect(r, SIGNAL(valueChanged(int)), this, - SLOT(update_color_r(int))); + SLOT(update_color_r(int))); QObject::connect(g, SIGNAL(valueChanged(int)), this, - SLOT(update_color_g(int))); + SLOT(update_color_g(int))); QObject::connect(b, SIGNAL(valueChanged(int)), this, - SLOT(update_color_b(int))); + SLOT(update_color_b(int))); QObject::connect(sl_transp, SIGNAL(valueChanged(int)), this, - SLOT(update_opac(int))); + SLOT(update_opac(int))); QObject::connect(addTissue, SIGNAL(clicked()), this, - SLOT(add_pressed())); + SLOT(add_pressed())); QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); QObject::connect(this, - SIGNAL(color_changed(float, float, float, float)), cs, - SLOT(color_changed(float, float, float, float))); + SIGNAL(color_changed(float, float, float, float)), cs, + SLOT(color_changed(float, float, float, float))); } return; @@ -2232,10 +2230,10 @@ TissueAdder::~TissueAdder() void TissueAdder::update_color_r(int v) { QObject::disconnect(sb_r, SIGNAL(valueChanged(int)), this, - SLOT(update_color_rsb(int))); + SLOT(update_color_rsb(int))); sb_r->setValue(v); QObject::connect(sb_r, SIGNAL(valueChanged(int)), this, - SLOT(update_color_rsb(int))); + SLOT(update_color_rsb(int))); fr1 = float(v) / 255; emit color_changed(fr1, fg1, fb1, 1.0f - transp1); } @@ -2243,10 +2241,10 @@ void TissueAdder::update_color_r(int v) void TissueAdder::update_color_g(int v) { QObject::disconnect(sb_g, SIGNAL(valueChanged(int)), this, - SLOT(update_color_gsb(int))); + SLOT(update_color_gsb(int))); sb_g->setValue(v); QObject::connect(sb_g, SIGNAL(valueChanged(int)), this, - SLOT(update_color_gsb(int))); + SLOT(update_color_gsb(int))); fg1 = float(v) / 255; emit color_changed(fr1, fg1, fb1, 1.0f - transp1); } @@ -2254,10 +2252,10 @@ void TissueAdder::update_color_g(int v) void TissueAdder::update_color_b(int v) { QObject::disconnect(sb_b, SIGNAL(valueChanged(int)), this, - SLOT(update_color_bsb(int))); + SLOT(update_color_bsb(int))); sb_b->setValue(v); QObject::connect(sb_b, SIGNAL(valueChanged(int)), this, - SLOT(update_color_bsb(int))); + SLOT(update_color_bsb(int))); fb1 = float(v) / 255; emit color_changed(fr1, fg1, fb1, 1.0f - transp1); } @@ -2265,10 +2263,10 @@ void TissueAdder::update_color_b(int v) void TissueAdder::update_opac(int v) { QObject::disconnect(sb_transp, SIGNAL(valueChanged(int)), this, - SLOT(update_opacsb(int))); + SLOT(update_opacsb(int))); sb_transp->setValue(v); QObject::connect(sb_transp, SIGNAL(valueChanged(int)), this, - SLOT(update_opacsb(int))); + SLOT(update_opacsb(int))); transp1 = float(v) / 100; emit color_changed(fr1, fg1, fb1, 1.0f - transp1); } @@ -2276,10 +2274,10 @@ void TissueAdder::update_opac(int v) void TissueAdder::update_color_rsb(int v) { QObject::disconnect(r, SIGNAL(valueChanged(int)), this, - SLOT(update_color_r(int))); + SLOT(update_color_r(int))); r->setValue(v); QObject::connect(r, SIGNAL(valueChanged(int)), this, - SLOT(update_color_r(int))); + SLOT(update_color_r(int))); fr1 = float(v) / 255; emit color_changed(fr1, fg1, fb1, 1.0f - transp1); } @@ -2287,10 +2285,10 @@ void TissueAdder::update_color_rsb(int v) void TissueAdder::update_color_gsb(int v) { QObject::disconnect(g, SIGNAL(valueChanged(int)), this, - SLOT(update_color_g(int))); + SLOT(update_color_g(int))); g->setValue(v); QObject::connect(g, SIGNAL(valueChanged(int)), this, - SLOT(update_color_g(int))); + SLOT(update_color_g(int))); fg1 = float(v) / 255; emit color_changed(fr1, fg1, fb1, 1.0f - transp1); } @@ -2298,10 +2296,10 @@ void TissueAdder::update_color_gsb(int v) void TissueAdder::update_color_bsb(int v) { QObject::disconnect(b, SIGNAL(valueChanged(int)), this, - SLOT(update_color_b(int))); + SLOT(update_color_b(int))); b->setValue(v); QObject::connect(b, SIGNAL(valueChanged(int)), this, - SLOT(update_color_b(int))); + SLOT(update_color_b(int))); fb1 = float(v) / 255; emit color_changed(fr1, fg1, fb1, 1.0f - transp1); } @@ -2309,10 +2307,10 @@ void TissueAdder::update_color_bsb(int v) void TissueAdder::update_opacsb(int v) { QObject::disconnect(sl_transp, SIGNAL(valueChanged(int)), this, - SLOT(update_opac(int))); + SLOT(update_opac(int))); sl_transp->setValue(v); QObject::connect(sl_transp, SIGNAL(valueChanged(int)), this, - SLOT(update_opac(int))); + SLOT(update_opac(int))); transp1 = float(v) / 100; emit color_changed(fr1, fg1, fb1, 1.0f - transp1); } @@ -2324,14 +2322,14 @@ void TissueAdder::add_pressed() if (!nameField->text().isEmpty()) { tissues_size_t type = tissueTreeWidget->get_current_type(); - TissueInfoStruct* tissueInfo = TissueInfos::GetTissueInfo(type); + TissueInfoStruct *tissueInfo = TissueInfos::GetTissueInfo(type); QString oldName = tissueInfo->name; if (oldName.compare(nameField->text(), Qt::CaseInsensitive) != 0 && - TissueInfos::GetTissueType(nameField->text()) > 0) + TissueInfos::GetTissueType(nameField->text()) > 0) { QMessageBox::information( - this, "iSeg", - "A tissue with the same name already exists."); + this, "iSeg", + "A tissue with the same name already exists."); return; } TissueInfos::SetTissueName(type, nameField->text()); @@ -2360,8 +2358,8 @@ void TissueAdder::add_pressed() if (TissueInfos::GetTissueType(nameField->text()) > 0) { QMessageBox::information( - this, "iSeg", - "A tissue with the same name already exists."); + this, "iSeg", + "A tissue with the same name already exists."); return; } TissueInfoStruct tissueInfo; @@ -2384,10 +2382,10 @@ void TissueAdder::add_pressed() return; } -TissueFolderAdder::TissueFolderAdder(TissueTreeWidget* tissueTree, - QWidget* parent, const char* name, - Qt::WindowFlags wFlags) - : QDialog(parent, name, TRUE, wFlags), tissueTreeWidget(tissueTree) +TissueFolderAdder::TissueFolderAdder(TissueTreeWidget *tissueTree, + QWidget *parent, const char *name, + Qt::WindowFlags wFlags) + : QDialog(parent, name, TRUE, wFlags), tissueTreeWidget(tissueTree) { setFixedWidth(235); setFixedHeight(161); @@ -2425,10 +2423,10 @@ void TissueFolderAdder::add_pressed() close(); } -TissueHierarchyWidget::TissueHierarchyWidget(TissueTreeWidget* tissueTree, - QWidget* parent, - Qt::WindowFlags wFlags) - : QWidget(parent, wFlags), tissueTreeWidget(tissueTree) +TissueHierarchyWidget::TissueHierarchyWidget(TissueTreeWidget *tissueTree, + QWidget *parent, + Qt::WindowFlags wFlags) + : QWidget(parent, wFlags), tissueTreeWidget(tissueTree) { hboxOverall = new Q3HBoxLayout(this); vboxOverall = new Q3VBoxLayout(); @@ -2451,19 +2449,19 @@ TissueHierarchyWidget::TissueHierarchyWidget(TissueTreeWidget* tissueTree, vboxOverall->addLayout(vboxHierarchyButtons); QObject::connect(hierarchyComboBox, SIGNAL(currentIndexChanged(int)), this, - SLOT(hierarchy_changed(int))); + SLOT(hierarchy_changed(int))); QObject::connect(newHierarchyButton, SIGNAL(clicked()), this, - SLOT(new_hierarchy_pressed())); + SLOT(new_hierarchy_pressed())); QObject::connect(loadHierarchyButton, SIGNAL(clicked()), this, - SLOT(load_hierarchy_pressed())); + SLOT(load_hierarchy_pressed())); QObject::connect(saveHierarchyAsButton, SIGNAL(clicked()), this, - SLOT(save_hierarchy_as_pressed())); + SLOT(save_hierarchy_as_pressed())); QObject::connect(removeHierarchyButton, SIGNAL(clicked()), this, - SLOT(remove_hierarchy_pressed())); + SLOT(remove_hierarchy_pressed())); QObject::connect(tissueTreeWidget, SIGNAL(hierarchy_list_changed()), this, - SLOT(update_hierarchy_combo_box())); + SLOT(update_hierarchy_combo_box())); update_hierarchy_combo_box(); @@ -2480,7 +2478,7 @@ void TissueHierarchyWidget::update_hierarchy_combo_box() hierarchyComboBox->addItem(name); } hierarchyComboBox->setCurrentItem( - tissueTreeWidget->get_selected_hierarchy()); + tissueTreeWidget->get_selected_hierarchy()); hierarchyComboBox->blockSignals(false); } @@ -2510,14 +2508,14 @@ bool TissueHierarchyWidget::handle_changed_hierarchy() return true; #else // Version: Commit change, but only save to xml if default hierarchy changed if (tissueTreeWidget->get_selected_hierarchy() == 0 && - tissueTreeWidget->get_hierarchy_modified()) + tissueTreeWidget->get_hierarchy_modified()) { int ret = QMessageBox::warning( - this, "iSeg", - QString("Do you want to save changes to hierarchy %1?") - .arg(tissueTreeWidget->get_current_hierarchy_name()), - QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, - QMessageBox::Cancel | QMessageBox::Escape); + this, "iSeg", + QString("Do you want to save changes to hierarchy %1?") + .arg(tissueTreeWidget->get_current_hierarchy_name()), + QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, + QMessageBox::Cancel | QMessageBox::Escape); if (ret == QMessageBox::Yes) { // Save hierarchy as... @@ -2586,8 +2584,8 @@ void TissueHierarchyWidget::new_hierarchy_pressed() // Get hierarchy name bool ok = false; QString newHierarchyName = QInputDialog::getText( - "Hierarchy name", "Enter a name for the hierarchy:", QLineEdit::Normal, - "New Hierarchy", &ok, this); + "Hierarchy name", "Enter a name for the hierarchy:", QLineEdit::Normal, + "New Hierarchy", &ok, this); if (!ok) { return; @@ -2607,7 +2605,7 @@ void TissueHierarchyWidget::load_hierarchy_pressed() // Get file name QString fileName = QFileDialog::getOpenFileName(this, tr("Load File"), "", - tr("XML files (*.xml)")); + tr("XML files (*.xml)")); if (fileName.isNull()) { return; @@ -2618,7 +2616,7 @@ void TissueHierarchyWidget::load_hierarchy_pressed() // Set loaded hierarchy selected tissueTreeWidget->set_hierarchy(tissueTreeWidget->get_hierarchy_count() - - 1); + 1); update_hierarchy_combo_box(); } @@ -2626,7 +2624,7 @@ bool TissueHierarchyWidget::save_hierarchy_as_pressed() { // Get file name QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), "", - tr("XML files (*.xml)")); + tr("XML files (*.xml)")); if (fileName.isNull()) { return false; @@ -2635,8 +2633,8 @@ bool TissueHierarchyWidget::save_hierarchy_as_pressed() // Get hierarchy name bool ok = false; QString newHierarchyName = QInputDialog::getText( - "Hierarchy name", "Enter a name for the hierarchy:", QLineEdit::Normal, - tissueTreeWidget->get_current_hierarchy_name(), &ok, this); + "Hierarchy name", "Enter a name for the hierarchy:", QLineEdit::Normal, + tissueTreeWidget->get_current_hierarchy_name(), &ok, this); if (!ok) { return false; @@ -2652,9 +2650,9 @@ void TissueHierarchyWidget::remove_hierarchy_pressed() tissueTreeWidget->remove_current_hierarchy(); } -bits_stack::bits_stack(SlicesHandler* hand3D, QWidget* parent, const char* name, - Qt::WindowFlags wFlags) - : QWidget(parent, name, wFlags), handler3D(hand3D) +bits_stack::bits_stack(SlicesHandler *hand3D, QWidget *parent, const char *name, + Qt::WindowFlags wFlags) + : QWidget(parent, name, wFlags), handler3D(hand3D) { bits_names = new QListWidget(this); hbox1 = new Q3HBoxLayout(this); @@ -2686,20 +2684,20 @@ bits_stack::bits_stack(SlicesHandler* hand3D, QWidget* parent, const char* name, bits_names->setDropIndicatorShown(true); QObject::connect(pushwork, SIGNAL(clicked()), this, - SLOT(pushwork_pressed())); + SLOT(pushwork_pressed())); QObject::connect(pushbmp, SIGNAL(clicked()), this, SLOT(pushbmp_pressed())); QObject::connect(pushtissue, SIGNAL(clicked()), this, - SLOT(pushtissue_pressed())); + SLOT(pushtissue_pressed())); QObject::connect(popwork, SIGNAL(clicked()), this, SLOT(popwork_pressed())); QObject::connect(popbmp, SIGNAL(clicked()), this, SLOT(popbmp_pressed())); QObject::connect(poptissue, SIGNAL(clicked()), this, - SLOT(poptissue_pressed())); + SLOT(poptissue_pressed())); QObject::connect(deletebtn, SIGNAL(clicked()), this, - SLOT(delete_pressed())); + SLOT(delete_pressed())); QObject::connect(saveitem, SIGNAL(clicked()), this, - SLOT(saveitem_pressed())); + SLOT(saveitem_pressed())); QObject::connect(loaditem, SIGNAL(clicked()), this, - SLOT(loaditem_pressed())); + SLOT(loaditem_pressed())); oldw = handler3D->return_width(); oldh = handler3D->return_height(); @@ -2751,7 +2749,7 @@ void bits_stack::push_helper(bool source, bool target, bool tissue) emit begin_dataexport(dataSelection, this); bits_stack_pushdialog pushdialog(this, QString("Copy ") + dataName + - QString("...")); + QString("...")); if (pushdialog.exec() == QDialog::Rejected) { emit end_dataexport(this); @@ -2763,21 +2761,21 @@ void bits_stack::push_helper(bool source, bool target, bool tissue) // Copy current slice bool ok; QString newText = QInputDialog::getText( - "Name", "Enter a name for the picture:", QLineEdit::Normal, "", &ok, - this); + "Name", "Enter a name for the picture:", QLineEdit::Normal, "", &ok, + this); newText = newText + QString(" (") + - QString::number(handler3D->get_activeslice() + 1) + - QString(")"); + QString::number(handler3D->get_activeslice() + 1) + + QString(")"); while (ok && - bits_names->findItems(newText, Qt::MatchExactly).size() > 0) + bits_names->findItems(newText, Qt::MatchExactly).size() > 0) { newText = QInputDialog::getText( - "Name", - "Enter a !new! name for the picture:", QLineEdit::Normal, "", - &ok, this); + "Name", + "Enter a !new! name for the picture:", QLineEdit::Normal, "", + &ok, this); newText = newText + QString(" (") + - QString::number(handler3D->get_activeslice() + 1) + - QString(")"); + QString::number(handler3D->get_activeslice() + 1) + + QString(")"); } if (ok) { @@ -2806,11 +2804,11 @@ void bits_stack::push_helper(bool source, bool target, bool tissue) unsigned int startslice = pushdialog.get_startslice(&startok); unsigned int endslice = pushdialog.get_endslice(&endok); while (!startok || !endok || startslice > endslice || startslice < 1 || - endslice > handler3D->return_nrslices()) + endslice > handler3D->return_nrslices()) { QMessageBox::information( - this, QString("Copy ") + dataName + QString("..."), - "Please enter a valid slice range.\n"); + this, QString("Copy ") + dataName + QString("..."), + "Please enter a valid slice range.\n"); if (pushdialog.exec() == QDialog::Rejected) { emit end_dataexport(this); @@ -2822,22 +2820,22 @@ void bits_stack::push_helper(bool source, bool target, bool tissue) matchfound = true; QString newText = QInputDialog::getText( - "Name", "Enter a name for the pictures:", QLineEdit::Normal, "", - &ok, this); + "Name", "Enter a name for the pictures:", QLineEdit::Normal, "", + &ok, this); while (ok && matchfound) { matchfound = false; for (unsigned int slice = startslice; slice <= endslice; ++slice) { QString newTextExt = newText + QString(" (") + - QString::number(slice) + QString(")"); + QString::number(slice) + QString(")"); if (bits_names->findItems(newTextExt, Qt::MatchExactly).size() > - 0) + 0) { matchfound = true; newText = QInputDialog::getText( - "Name", "Enter a !new! name for the pictures:", - QLineEdit::Normal, "", &ok, this); + "Name", "Enter a !new! name for the pictures:", + QLineEdit::Normal, "", &ok, this); break; } } @@ -2847,7 +2845,7 @@ void bits_stack::push_helper(bool source, bool target, bool tissue) for (unsigned int slice = startslice; slice <= endslice; ++slice) { QString newTextExt = newText + QString(" (") + - QString::number(slice) + QString(")"); + QString::number(slice) + QString(")"); unsigned dummy; if (source) { @@ -2898,18 +2896,18 @@ void bits_stack::pop_helper(bool source, bool target, bool tissue) dataName = QString("Tissue"); } - QList selectedItems = bits_names->selectedItems(); + QList selectedItems = bits_names->selectedItems(); if (selectedItems.size() <= 0) { return; } else if (handler3D->get_activeslice() + selectedItems.size() > - handler3D->return_nrslices()) + handler3D->return_nrslices()) { QMessageBox::information( - this, QString("Paste ") + dataName, - "The number of images to be pasted starting at the\ncurrent slice " - "would surpass the end of the data stack.\n"); + this, QString("Paste ") + dataName, + "The number of images to be pasted starting at the\ncurrent slice " + "would surpass the end of the data stack.\n"); return; } @@ -2924,27 +2922,27 @@ void bits_stack::pop_helper(bool source, bool target, bool tissue) unsigned int slice = handler3D->get_activeslice(); if (source) { - for (QList::iterator iter = selectedItems.begin(); - iter != selectedItems.end(); ++iter) + for (QList::iterator iter = selectedItems.begin(); + iter != selectedItems.end(); ++iter) { handler3D->getstack_bmp(slice++, bits_nr[(*iter)->text()]); } } else if (target) { - for (QList::iterator iter = selectedItems.begin(); - iter != selectedItems.end(); ++iter) + for (QList::iterator iter = selectedItems.begin(); + iter != selectedItems.end(); ++iter) { handler3D->getstack_work(slice++, bits_nr[(*iter)->text()]); } } else if (tissue) { - for (QList::iterator iter = selectedItems.begin(); - iter != selectedItems.end(); ++iter) + for (QList::iterator iter = selectedItems.begin(); + iter != selectedItems.end(); ++iter) { handler3D->getstack_tissue(slice++, bits_nr[(*iter)->text()], - tissuenr, true); + tissuenr, true); } } @@ -2959,10 +2957,10 @@ void bits_stack::poptissue_pressed() { pop_helper(false, false, true); } void bits_stack::loaditem_pressed() { - Q3FileDialog* dialog = new Q3FileDialog(QString::null, - "Stackitems (*.stk)\n" - "All(*.*)", - this); + Q3FileDialog *dialog = new Q3FileDialog(QString::null, + "Stackitems (*.stk)\n" + "All(*.*)", + this); dialog->setMode(Q3FileDialog::ExistingFiles); if (dialog->exec() == QDialog::Rejected) { @@ -2977,23 +2975,23 @@ void bits_stack::loaditem_pressed() bool ok; bool matchfound = true; QString newText = QInputDialog::getText( - "Name", "Enter a name for the pictures:", QLineEdit::Normal, "", - &ok, this); + "Name", "Enter a name for the pictures:", QLineEdit::Normal, "", + &ok, this); while (ok && matchfound) { matchfound = false; unsigned int suffix = 0; for (QStringList::Iterator iter = selectedFiles.begin(); - iter != selectedFiles.end(); ++iter) + iter != selectedFiles.end(); ++iter) { QString newTextExt = newText + QString::number(suffix++); if (bits_names->findItems(newTextExt, Qt::MatchExactly).size() > - 0) + 0) { matchfound = true; newText = QInputDialog::getText( - "Name", "Enter a !new! name for the pictures:", - QLineEdit::Normal, "", &ok, this); + "Name", "Enter a !new! name for the pictures:", + QLineEdit::Normal, "", &ok, this); break; } } @@ -3003,7 +3001,7 @@ void bits_stack::loaditem_pressed() { unsigned int suffix = 0; for (QStringList::Iterator iter = selectedFiles.begin(); - iter != selectedFiles.end(); ++iter) + iter != selectedFiles.end(); ++iter) { QString newTextExt = newText + QString::number(suffix++); unsigned dummy = handler3D->loadstack(iter->ascii()); @@ -3021,15 +3019,15 @@ void bits_stack::loaditem_pressed() // Load single item bool ok; QString newText = QInputDialog::getText( - "Name", "Enter a name for the picture:", QLineEdit::Normal, "", &ok, - this); + "Name", "Enter a name for the picture:", QLineEdit::Normal, "", &ok, + this); while (ok && - bits_names->findItems(newText, Qt::MatchExactly).size() > 0) + bits_names->findItems(newText, Qt::MatchExactly).size() > 0) { newText = QInputDialog::getText( - "Name", - "Enter a !new! name for the picture:", QLineEdit::Normal, "", - &ok, this); + "Name", + "Enter a !new! name for the picture:", QLineEdit::Normal, "", + &ok, this); } if (ok) @@ -3050,14 +3048,14 @@ void bits_stack::loaditem_pressed() void bits_stack::saveitem_pressed() { - QList selectedItems = bits_names->selectedItems(); + QList selectedItems = bits_names->selectedItems(); if (selectedItems.size() <= 0) { return; } QString savefilename = Q3FileDialog::getSaveFileName( - QString::null, "Stackitems (*.stk)\n", this); //, filename); + QString::null, "Stackitems (*.stk)\n", this); //, filename); if (savefilename.endsWith(QString(".stk"))) { savefilename.remove(savefilename.length() - 4, 4); @@ -3077,35 +3075,35 @@ void bits_stack::saveitem_pressed() fieldWidth++; } unsigned int suffix = 1; - for (QList::iterator iter = selectedItems.begin(); - iter != selectedItems.end(); ++iter) + for (QList::iterator iter = selectedItems.begin(); + iter != selectedItems.end(); ++iter) { QString savefilenameExt = - savefilename + - QString("%1").arg(suffix++, fieldWidth, 10, QChar('0')) + - QString(".stk"); + savefilename + + QString("%1").arg(suffix++, fieldWidth, 10, QChar('0')) + + QString(".stk"); handler3D->savestack(bits_nr[(*iter)->text()], - savefilenameExt.ascii()); + savefilenameExt.ascii()); } } else { QString savefilenameExt = savefilename + QString(".stk"); handler3D->savestack(bits_nr[selectedItems[0]->text()], - savefilenameExt.ascii()); + savefilenameExt.ascii()); } } void bits_stack::delete_pressed() { - QList selectedItems = bits_names->selectedItems(); + QList selectedItems = bits_names->selectedItems(); if (selectedItems.size() <= 0) { return; } - for (QList::iterator iter = selectedItems.begin(); - iter != selectedItems.end(); ++iter) + for (QList::iterator iter = selectedItems.begin(); + iter != selectedItems.end(); ++iter) { handler3D->removestack(bits_nr[(*iter)->text()]); bits_nr.erase((*iter)->text()); @@ -3114,7 +3112,7 @@ void bits_stack::delete_pressed() } } -QMap* bits_stack::return_bitsnr() { return &bits_nr; } +QMap *bits_stack::return_bitsnr() { return &bits_nr; } void bits_stack::newloaded() { @@ -3136,7 +3134,7 @@ void bits_stack::clear_stack() emit stack_changed(); } -FILE* bits_stack::save_proj(FILE* fp) +FILE *bits_stack::save_proj(FILE *fp) { int size = int(bits_nr.size()); fwrite(&size, 1, sizeof(int), fp); @@ -3154,7 +3152,7 @@ FILE* bits_stack::save_proj(FILE* fp) return fp; } -FILE* bits_stack::load_proj(FILE* fp) +FILE *bits_stack::load_proj(FILE *fp) { oldw = handler3D->return_width(); oldh = handler3D->return_height(); @@ -3184,9 +3182,9 @@ FILE* bits_stack::load_proj(FILE* fp) return fp; } -extoverlay_widget::extoverlay_widget(SlicesHandler* hand3D, QWidget* parent, - const char* name, Qt::WindowFlags wFlags) - : QWidget(parent, name, wFlags), handler3D(hand3D) +extoverlay_widget::extoverlay_widget(SlicesHandler *hand3D, QWidget *parent, + const char *name, Qt::WindowFlags wFlags) + : QWidget(parent, name, wFlags), handler3D(hand3D) { activeslice = handler3D->get_activeslice(); bmphand = handler3D->get_activebmphandler(); @@ -3243,17 +3241,17 @@ extoverlay_widget::extoverlay_widget(SlicesHandler* hand3D, QWidget* parent, setFixedHeight(hboxOverall->sizeHint().height()); QObject::connect(datasetComboBox, SIGNAL(currentIndexChanged(int)), this, - SLOT(dataset_changed(int))); + SLOT(dataset_changed(int))); QObject::connect(loadDatasetButton, SIGNAL(clicked()), this, - SLOT(load_dataset_pressed())); + SLOT(load_dataset_pressed())); QObject::connect(leAlpha, SIGNAL(editingFinished()), this, - SLOT(alpha_changed())); + SLOT(alpha_changed())); QObject::connect(slAlpha, SIGNAL(sliderMoved(int)), this, - SLOT(slider_changed(int))); + SLOT(slider_changed(int))); QObject::connect(srcCheckBox, SIGNAL(clicked()), this, - SLOT(source_toggled())); + SLOT(source_toggled())); QObject::connect(tgtCheckBox, SIGNAL(clicked()), this, - SLOT(target_toggled())); + SLOT(target_toggled())); initialize(); } @@ -3277,7 +3275,7 @@ void extoverlay_widget::initialize() void extoverlay_widget::newloaded() { handler3D->clear_overlay(); } -void extoverlay_widget::add_dataset(const QString& path) +void extoverlay_widget::add_dataset(const QString &path) { datasetNames.push_back(QFileInfo(path).fileName()); datasetFilepaths.push_back(path); @@ -3309,30 +3307,30 @@ void extoverlay_widget::reload_overlay() handler3D->clear_overlay(); } else if (datasetFilepaths[selectedDataset].endsWith(QString(".raw"), - Qt::CaseInsensitive)) + Qt::CaseInsensitive)) { ok = handler3D->ReadRawOverlay(datasetFilepaths[selectedDataset], 8, - handler3D->get_activeslice()); + handler3D->get_activeslice()); } else if (datasetFilepaths[selectedDataset].endsWith(QString(".vtk"), - Qt::CaseInsensitive) || - datasetFilepaths[selectedDataset].endsWith(QString(".vti"), - Qt::CaseInsensitive)) + Qt::CaseInsensitive) || + datasetFilepaths[selectedDataset].endsWith(QString(".vti"), + Qt::CaseInsensitive)) { ok = handler3D->ReadOverlay(datasetFilepaths[selectedDataset], - handler3D->get_activeslice()); + handler3D->get_activeslice()); } else if (datasetFilepaths[selectedDataset].endsWith(QString(".nii"), - Qt::CaseInsensitive) || - datasetFilepaths[selectedDataset].endsWith(QString(".hdr"), - Qt::CaseInsensitive) || - datasetFilepaths[selectedDataset].endsWith(QString(".img"), - Qt::CaseInsensitive) || - datasetFilepaths[selectedDataset].endsWith(QString(".nii.gz"), - Qt::CaseInsensitive)) + Qt::CaseInsensitive) || + datasetFilepaths[selectedDataset].endsWith(QString(".hdr"), + Qt::CaseInsensitive) || + datasetFilepaths[selectedDataset].endsWith(QString(".img"), + Qt::CaseInsensitive) || + datasetFilepaths[selectedDataset].endsWith(QString(".nii.gz"), + Qt::CaseInsensitive)) { ok = handler3D->ReadOverlay(datasetFilepaths[selectedDataset], - handler3D->get_activeslice()); + handler3D->get_activeslice()); } if (!ok) @@ -3365,12 +3363,12 @@ extoverlay_widget::~extoverlay_widget() void extoverlay_widget::load_dataset_pressed() { QString loadfilename = - Q3FileDialog::getOpenFileName(QString::null, - "VTK (*.vti *.vtk)\n" - "Raw files (*.raw)\n" - "NIFTI (*.nii *.hdr *.img *.nii.gz)\n" - "All(*.*)", - this); // TODO: Support other file types + Q3FileDialog::getOpenFileName(QString::null, + "VTK (*.vti *.vtk)\n" + "Raw files (*.raw)\n" + "NIFTI (*.nii *.hdr *.img *.nii.gz)\n" + "All(*.*)", + this); // TODO: Support other file types if (!loadfilename.isEmpty()) { add_dataset(loadfilename); @@ -3422,10 +3420,10 @@ void extoverlay_widget::target_toggled() emit workoverlayvisible_changed(isset); } -MultiDataset_widget::MultiDataset_widget(SlicesHandler* hand3D, QWidget* parent, - const char* name, - Qt::WindowFlags wFlags) - : QWidget(parent, name, wFlags), m_Handler3D(hand3D) +MultiDataset_widget::MultiDataset_widget(SlicesHandler *hand3D, QWidget *parent, + const char *name, + Qt::WindowFlags wFlags) + : QWidget(parent, name, wFlags), m_Handler3D(hand3D) { hboxOverall = new Q3HBoxLayout(this); vboxOverall = new Q3VBoxLayout(); @@ -3443,7 +3441,7 @@ MultiDataset_widget::MultiDataset_widget(SlicesHandler* hand3D, QWidget* parent, vboxOverall->addWidget(m_DatasetsGroupBox); //Buttons - QHBoxLayout* buttonsGrid = new QHBoxLayout(); + QHBoxLayout *buttonsGrid = new QHBoxLayout(); vboxOverall->addLayout(buttonsGrid); // Add dataset button @@ -3461,15 +3459,15 @@ MultiDataset_widget::MultiDataset_widget(SlicesHandler* hand3D, QWidget* parent, setFixedHeight(hboxOverall->sizeHint().height()); QObject::connect(m_AddDatasetButton, SIGNAL(clicked()), this, - SLOT(AddDatasetPressed())); + SLOT(AddDatasetPressed())); QObject::connect(m_LoadDatasetButton, SIGNAL(clicked()), this, - SLOT(SwitchDataset())); + SLOT(SwitchDataset())); QObject::connect(m_ChangeNameButton, SIGNAL(clicked()), this, - SLOT(ChangeDatasetName())); + SLOT(ChangeDatasetName())); QObject::connect(m_RemoveDatasetButton, SIGNAL(clicked()), this, - SLOT(RemoveDataset())); + SLOT(RemoveDataset())); QObject::connect(m_DatasetsGroupBox, SIGNAL(clicked()), this, - SLOT(DatasetSelectionChanged())); + SLOT(DatasetSelectionChanged())); Initialize(); InitializeMap(); @@ -3506,7 +3504,7 @@ void MultiDataset_widget::ClearRadioButtons() { if (m_VboxDatasets->layout() != NULL) { - QLayoutItem* item; + QLayoutItem *item; while ((item = m_VboxDatasets->layout()->takeAt(0)) != NULL) { delete item->widget(); @@ -3572,7 +3570,7 @@ void MultiDataset_widget::AddDatasetPressed() if (selectedType != -1) { - SlicesHandler* handler3D = new SlicesHandler(); + SlicesHandler *handler3D = new SlicesHandler(); QStringList loadfilenames; unsigned short width, height, nrofslices; MultiDataset_widget::SDatasetInfo dataInfo; @@ -3584,17 +3582,17 @@ void MultiDataset_widget::AddDatasetPressed() case SupportedMultiDatasetTypes::supportedTypes::bmp: { loadfilenames = Q3FileDialog::getOpenFileNames( - "Images (*.bmp)\n" - "All(*.*)", - QString::null, this, "open files dialog", - "Select one or more files to open"); + "Images (*.bmp)\n" + "All(*.*)", + QString::null, this, "open files dialog", + "Select one or more files to open"); if (!loadfilenames.empty()) { sort(loadfilenames.begin(), loadfilenames.end()); short nrelem = loadfilenames.size(); - vector vfilenames; + vector vfilenames; for (short i = 0; i < nrelem; i++) { vfilenames.push_back(loadfilenames[i].ascii()); @@ -3609,7 +3607,7 @@ void MultiDataset_widget::AddDatasetPressed() nrofslices = handler3D->return_nrslices(); success = CheckInfoAndAddToList(dataInfo, loadfilenames, width, - height, nrofslices); + height, nrofslices); } } break; @@ -3617,10 +3615,10 @@ void MultiDataset_widget::AddDatasetPressed() case SupportedMultiDatasetTypes::supportedTypes::dcm: { loadfilenames = Q3FileDialog::getOpenFileNames( - "Images (*.dcm *.dicom)\n" - "All(*.*)", - QString::null, this, "open files dialog", - "Select one or more files to open"); + "Images (*.dcm *.dicom)\n" + "All(*.*)", + QString::null, this, "open files dialog", + "Select one or more files to open"); if (!loadfilenames.empty()) { @@ -3634,7 +3632,7 @@ void MultiDataset_widget::AddDatasetPressed() nrofslices = handler3D->return_nrslices(); success = CheckInfoAndAddToList(dataInfo, loadfilenames, width, - height, nrofslices); + height, nrofslices); } break; @@ -3651,7 +3649,7 @@ void MultiDataset_widget::AddDatasetPressed() nrofslices = handler3D->return_nrslices(); success = CheckInfoAndAddToList(dataInfo, loadfilenames, width, - height, nrofslices); + height, nrofslices); } break; @@ -3660,11 +3658,11 @@ void MultiDataset_widget::AddDatasetPressed() { bool res = true; QString loadfilename = Q3FileDialog::getOpenFileName( - QString::null, - "VTK (*.vti *.vtk)\n" - "NIFTI (*.nii *.hdr *.img *.nia)\n" - "All(*.*)", - this); + QString::null, + "VTK (*.vti *.vtk)\n" + "NIFTI (*.nii *.hdr *.img *.nia)\n" + "All(*.*)", + this); if (!loadfilename.isEmpty()) { if (handler3D->ReadImage(loadfilename.ascii())) @@ -3675,7 +3673,7 @@ void MultiDataset_widget::AddDatasetPressed() nrofslices = handler3D->return_nrslices(); success = CheckInfoAndAddToList(dataInfo, loadfilenames, - width, height, nrofslices); + width, height, nrofslices); } } } @@ -3702,9 +3700,9 @@ void MultiDataset_widget::AddDatasetPressed() } bool MultiDataset_widget::CheckInfoAndAddToList( - MultiDataset_widget::SDatasetInfo& newRadioButton, - QStringList loadfilenames, unsigned short width, unsigned short height, - unsigned short nrofslices) + MultiDataset_widget::SDatasetInfo &newRadioButton, + QStringList loadfilenames, unsigned short width, unsigned short height, + unsigned short nrofslices) { // check whether the new dataset matches the dataset loaded const unsigned short w_loaded = m_Handler3D->return_width(); @@ -3714,24 +3712,24 @@ bool MultiDataset_widget::CheckInfoAndAddToList( if (w_loaded == 512 && h_loaded == 512 && nrofslices_loaded == 1) { QMessageBox mb( - "Loading failed", "The main dataset must be loaded first.", - QMessageBox::Critical, QMessageBox::Ok | QMessageBox::Default, - QMessageBox::NoButton, QMessageBox::NoButton); + "Loading failed", "The main dataset must be loaded first.", + QMessageBox::Critical, QMessageBox::Ok | QMessageBox::Default, + QMessageBox::NoButton, QMessageBox::NoButton); mb.exec(); } if (w_loaded == width && h_loaded == height && - nrofslices_loaded == nrofslices) + nrofslices_loaded == nrofslices) { return AddDatasetToList(newRadioButton, loadfilenames); } else { QMessageBox mb( - "Loading failed", - "The resolution of the dataset must match the one loaded.", - QMessageBox::Critical, QMessageBox::Ok | QMessageBox::Default, - QMessageBox::NoButton, QMessageBox::NoButton); + "Loading failed", + "The resolution of the dataset must match the one loaded.", + QMessageBox::Critical, QMessageBox::Ok | QMessageBox::Default, + QMessageBox::NoButton, QMessageBox::NoButton); mb.exec(); } @@ -3739,26 +3737,26 @@ bool MultiDataset_widget::CheckInfoAndAddToList( } bool MultiDataset_widget::AddDatasetToList( - MultiDataset_widget::SDatasetInfo& newRadioButton, - QStringList loadfilenames) + MultiDataset_widget::SDatasetInfo &newRadioButton, + QStringList loadfilenames) { QString butText = loadfilenames[0]; newRadioButton.m_RadioButton = - new QRadioButton(QFileInfo(loadfilenames[0]).fileName()); + new QRadioButton(QFileInfo(loadfilenames[0]).fileName()); newRadioButton.m_DatasetFilepath = loadfilenames; newRadioButton.m_RadioButtonText = butText; m_VboxDatasets->addWidget(newRadioButton.m_RadioButton, 0, Qt::AlignTop); QObject::connect(newRadioButton.m_RadioButton, SIGNAL(clicked()), this, - SLOT(DatasetSelectionChanged())); + SLOT(DatasetSelectionChanged())); return !newRadioButton.m_DatasetFilepath.empty(); } void MultiDataset_widget::CopyImagesSlices( - SlicesHandler* handler3D, MultiDataset_widget::SDatasetInfo& newRadioButton, - const bool saveOnlyWorkingBits /*= false*/) + SlicesHandler *handler3D, MultiDataset_widget::SDatasetInfo &newRadioButton, + const bool saveOnlyWorkingBits /*= false*/) { const int nrslices = handler3D->return_nrslices(); const int width = handler3D->return_width(); @@ -3773,7 +3771,7 @@ void MultiDataset_widget::CopyImagesSlices( newRadioButton.m_BmpSlices.clear(); for (int i = 0; i < nrslices; i++) { - float* bmp_data = (float*)malloc(sizeof(float) * size); + float *bmp_data = (float *)malloc(sizeof(float) * size); memcpy(bmp_data, handler3D->return_bmp(i), sizeof(float) * size); newRadioButton.m_BmpSlices.push_back(bmp_data); } @@ -3782,7 +3780,7 @@ void MultiDataset_widget::CopyImagesSlices( newRadioButton.m_WorkSlices.clear(); for (int i = 0; i < nrslices; i++) { - float* work_data = (float*)malloc(sizeof(float) * size); + float *work_data = (float *)malloc(sizeof(float) * size); memcpy(work_data, handler3D->return_work(i), sizeof(float) * size); newRadioButton.m_WorkSlices.push_back(work_data); } @@ -3790,7 +3788,7 @@ void MultiDataset_widget::CopyImagesSlices( void MultiDataset_widget::SwitchDataset() { - for (auto& radioButton : m_RadioButtons) + for (auto &radioButton : m_RadioButtons) { if (radioButton.m_RadioButton->isChecked()) { @@ -3810,9 +3808,9 @@ void MultiDataset_widget::SwitchDataset() float size = radioButton.m_Width * radioButton.m_Height; const int nSlices = radioButton.m_BmpSlices.size(); assert(radioButton.m_BmpSlices.size() == - m_Handler3D->return_nrslices()); + m_Handler3D->return_nrslices()); assert(radioButton.m_WorkSlices.size() == - m_Handler3D->return_nrslices()); + m_Handler3D->return_nrslices()); for (int i = 0; i < nSlices; i++) { @@ -3827,7 +3825,7 @@ void MultiDataset_widget::SwitchDataset() for (int i = 0; i < nSlices; i++) { m_Handler3D->copy2work(i, radioButton.m_WorkSlices.at(i), - 1); + 1); //m_Handler3D->set_work( i, radioButton.m_WorkSlices.at(i), 1 ); //float* work_data = (float*) malloc(sizeof(float)*size); //memcpy(work_data, radioButton.m_WorkSlices.at(i), sizeof(float)*size); @@ -3858,12 +3856,12 @@ void MultiDataset_widget::SwitchDataset() void MultiDataset_widget::ChangeDatasetName() { - for (auto& radioButton : m_RadioButtons) + for (auto &radioButton : m_RadioButtons) { if (radioButton.m_RadioButton->isChecked()) { EditText edit_text_dlg(this->parentWidget(), "", - this->windowFlags()); + this->windowFlags()); edit_text_dlg.set_editable_text(radioButton.m_RadioButton->text()); if (edit_text_dlg.exec()) { @@ -3879,20 +3877,20 @@ void MultiDataset_widget::ChangeDatasetName() void MultiDataset_widget::RemoveDataset() { int index = 0; - for (auto& radioButton : m_RadioButtons) + for (auto &radioButton : m_RadioButtons) { if (radioButton.m_RadioButton->isChecked()) { m_VboxDatasets->removeWidget(radioButton.m_RadioButton); std::for_each(radioButton.m_BmpSlices.begin(), - radioButton.m_BmpSlices.end(), - [](float* element) { delete element; }); + radioButton.m_BmpSlices.end(), + [](float *element) { delete element; }); radioButton.m_BmpSlices.clear(); std::for_each(radioButton.m_WorkSlices.begin(), - radioButton.m_WorkSlices.end(), - [](float* element) { delete element; }); + radioButton.m_WorkSlices.end(), + [](float *element) { delete element; }); radioButton.m_WorkSlices.clear(); delete radioButton.m_RadioButton; @@ -3958,17 +3956,17 @@ bool MultiDataset_widget::IsActive(const int multiDS_index) return false; } -std::vector MultiDataset_widget::GetBmpData(const int multiDS_index) +std::vector MultiDataset_widget::GetBmpData(const int multiDS_index) { if (multiDS_index < m_RadioButtons.size()) { return m_RadioButtons.at(multiDS_index).m_BmpSlices; } - return std::vector(); + return std::vector(); } void MultiDataset_widget::SetBmpData(const int multiDS_index, - std::vector bmp_bits_vc) + std::vector bmp_bits_vc) { if (multiDS_index < m_RadioButtons.size()) { @@ -3976,17 +3974,17 @@ void MultiDataset_widget::SetBmpData(const int multiDS_index, } } -std::vector MultiDataset_widget::GetWorkingData(const int multiDS_index) +std::vector MultiDataset_widget::GetWorkingData(const int multiDS_index) { if (multiDS_index < m_RadioButtons.size()) { return m_RadioButtons.at(multiDS_index).m_WorkSlices; } - return std::vector(); + return std::vector(); } void MultiDataset_widget::SetWorkingData(const int multiDS_index, - std::vector work_bits_vc) + std::vector work_bits_vc) { if (multiDS_index < m_RadioButtons.size()) { @@ -3994,9 +3992,9 @@ void MultiDataset_widget::SetWorkingData(const int multiDS_index, } } -bits_stack_pushdialog::bits_stack_pushdialog(QWidget* parent, const char* name, - Qt::WindowFlags wFlags) - : QDialog(parent, name, false, wFlags) +bits_stack_pushdialog::bits_stack_pushdialog(QWidget *parent, const char *name, + Qt::WindowFlags wFlags) + : QDialog(parent, name, false, wFlags) { vboxoverall = new Q3VBox(this); hboxparams = new Q3HBox(vboxoverall); @@ -4008,9 +4006,9 @@ bits_stack_pushdialog::bits_stack_pushdialog(QWidget* parent, const char* name, hboxpushbuttons = new Q3HBox(vboxoverall); rb_currentslice = - new QRadioButton(QString("Current slice"), vboxsliceselection); + new QRadioButton(QString("Current slice"), vboxsliceselection); rb_multislices = - new QRadioButton(QString("Slice range"), vboxsliceselection); + new QRadioButton(QString("Slice range"), vboxsliceselection); slicegroup = new QButtonGroup(this); slicegroup->insert(rb_currentslice); slicegroup->insert(rb_multislices); @@ -4038,7 +4036,7 @@ bits_stack_pushdialog::bits_stack_pushdialog(QWidget* parent, const char* name, QObject::connect(pushexec, SIGNAL(clicked()), this, SLOT(accept())); QObject::connect(pushcancel, SIGNAL(clicked()), this, SLOT(reject())); QObject::connect(slicegroup, SIGNAL(buttonClicked(int)), this, - SLOT(sliceselection_changed())); + SLOT(sliceselection_changed())); } bits_stack_pushdialog::~bits_stack_pushdialog() @@ -4052,12 +4050,12 @@ bool bits_stack_pushdialog::get_pushcurrentslice() return rb_currentslice->isChecked(); } -unsigned int bits_stack_pushdialog::get_startslice(bool* ok) +unsigned int bits_stack_pushdialog::get_startslice(bool *ok) { return le_startslice->text().toUInt(ok); } -unsigned int bits_stack_pushdialog::get_endslice(bool* ok) +unsigned int bits_stack_pushdialog::get_endslice(bool *ok) { return le_endslice->text().toUInt(ok); } @@ -4076,23 +4074,23 @@ void bits_stack_pushdialog::sliceselection_changed() //xxxxxxxxxxxxxxxxxxxxxx histo xxxxxxxxxxxxxxxxxxxxxxxxxxxx -zoomer_widget::zoomer_widget(double zoom1, QDir picpath, QWidget* parent, - const char* name, Qt::WindowFlags wFlags) - : QWidget(parent, name, wFlags) +ZoomWidget::ZoomWidget(double zoom1, QDir picpath, QWidget *parent, + const char *name, Qt::WindowFlags wFlags) + : QWidget(parent, name, wFlags) { zoom = zoom1; vbox1 = new Q3VBoxLayout(this); pushzoomin = new QPushButton( - QIcon(picpath.absFilePath(QString("zoomin.png")).ascii()), "Zoom in", - this); + QIcon(picpath.absFilePath(QString("zoomin.png")).ascii()), "Zoom in", + this); pushzoomout = new QPushButton( - QIcon(picpath.absFilePath(QString("zoomout.png")).ascii()), "Zoom out", - this); + QIcon(picpath.absFilePath(QString("zoomout.png")).ascii()), "Zoom out", + this); pushunzoom = new QPushButton( - QIcon(picpath.absFilePath(QString("unzoom.png")).ascii()), "Unzoom", - this); + QIcon(picpath.absFilePath(QString("unzoom.png")).ascii()), "Unzoom", + this); zoom_f = - new QLabel(QString("x"), this); //+QString::number(zoom,'g',4),this); + new QLabel(QString("x"), this); //+QString::number(zoom,'g',4),this); le_zoom_f = new QLineEdit(QString::number(zoom, 'g', 4), this); le_zoom_f->setFixedWidth(80); vbox1->addWidget(pushzoomin); @@ -4107,16 +4105,16 @@ zoomer_widget::zoomer_widget(double zoom1, QDir picpath, QWidget* parent, setFixedHeight(vbox1->sizeHint().height()); QObject::connect(pushzoomin, SIGNAL(clicked()), this, - SLOT(zoomin_pushed())); + SLOT(zoomin_pushed())); QObject::connect(pushzoomout, SIGNAL(clicked()), this, - SLOT(zoomout_pushed())); + SLOT(zoomout_pushed())); QObject::connect(pushunzoom, SIGNAL(clicked()), this, - SLOT(unzoom_pushed())); + SLOT(unzoom_pushed())); QObject::connect(le_zoom_f, SIGNAL(editingFinished()), this, - SLOT(le_zoom_changed())); + SLOT(le_zoom_changed())); } -zoomer_widget::~zoomer_widget() +ZoomWidget::~ZoomWidget() { delete vbox1; delete pushzoomin; @@ -4126,9 +4124,9 @@ zoomer_widget::~zoomer_widget() delete zoom_f; } -double zoomer_widget::get_zoom() { return zoom; } +double ZoomWidget::get_zoom() { return zoom; } -void zoomer_widget::zoom_changed(double z) +void ZoomWidget::zoom_changed(double z) { zoom = z; zoom_f->setText(QString("x")); //+QString::number(zoom,'g',4)); @@ -4136,7 +4134,7 @@ void zoomer_widget::zoom_changed(double z) emit set_zoom(zoom); } -void zoomer_widget::zoomin_pushed() +void ZoomWidget::zoomin_pushed() { zoom = 2 * zoom; zoom_f->setText(QString("x")); //+QString::number(zoom,'g',4)); @@ -4144,7 +4142,7 @@ void zoomer_widget::zoomin_pushed() emit set_zoom(zoom); } -void zoomer_widget::zoomout_pushed() +void ZoomWidget::zoomout_pushed() { zoom = 0.5 * zoom; zoom_f->setText(QString("x")); //+QString::number(zoom,'g',4)); @@ -4152,7 +4150,7 @@ void zoomer_widget::zoomout_pushed() emit set_zoom(zoom); } -void zoomer_widget::unzoom_pushed() +void ZoomWidget::unzoom_pushed() { zoom = 1.0; zoom_f->setText(QString("x")); //+QString::number(zoom,'g',4)); @@ -4160,7 +4158,7 @@ void zoomer_widget::unzoom_pushed() emit set_zoom(zoom); } -void zoomer_widget::le_zoom_changed() +void ZoomWidget::le_zoom_changed() { bool b1; float zoom1 = le_zoom_f->text().toFloat(&b1); @@ -4200,10 +4198,10 @@ QSize QHBoxLayout_fixedheight::maximumSize() const //-------------------------------------------------- -ImageMath::ImageMath(SlicesHandler* hand3D, QWidget* parent, const char* name, - Qt::WindowFlags wFlags) - // : QWidget( parent, name, wFlags ),handler3D(hand3D) - : QDialog(parent, name, TRUE, wFlags), handler3D(hand3D) +ImageMath::ImageMath(SlicesHandler *hand3D, QWidget *parent, const char *name, + Qt::WindowFlags wFlags) + // : QWidget( parent, name, wFlags ),handler3D(hand3D) + : QDialog(parent, name, TRUE, wFlags), handler3D(hand3D) { activeslice = handler3D->get_activeslice(); bmphand = handler3D->get_activebmphandler(); @@ -4256,9 +4254,9 @@ ImageMath::ImageMath(SlicesHandler* hand3D, QWidget* parent, const char* name, QObject::connect(doMult, SIGNAL(clicked()), this, SLOT(mult_pushed())); QObject::connect(doNeg, SIGNAL(clicked()), this, SLOT(neg_pushed())); QObject::connect(imgorval, SIGNAL(buttonClicked(int)), this, - SLOT(imgorval_changed(int))); + SLOT(imgorval_changed(int))); QObject::connect(le_val, SIGNAL(editingFinished()), this, - SLOT(value_changed())); + SLOT(value_changed())); return; } @@ -4417,7 +4415,7 @@ void ImageMath::slicenr_changed() bmphand_changed(handler3D->get_activebmphandler()); } -void ImageMath::bmphand_changed(bmphandler* bmph) +void ImageMath::bmphand_changed(bmphandler *bmph) { bmphand = bmph; return; @@ -4442,14 +4440,14 @@ void ImageMath::value_changed() //-------------------------------------------------- -ImageOverlay::ImageOverlay(SlicesHandler* hand3D, QWidget* parent, - const char* name, Qt::WindowFlags wFlags) - // : QWidget( parent, name, wFlags ),handler3D(hand3D) - : QDialog(parent, name, TRUE, wFlags), handler3D(hand3D) +ImageOverlay::ImageOverlay(SlicesHandler *hand3D, QWidget *parent, + const char *name, Qt::WindowFlags wFlags) + // : QWidget( parent, name, wFlags ),handler3D(hand3D) + : QDialog(parent, name, TRUE, wFlags), handler3D(hand3D) { activeslice = handler3D->get_activeslice(); bmphand = handler3D->get_activebmphandler(); - bkpWork = (float*)malloc(sizeof(float) * bmphand->return_area()); + bkpWork = (float *)malloc(sizeof(float) * bmphand->return_area()); bmphand->copyfromwork(bkpWork); alpha = 0.0f; @@ -4498,11 +4496,11 @@ ImageOverlay::ImageOverlay(SlicesHandler* hand3D, QWidget* parent, QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); QObject::connect(applyButton, SIGNAL(clicked()), this, - SLOT(apply_pushed())); + SLOT(apply_pushed())); QObject::connect(leAlpha, SIGNAL(editingFinished()), this, - SLOT(alpha_changed())); + SLOT(alpha_changed())); QObject::connect(slAlpha, SIGNAL(sliderMoved(int)), this, - SLOT(slider_changed(int))); + SLOT(slider_changed(int))); return; } @@ -4513,7 +4511,7 @@ ImageOverlay::~ImageOverlay() free(bkpWork); } -void ImageOverlay::closeEvent(QCloseEvent* e) +void ImageOverlay::closeEvent(QCloseEvent *e) { QDialog::closeEvent(e); @@ -4567,7 +4565,7 @@ void ImageOverlay::slicenr_changed() bmphand_changed(handler3D->get_activebmphandler()); } -void ImageOverlay::bmphand_changed(bmphandler* bmph) +void ImageOverlay::bmphand_changed(bmphandler *bmph) { bmphand = bmph; bmphand->copyfromwork(bkpWork); @@ -4577,8 +4575,8 @@ void ImageOverlay::bmphand_changed(bmphandler* bmph) void ImageOverlay::newloaded() { free(bkpWork); - bkpWork = (float*)malloc(sizeof(float) * - handler3D->get_activebmphandler()->return_area()); + bkpWork = (float *)malloc(sizeof(float) * + handler3D->get_activebmphandler()->return_area()); } void ImageOverlay::alpha_changed() @@ -4634,8 +4632,8 @@ void ImageOverlay::slider_changed(int newval) emit end_datachange(this, iseg::NoUndo); } -CleanerParams::CleanerParams(int* rate1, int* minsize1, QWidget* parent, - const char* name, Qt::WindowFlags wFlags) +CleanerParams::CleanerParams(int *rate1, int *minsize1, QWidget *parent, + const char *name, Qt::WindowFlags wFlags) { rate = rate1; minsize = minsize1; @@ -4652,7 +4650,7 @@ CleanerParams::CleanerParams(int* rate1, int* minsize1, QWidget* parent, pb_dontdoit = new QPushButton("Cancel", vbox2); QObject::connect(pb_doit, SIGNAL(clicked()), this, SLOT(doit_pressed())); QObject::connect(pb_dontdoit, SIGNAL(clicked()), this, - SLOT(dontdoit_pressed())); + SLOT(dontdoit_pressed())); hbox1->setFixedSize(hbox1->sizeHint()); setFixedSize(hbox1->size()); @@ -4674,9 +4672,9 @@ void CleanerParams::dontdoit_pressed() close(); } -MergeProjectsDialog::MergeProjectsDialog(QWidget* parent, const char* name, - Qt::WindowFlags wFlags) - : QDialog(parent, name, TRUE, wFlags) +MergeProjectsDialog::MergeProjectsDialog(QWidget *parent, const char *name, + Qt::WindowFlags wFlags) + : QDialog(parent, name, TRUE, wFlags) { hboxOverall = new Q3HBoxLayout(this); vboxFileList = new Q3VBoxLayout(this); @@ -4717,11 +4715,11 @@ MergeProjectsDialog::MergeProjectsDialog(QWidget* parent, const char* name, QObject::connect(addButton, SIGNAL(clicked()), this, SLOT(add_pressed())); QObject::connect(removeButton, SIGNAL(clicked()), this, - SLOT(remove_pressed())); + SLOT(remove_pressed())); QObject::connect(moveUpButton, SIGNAL(clicked()), this, - SLOT(move_up_pressed())); + SLOT(move_up_pressed())); QObject::connect(moveDownButton, SIGNAL(clicked()), this, - SLOT(move_down_pressed())); + SLOT(move_down_pressed())); QObject::connect(executeButton, SIGNAL(clicked()), this, SLOT(accept())); QObject::connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject())); } @@ -4731,16 +4729,16 @@ MergeProjectsDialog::~MergeProjectsDialog() { delete hboxOverall; } void MergeProjectsDialog::add_pressed() { QStringList openfilenames = Q3FileDialog::getOpenFileNames( - "Projects (*.prj)", QString::null, this, "iSeg", - "Select one or more files to add"); + "Projects (*.prj)", QString::null, this, "iSeg", + "Select one or more files to add"); fileListWidget->addItems(openfilenames); } void MergeProjectsDialog::remove_pressed() { - QList removeItems = fileListWidget->selectedItems(); - for (QList::const_iterator iter = removeItems.begin(); - iter != removeItems.end(); ++iter) + QList removeItems = fileListWidget->selectedItems(); + for (QList::const_iterator iter = removeItems.begin(); + iter != removeItems.end(); ++iter) { delete fileListWidget->takeItem(fileListWidget->row(*iter)); } @@ -4748,7 +4746,7 @@ void MergeProjectsDialog::remove_pressed() void MergeProjectsDialog::move_up_pressed() { - QList moveItems = fileListWidget->selectedItems(); + QList moveItems = fileListWidget->selectedItems(); if (moveItems.size() <= 0) { return; @@ -4766,7 +4764,7 @@ void MergeProjectsDialog::move_up_pressed() void MergeProjectsDialog::move_down_pressed() { - QList moveItems = fileListWidget->selectedItems(); + QList moveItems = fileListWidget->selectedItems(); if (moveItems.size() <= 0) { return; @@ -4782,7 +4780,7 @@ void MergeProjectsDialog::move_down_pressed() fileListWidget->insertItem(rowFirst, fileListWidget->takeItem(rowLast + 1)); } -void MergeProjectsDialog::get_filenames(std::vector& filenames) +void MergeProjectsDialog::get_filenames(std::vector &filenames) { filenames.clear(); for (int row = 0; row < fileListWidget->count(); ++row) @@ -4792,9 +4790,9 @@ void MergeProjectsDialog::get_filenames(std::vector& filenames) } CheckBoneConnectivityDialog::CheckBoneConnectivityDialog( - SlicesHandler* hand3D, const char* name, QWidget* parent /*=0*/, - Qt::WindowFlags wFlags /*=0*/) - : QWidget(parent, name, wFlags), handler3D(hand3D) + SlicesHandler *hand3D, const char *name, QWidget *parent /*=0*/, + Qt::WindowFlags wFlags /*=0*/) + : QWidget(parent, name, wFlags), handler3D(hand3D) { mainBox = new Q3HBox(this); vbox1 = new Q3VBox(mainBox); @@ -4831,14 +4829,14 @@ CheckBoneConnectivityDialog::CheckBoneConnectivityDialog( QStringList tableHeader; tableHeader << "Bone 1" - << "Bone 2" - << "Slice #"; + << "Bone 2" + << "Slice #"; foundConnectionsTable->setHorizontalHeaderLabels(tableHeader); foundConnectionsTable->verticalHeader()->setVisible(false); foundConnectionsTable->setColumnWidth(BoneConnectionColumn::kTissue1, 160); foundConnectionsTable->setColumnWidth(BoneConnectionColumn::kTissue2, 160); foundConnectionsTable->setColumnWidth(BoneConnectionColumn::kSliceNumber, - 60); + 60); hbox1->show(); hbox2->show(); @@ -4849,13 +4847,13 @@ CheckBoneConnectivityDialog::CheckBoneConnectivityDialog( mainBox->show(); QObject::connect(executeButton, SIGNAL(clicked()), this, - SLOT(execute_pressed())); + SLOT(execute_pressed())); QObject::connect(cancelButton, SIGNAL(clicked()), this, - SLOT(cancel_pressed())); + SLOT(cancel_pressed())); QObject::connect(exportButton, SIGNAL(clicked()), this, - SLOT(export_pressed())); + SLOT(export_pressed())); QObject::connect(foundConnectionsTable, SIGNAL(cellClicked(int, int)), this, - SLOT(cellClicked(int, int))); + SLOT(cellClicked(int, int))); CheckBoneExist(); @@ -4864,12 +4862,12 @@ CheckBoneConnectivityDialog::CheckBoneConnectivityDialog( CheckBoneConnectivityDialog::~CheckBoneConnectivityDialog() {} -void CheckBoneConnectivityDialog::ShowText(const std::string& text) +void CheckBoneConnectivityDialog::ShowText(const std::string &text) { progressText->setText(QString::fromStdString(text)); } -bool CheckBoneConnectivityDialog::IsBone(const std::string& label_name) const +bool CheckBoneConnectivityDialog::IsBone(const std::string &label_name) const { std::string name = label_name; std::transform(name.begin(), name.end(), name.begin(), ::tolower); @@ -4904,7 +4902,7 @@ void CheckBoneConnectivityDialog::CheckBoneExist() tissues_size_t tissuecount = TissueInfos::GetTissueCount(); for (tissues_size_t i = 0; i <= tissuecount; i++) { - TissueInfoStruct* tissueInfo = TissueInfos::GetTissueInfo(i); + TissueInfoStruct *tissueInfo = TissueInfos::GetTissueInfo(i); if (IsBone(tissueInfo->name.toUtf8().constData())) { bonesFound++; @@ -4943,7 +4941,7 @@ void CheckBoneConnectivityDialog::LookForConnections() int numTasks = endSl - startSl; QProgressDialog progress("Looking for connected bones...", "Cancel", 0, - numTasks, mainBox); + numTasks, mainBox); progress.show(); progress.setWindowModality(Qt::WindowModal); progress.setModal(true); @@ -4953,13 +4951,13 @@ void CheckBoneConnectivityDialog::LookForConnections() tissues_size_t tissuecount = TissueInfos::GetTissueCount(); for (tissues_size_t i = 0; i <= tissuecount; i++) { - TissueInfoStruct* tissueInfo = TissueInfos::GetTissueInfo(i); + TissueInfoStruct *tissueInfo = TissueInfos::GetTissueInfo(i); label_names.push_back(tissueInfo->name.toUtf8().constData()); } std::vector same_bone_map(label_names.size(), -1); - auto replace = [](std::string& str, const std::string& from, - const std::string& to) { + auto replace = [](std::string &str, const std::string &from, + const std::string &to) { size_t start_pos = str.find(from); if (start_pos == std::string::npos) { @@ -4983,7 +4981,7 @@ void CheckBoneConnectivityDialog::LookForConnections() { std::string namei = label_names[idx]; std::transform(namei.begin(), namei.end(), namei.begin(), - ::tolower); + ::tolower); if (namei == name) { break; @@ -5002,7 +5000,7 @@ void CheckBoneConnectivityDialog::LookForConnections() for (int sliceN = startSl; sliceN < endSl - 1; sliceN++) { - tissues_size_t* tissuesMain = handler3D->return_tissues(0, sliceN); + tissues_size_t *tissuesMain = handler3D->return_tissues(0, sliceN); unsigned pos = 0; //for( int y=height-1; y>=0; y-- ) for (int y = height - 2; y >= 1; y--) @@ -5013,7 +5011,7 @@ void CheckBoneConnectivityDialog::LookForConnections() tissues_size_t tissue_value = tissuesMain[pos]; if (std::find(same_bone_map.begin(), same_bone_map.end(), - tissue_value) != same_bone_map.end()) + tissue_value) != same_bone_map.end()) { // check neighbour connection std::vector neighbour_tissues; @@ -5052,43 +5050,43 @@ void CheckBoneConnectivityDialog::LookForConnections() //+1 slice: if (sliceN + 1 < endSl) { - tissues_size_t* tissues_plus1 = - handler3D->return_tissues(0, sliceN + 1); + tissues_size_t *tissues_plus1 = + handler3D->return_tissues(0, sliceN + 1); neighbour_tissues.push_back( - tissues_plus1[pos - width - 1]); + tissues_plus1[pos - width - 1]); neighbour_tissues.push_back(tissues_plus1[pos - width]); neighbour_tissues.push_back( - tissues_plus1[pos - width + 1]); + tissues_plus1[pos - width + 1]); neighbour_tissues.push_back(tissues_plus1[pos - 1]); neighbour_tissues.push_back(tissues_plus1[pos]); neighbour_tissues.push_back(tissues_plus1[pos + 1]); neighbour_tissues.push_back( - tissues_plus1[pos + width - 1]); + tissues_plus1[pos + width - 1]); neighbour_tissues.push_back(tissues_plus1[pos + width]); neighbour_tissues.push_back( - tissues_plus1[pos + width + 1]); + tissues_plus1[pos + width + 1]); } //remove the same bone values std::sort(neighbour_tissues.begin(), - neighbour_tissues.end()); + neighbour_tissues.end()); neighbour_tissues.erase( - std::unique(neighbour_tissues.begin(), + std::unique(neighbour_tissues.begin(), neighbour_tissues.end()), - neighbour_tissues.end()); + neighbour_tissues.end()); neighbour_tissues.erase( - std::remove(neighbour_tissues.begin(), + std::remove(neighbour_tissues.begin(), neighbour_tissues.end(), tissue_value), - neighbour_tissues.end()); + neighbour_tissues.end()); for (size_t k = 0; k < neighbour_tissues.size(); k++) { if (std::find( - same_bone_map.begin(), same_bone_map.end(), - neighbour_tissues[k]) != same_bone_map.end()) + same_bone_map.begin(), same_bone_map.end(), + neighbour_tissues[k]) != same_bone_map.end()) { tissues_size_t tis1, tis2; if (tissue_value < neighbour_tissues[k]) @@ -5121,8 +5119,8 @@ void CheckBoneConnectivityDialog::LookForConnections() std::sort(foundConnections.begin(), foundConnections.end()); foundConnections.erase( - std::unique(foundConnections.begin(), foundConnections.end()), - foundConnections.end()); + std::unique(foundConnections.begin(), foundConnections.end()), + foundConnections.end()); } void CheckBoneConnectivityDialog::FillConnectionsTable() @@ -5139,18 +5137,18 @@ void CheckBoneConnectivityDialog::FillConnectionsTable() BoneConnectionInfo newLineInfo = foundConnections.at(i); - TissueInfoStruct* tissueInfo1 = - TissueInfos::GetTissueInfo(newLineInfo.TissueID1); - TissueInfoStruct* tissueInfo2 = - TissueInfos::GetTissueInfo(newLineInfo.TissueID2); + TissueInfoStruct *tissueInfo1 = + TissueInfos::GetTissueInfo(newLineInfo.TissueID1); + TissueInfoStruct *tissueInfo2 = + TissueInfos::GetTissueInfo(newLineInfo.TissueID2); foundConnectionsTable->setItem(row, BoneConnectionColumn::kTissue1, - new QTableWidgetItem(tissueInfo1->name)); + new QTableWidgetItem(tissueInfo1->name)); foundConnectionsTable->setItem(row, BoneConnectionColumn::kTissue2, - new QTableWidgetItem(tissueInfo2->name)); + new QTableWidgetItem(tissueInfo2->name)); foundConnectionsTable->setItem( - row, BoneConnectionColumn::kSliceNumber, - new QTableWidgetItem(QString::number(newLineInfo.SliceNumber + 1))); + row, BoneConnectionColumn::kSliceNumber, + new QTableWidgetItem(QString::number(newLineInfo.SliceNumber + 1))); } exportButton->setEnabled(foundConnections.size() > 0); @@ -5161,7 +5159,7 @@ void CheckBoneConnectivityDialog::cellClicked(int row, int col) if (row < foundConnectionsTable->rowCount()) { int sliceNumber = - foundConnectionsTable->item(row, kSliceNumber)->text().toInt() - 1; + foundConnectionsTable->item(row, kSliceNumber)->text().toInt() - 1; handler3D->set_activeslice(sliceNumber); emit slice_changed(); } @@ -5187,13 +5185,13 @@ void CheckBoneConnectivityDialog::export_pressed() for (unsigned int i = 0; i < foundConnections.size(); i++) { - TissueInfoStruct* tissueInfo1 = - TissueInfos::GetTissueInfo(foundConnections[i].TissueID1); - TissueInfoStruct* tissueInfo2 = - TissueInfos::GetTissueInfo(foundConnections[i].TissueID2); + TissueInfoStruct *tissueInfo1 = + TissueInfos::GetTissueInfo(foundConnections[i].TissueID1); + TissueInfoStruct *tissueInfo2 = + TissueInfos::GetTissueInfo(foundConnections[i].TissueID2); output_file << tissueInfo1->name.toStdString() << " " - << tissueInfo2->name.toStdString() << " " - << foundConnections[i].SliceNumber + 1 << endl; + << tissueInfo2->name.toStdString() << " " + << foundConnections[i].SliceNumber + 1 << endl; } output_file.close(); diff --git a/iSeg/WidgetCollection.h b/iSeg/WidgetCollection.h new file mode 100755 index 00000000..c2176254 --- /dev/null +++ b/iSeg/WidgetCollection.h @@ -0,0 +1,990 @@ +/* + * Copyright (c) 2018 The Foundation for Research on Information Technologies in Society (IT'IS). + * + * This file is part of iSEG + * (see https://github.com/ITISFoundation/osparc-iseg). + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ +#ifndef WIDGETCOLLECTION +#define WIDGETCOLLECTION + +#include "Interface/DataSelection.h" +#include "Interface/Point.h" + +#include "Core/Types.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +namespace iseg { + +class SlicesHandler; +class TissueHiearchy; +class TissueHierarchyItem; +class bmphandler; + +//class ScaleWork : public QWidget +class ScaleWork : public QDialog +{ + Q_OBJECT +public: + ScaleWork(SlicesHandler *hand3D, QDir picpath, QWidget *parent = 0, + const char *name = 0, Qt::WindowFlags wFlags = 0); + ~ScaleWork(); + +private: + bmphandler *bmphand; + SlicesHandler *handler3D; + unsigned short activeslice; + Q3HBox *hbox1; + Q3HBox *hbox2; + Q3HBox *hbox3; + Q3HBox *hbox4; + Q3VBox *vbox1; + QPushButton *getRange; + QPushButton *doScale; + QPushButton *doCrop; + QSlider *sl_brighness; + QSlider *sl_contrast; + QLineEdit *limitLow; + QLineEdit *limitHigh; + QLabel *lL; + QLabel *lH; + QLabel *lb_brightness; + QLabel *lb_contrast; + QCheckBox *allslices; + float minval, maxval; + float minval1, maxval1; + bool dontundo; + QPushButton *closeButton; + +signals: + void begin_datachange(iseg::DataSelection &dataSelection, + QWidget *sender = NULL, bool beginUndo = true); + void end_datachange(QWidget *sender = NULL, + iseg::EndUndoAction undoAction = iseg::EndUndo); + +public slots: + void slicenr_changed(); + +private slots: + void bmphand_changed(bmphandler *bmph); + void getrange_pushed(); + void scale_pushed(); + void crop_pushed(); + void slider_changed(int newval); + void slider_pressed(); + void slider_released(); +}; + +class ImageMath : public QDialog +{ + Q_OBJECT +public: + ImageMath(SlicesHandler *hand3D, QWidget *parent = 0, const char *name = 0, + Qt::WindowFlags wFlags = 0); + ~ImageMath(); + +private: + bmphandler *bmphand; + SlicesHandler *handler3D; + unsigned short activeslice; + Q3HBox *hbox1; + Q3HBox *hbox2; + Q3HBox *hbox3; + Q3VBox *vbox1; + QPushButton *doAdd; + QPushButton *doSub; + QPushButton *doMult; + QPushButton *doNeg; + QButtonGroup *imgorval; + QRadioButton *rb_img; + QRadioButton *rb_val; + float val; + QLineEdit *le_val; + QLabel *lb_val; + QCheckBox *allslices; + QPushButton *closeButton; + +signals: + void begin_datachange(iseg::DataSelection &dataSelection, + QWidget *sender = NULL, bool beginUndo = true); + void end_datachange(QWidget *sender = NULL, + iseg::EndUndoAction undoAction = iseg::EndUndo); + +public slots: + void slicenr_changed(); + +private slots: + void bmphand_changed(bmphandler *bmph); + void add_pushed(); + void sub_pushed(); + void mult_pushed(); + void neg_pushed(); + void value_changed(); + void imgorval_changed(int); +}; + +class ImageOverlay : public QDialog +{ + Q_OBJECT +public: + ImageOverlay(SlicesHandler *hand3D, QWidget *parent = 0, + const char *name = 0, Qt::WindowFlags wFlags = 0); + ~ImageOverlay(); + +protected: + virtual void closeEvent(QCloseEvent *e); + +private: + bmphandler *bmphand; + SlicesHandler *handler3D; + unsigned short activeslice; + Q3VBox *vbox1; + Q3HBox *hbox1; + Q3HBox *hbox2; + Q3HBox *hbox3; + QLabel *lbAlpha; + QSlider *slAlpha; + QLineEdit *leAlpha; + QCheckBox *allslices; + QPushButton *closeButton; + QPushButton *applyButton; + float alpha; + int sliderMax; + unsigned short sliderPrecision; + float *bkpWork; + +signals: + void begin_datachange(iseg::DataSelection &dataSelection, + QWidget *sender = NULL, bool beginUndo = true); + void end_datachange(QWidget *sender = NULL, + iseg::EndUndoAction undoAction = iseg::EndUndo); + +public slots: + void newloaded(); + void slicenr_changed(); + +private slots: + void bmphand_changed(bmphandler *bmph); + void apply_pushed(); + void alpha_changed(); + void slider_changed(int newval); +}; + +class HistoWin : public QWidget +{ + Q_OBJECT +public: + HistoWin(unsigned int *histo1, QWidget *parent = 0, const char *name = 0, + Qt::WindowFlags wFlags = 0); + void update(); + void histo_changed(unsigned int *histo1); + +protected: + void paintEvent(QPaintEvent *e); + +private: + QImage image; + unsigned int *histo; +}; + +class ShowHisto : public QDialog +{ + Q_OBJECT +public: + ShowHisto(SlicesHandler *hand3D, QWidget *parent = 0, const char *name = 0, + Qt::WindowFlags wFlags = 0); + ~ShowHisto(); + +private: + bmphandler *bmphand; + SlicesHandler *handler3D; + unsigned short activeslice; + Q3HBox *hbox1; + Q3HBox *hbox2; + Q3HBox *hbox3; + Q3HBox *hbox4; + HistoWin *histwindow; + Q3VBox *vbox1; + Q3VBox *vbox2; + QPushButton *closeButton; + QPushButton *updateSubsect; + QSpinBox *xoffset; + QSpinBox *yoffset; + QSpinBox *xlength; + QSpinBox *ylength; + QCheckBox *subsect; + QLabel *xoffs; + QLabel *yoffs; + QLabel *xl; + QLabel *yl; + QButtonGroup *pictselect; + QRadioButton *workpict; + QRadioButton *bmppict; + +public slots: + void slicenr_changed(); + void newloaded(); + +private slots: + void bmphand_changed(bmphandler *bmph); + void draw_histo(); + void subsect_toggled(); + void pict_toggled(bool on); + void subsect_update(); +}; + +class colorshower : public QWidget +{ + Q_OBJECT +public: + colorshower(int lx1, int ly1, QWidget *parent = 0, const char *name = 0, + Qt::WindowFlags wFlags = 0); + +protected: + void paintEvent(QPaintEvent *e); + +private: + int lx; + int ly; + float fr; + float fg; + float fb; + float opac; + +private slots: + void color_changed(float fr1, float fg1, float fb1, float opac1); +}; + +class TissueTreeWidget : public QTreeWidget +{ + Q_OBJECT +public: + TissueTreeWidget(TissueHiearchy *hierarchy, QDir picpath, + QWidget *parent = 0); + ~TissueTreeWidget(); + +public: + void initialize(); + + void set_tissue_filter(const QString &filter); + void update_visibility(); + void update_visibility_recursive(QTreeWidgetItem *item); + + // Add tree items + void insert_item(bool isFolder, const QString &name); + + // Delete tree items + void remove_tissue(const QString &name); + void remove_current_item(bool removeChildren = false); + void remove_all_folders(bool removeChildren = false); + + // Update items + void update_tissue_name(const QString &oldName, const QString &newName); + void update_tissue_icons(QTreeWidgetItem *parent = 0); + void update_folder_icons(QTreeWidgetItem *parent = 0); + void set_current_folder_name(const QString &name); + + // Current item + void set_current_item(QTreeWidgetItem *item); + void set_current_tissue(tissues_size_t type); + bool get_current_is_folder(); + tissues_size_t get_current_type(); + QString get_current_name(); + bool get_current_has_children(); + void get_current_child_tissues( + std::map &types); + + // Hierarchy + void + update_tree_widget(); // Updates QTreeWidget from internal representation + void update_hierarchy(); // Updates internal representation from QTreeWidget + unsigned short get_selected_hierarchy(); + unsigned short get_hierarchy_count(); + std::vector *get_hierarchy_names_ptr(); + QString get_current_hierarchy_name(); + void reset_default_hierarchy(); + void set_hierarchy(unsigned short index); + void add_new_hierarchy(const QString &name); + void remove_current_hierarchy(); + bool get_hierarchy_modified(); + void set_hierarchy_modified(bool val); + unsigned short get_tissue_instance_count(tissues_size_t type); + void get_sublevel_child_tissues( + std::map &types); + + // File IO + FILE *SaveParams(FILE *fp, int version); + FILE *LoadParams(FILE *fp, int version); + bool load_hierarchy(const QString &path); + bool save_hierarchy_as(const QString &name, const QString &path); + + // Display + bool get_tissue_indices_hidden(); + + QList get_all_items(); + +public slots: + void toggle_show_tissue_indices(); + void sort_by_tissue_name(); + void sort_by_tissue_index(); + tissues_size_t get_type(QTreeWidgetItem *item); + QString get_name(QTreeWidgetItem *item); + +protected: + // Drag & drop + void dropEvent(QDropEvent *de); + +private: + void resize_columns_to_contents(); + bool get_is_folder(QTreeWidgetItem *item); + + QTreeWidgetItem *find_tissue_item(tissues_size_t type, + QTreeWidgetItem *parent = 0); + void take_children_recursively(QTreeWidgetItem *parent, + QList &appendTo); + void get_child_tissues_recursively( + QTreeWidgetItem *parent, + std::map &types); + unsigned short + get_tissue_instance_count_recursively(QTreeWidgetItem *parent, + tissues_size_t type); + void insert_item(bool isFolder, const QString &name, + QTreeWidgetItem *insertAbove); + void insert_item(bool isFolder, const QString &name, + QTreeWidgetItem *parent, unsigned int index); + void remove_tissue_recursively(QTreeWidgetItem *parent, + const QString &name); + void update_tissue_name_widget(const QString &oldName, + const QString &newName, + QTreeWidgetItem *parent = 0); + short get_child_lockstates(QTreeWidgetItem *folder); + void pad_tissue_indices(); + void pad_tissue_indices_recursively(QTreeWidgetItem *parent, + unsigned short digits); + void update_tissue_indices(); + void update_tissue_indices_recursively(QTreeWidgetItem *parent); + + // Convert QTreeWidget to internal representation + TissueHierarchyItem *create_current_hierarchy(); + void create_hierarchy_recursively(QTreeWidgetItem *parentIn, + TissueHierarchyItem *parentOut); + TissueHierarchyItem *create_hierarchy_item(QTreeWidgetItem *item); + + // Convert internal representation to QTreeWidget + void build_tree_widget(TissueHierarchyItem *root); + void build_tree_widget_recursively(TissueHierarchyItem *parentIn, + QTreeWidgetItem *parentOut, + std::set *tissueTypes); + QTreeWidgetItem *create_hierarchy_item(bool isFolder, const QString &name); + + // SaveParams + FILE *save_hierarchy(FILE *fp, unsigned short idx); + FILE *load_hierarchy(FILE *fp); + +private: + TissueHiearchy *hierarchies; + std::string tissue_filter; + QDir picturePath; + bool modified; + bool sortByNameAscending; + bool sortByTypeAscending; + +signals: + void hierarchy_list_changed(void); + +private slots: + void resize_columns_to_contents(QTreeWidgetItem *item); +}; + +class TissueAdder : public QDialog +{ + Q_OBJECT +public: + TissueAdder(bool modifyTissue, TissueTreeWidget *tissueTree, + QWidget *parent = 0, const char *name = 0, + Qt::WindowFlags wFlags = 0); + ~TissueAdder(); + // FILE *save_proj(FILE *fp); + +private: + bool modify; + + Q3HBoxLayout *hbox1; + Q3HBoxLayout *hbox2; + Q3HBoxLayout *hbox3; + /* QHBoxLayout *hboxr; + QHBoxLayout *hboxg; + QHBoxLayout *hboxb;*/ + colorshower *cs; + Q3VBoxLayout *vbox1; + Q3VBoxLayout *vbox2; + Q3VBoxLayout *vbox3; + Q3VBoxLayout *vbox4; + QPushButton *closeButton; + // QPushButton *colorButton; + QPushButton *addTissue; + QLabel *red; + QLabel *green; + QLabel *blue; + QLabel *opac; + QLabel *tissuename; + QLineEdit *nameField; + QSlider *r; + QSlider *g; + QSlider *b; + QSlider *sl_transp; + QSpinBox *sb_r; + QSpinBox *sb_g; + QSpinBox *sb_b; + QSpinBox *sb_transp; + float fr1; + float fg1; + float fb1; + float transp1; + TissueTreeWidget *tissueTreeWidget; + // float **tc; + +signals: + void color_changed(float fr, float fg, float fb, float opac2); + +private slots: + void update_color_r(int v); + void update_color_g(int v); + void update_color_b(int v); + void update_opac(int v); + void update_color_rsb(int v); + void update_color_gsb(int v); + void update_color_bsb(int v); + void update_opacsb(int v); + void add_pressed(); +}; + +class TissueFolderAdder : public QDialog +{ + Q_OBJECT +public: + TissueFolderAdder(TissueTreeWidget *tissueTree, QWidget *parent = 0, + const char *name = 0, Qt::WindowFlags wFlags = 0); + ~TissueFolderAdder(); + +private: + Q3HBoxLayout *hboxOverall; + Q3VBoxLayout *vboxOverall; + Q3HBoxLayout *hboxFolderName; + Q3HBoxLayout *hboxPushButtons; + QLabel *nameLabel; + QLineEdit *nameLineEdit; + QPushButton *addButton; + QPushButton *closeButton; + TissueTreeWidget *tissueTreeWidget; + +private slots: + void add_pressed(); +}; + +class TissueHierarchyWidget : public QWidget +{ + Q_OBJECT +public: + TissueHierarchyWidget(TissueTreeWidget *tissueTree, QWidget *parent = 0, + Qt::WindowFlags wFlags = 0); + ~TissueHierarchyWidget(); + + bool handle_changed_hierarchy(); + +private: + QDir picturePath; + Q3HBoxLayout *hboxOverall; + Q3VBoxLayout *vboxOverall; + Q3VBoxLayout *vboxHierarchyButtons; + QComboBox *hierarchyComboBox; + QPushButton *newHierarchyButton; + QPushButton *loadHierarchyButton; + QPushButton *saveHierarchyAsButton; + QPushButton *removeHierarchyButton; + TissueTreeWidget *tissueTreeWidget; + +public slots: + void update_hierarchy_combo_box(); + bool save_hierarchy_as_pressed(); + +private slots: + void hierarchy_changed(int index); + void new_hierarchy_pressed(); + void load_hierarchy_pressed(); + void remove_hierarchy_pressed(); +}; + +class bits_stack : public QWidget +{ + Q_OBJECT +public: + bits_stack(SlicesHandler *hand3D, QWidget *parent = 0, const char *name = 0, + Qt::WindowFlags wFlags = 0); + ~bits_stack(); + QMap *return_bitsnr(); + void newloaded(); + FILE *save_proj(FILE *fp); + FILE *load_proj(FILE *fp); + void clear_stack(); + +protected: + void push_helper(bool source, bool target, bool tissue); + void pop_helper(bool source, bool target, bool tissue); + +private: + unsigned short oldw, oldh; + SlicesHandler *handler3D; + QListWidget *bits_names; + Q3HBoxLayout *hbox1; + Q3VBoxLayout *vbox1; + QPushButton *pushwork; + QPushButton *pushbmp; + QPushButton *pushtissue; + QPushButton *popwork; + QPushButton *popbmp; + QPushButton *loaditem; + QPushButton *saveitem; + QPushButton *poptissue; + QPushButton *deletebtn; + QMap bits_nr; + tissues_size_t tissuenr; + +signals: + void stack_changed(); + void begin_datachange(iseg::DataSelection &dataSelection, + QWidget *sender = NULL, bool beginUndo = true); + void end_datachange(QWidget *sender = NULL, + iseg::EndUndoAction undoAction = iseg::EndUndo); + void begin_dataexport(iseg::DataSelection &dataSelection, + QWidget *sender = NULL); + void end_dataexport(QWidget *sender = NULL); + +public slots: + void tissuenr_changed(unsigned short i); + +private slots: + void pushwork_pressed(); + void pushbmp_pressed(); + void pushtissue_pressed(); + void popwork_pressed(); + void popbmp_pressed(); + void poptissue_pressed(); + void saveitem_pressed(); + void loaditem_pressed(); + void delete_pressed(); +}; + +class bits_stack_pushdialog : public QDialog +{ + Q_OBJECT +public: + bits_stack_pushdialog(QWidget *parent = 0, const char *name = 0, + Qt::WindowFlags wFlags = 0); + ~bits_stack_pushdialog(); + bool get_pushcurrentslice(); + unsigned int get_startslice(bool *ok); + unsigned int get_endslice(bool *ok); + +private: + Q3VBox *vboxoverall; + Q3HBox *hboxparams; + Q3VBox *vboxsliceselection; + Q3VBox *vboxdelimiter; + Q3HBox *hboxslicerange; + Q3VBox *vboxslicerangelabels; + Q3VBox *vboxslicerangelineedits; + Q3HBox *hboxpushbuttons; + QRadioButton *rb_currentslice; + QRadioButton *rb_multislices; + QButtonGroup *slicegroup; + QLabel *lb_startslice; + QLabel *lb_endslice; + QLineEdit *le_startslice; + QLineEdit *le_endslice; + QPushButton *pushexec; + QPushButton *pushcancel; + +private slots: + void sliceselection_changed(); +}; + +class extoverlay_widget : public QWidget +{ + Q_OBJECT +public: + extoverlay_widget(SlicesHandler *hand3D, QWidget *parent = 0, + const char *name = 0, Qt::WindowFlags wFlags = 0); + ~extoverlay_widget(); + void newloaded(); + +private: + bmphandler *bmphand; + SlicesHandler *handler3D; + unsigned short activeslice; + + unsigned short selectedDataset; + std::vector datasetNames; + std::vector datasetFilepaths; + + float alpha; + int sliderMax; + unsigned short sliderPrecision; + + Q3HBoxLayout *hboxOverall; + Q3VBoxLayout *vboxOverall; + Q3HBoxLayout *hboxAlpha; + Q3HBoxLayout *hboxDisplaySrcTgt; + QComboBox *datasetComboBox; + QPushButton *loadDatasetButton; + QLabel *lbAlpha; + QSlider *slAlpha; + QLineEdit *leAlpha; + QCheckBox *srcCheckBox; + QCheckBox *tgtCheckBox; + +protected: + void initialize(); + void add_dataset(const QString &path); + void remove_dataset(unsigned short idx); + void reload_overlay(); + +signals: + void overlay_changed(); + void overlayalpha_changed(float newValue); + void bmpoverlayvisible_changed(bool newValue); + void workoverlayvisible_changed(bool newValue); + +public slots: + void slicenr_changed(); + +private slots: + void dataset_changed(int index); + void load_dataset_pressed(); + void alpha_changed(); + void slider_changed(int newval); + void source_toggled(); + void target_toggled(); +}; + +class MultiDataset_widget : public QWidget +{ + Q_OBJECT + +public: + struct SDatasetInfo + { + QRadioButton *m_RadioButton; + QString m_RadioButtonText; + QStringList m_DatasetFilepath; + unsigned m_Width; + unsigned m_Height; + std::vector m_BmpSlices; + std::vector m_WorkSlices; + bool m_IsActive; + }; + + enum DatasetTypeEnum { + DCM, + BMP, + PNG, + RAW, + MHD, + AVW, + VTK, + XDMF, + NIFTI, + RTDOSE + }; + + MultiDataset_widget(SlicesHandler *hand3D, QWidget *parent = 0, + const char *name = 0, Qt::WindowFlags wFlags = 0); + ~MultiDataset_widget(); + void NewLoaded(); + int GetNumberOfDatasets(); + bool IsActive(const int multiDS_index); + bool IsChecked(const int multiDS_index); + + std::vector GetBmpData(const int multiDS_index); + void SetBmpData(const int multiDS_index, std::vector bmp_bits_vc); + + std::vector GetWorkingData(const int multiDS_index); + void SetWorkingData(const int multiDS_index, + std::vector work_bits_vc); + +protected: + void Initialize(); + void InitializeMap(); + void ClearRadioButtons(); + + bool + CheckInfoAndAddToList(MultiDataset_widget::SDatasetInfo &newRadioButton, + QStringList loadfilenames, unsigned short width, + unsigned short height, unsigned short nrofslices); + bool AddDatasetToList(MultiDataset_widget::SDatasetInfo &newRadioButton, + QStringList loadfilenames); + void CopyImagesSlices(SlicesHandler *handler3D, + MultiDataset_widget::SDatasetInfo &newRadioButton, + const bool saveOnlyWorkingBits = false); + +signals: + void begin_datachange(iseg::DataSelection &dataSelection, + QWidget *sender = NULL, bool beginUndo = true); + void end_datachange(QWidget *sender = NULL, + iseg::EndUndoAction undoAction = iseg::EndUndo); + void dataset_changed(); + +private slots: + void AddDatasetPressed(); + void SwitchDataset(); + void ChangeDatasetName(); + void RemoveDataset(); + void DatasetSelectionChanged(); + +private: + SlicesHandler *m_Handler3D; + std::vector m_RadioButtons; + + Q3HBoxLayout *hboxOverall; + Q3VBoxLayout *vboxOverall; + Q3VBoxLayout *m_VboxOverall; + Q3VBoxLayout *m_VboxDatasets; + QGroupBox *m_DatasetsGroupBox; + QPushButton *m_AddDatasetButton; + QPushButton *m_LoadDatasetButton; + QPushButton *m_ChangeNameButton; + QPushButton *m_RemoveDatasetButton; + + bool m_ItIsBeingLoaded; + std::map m_MapDatasetValues; +}; + +class ZoomWidget : public QWidget +{ + Q_OBJECT +public: + ZoomWidget(double zoom1, QDir picpath, QWidget *parent = 0, + const char *name = 0, Qt::WindowFlags wFlags = 0); + ~ZoomWidget(); + double get_zoom(); + +public slots: + void zoom_changed(double); + +private: + double zoom; + Q3VBoxLayout *vbox1; + Q3HBoxLayout *hbox1; + QPushButton *pushzoomin; + QPushButton *pushzoomout; + QPushButton *pushunzoom; + QLineEdit *le_zoom_f; + QLabel *zoom_f; + +signals: + void zoom_in(); + void zoom_out(); + void unzoom(); + void set_zoom(double); + +private slots: + // void zoom_changed(double); + void zoomin_pushed(); + void zoomout_pushed(); + void unzoom_pushed(); + void le_zoom_changed(); +}; + +class CleanerParams : public QDialog +{ + Q_OBJECT +public: + CleanerParams(int *rate1, int *minsize1, QWidget *parent = 0, + const char *name = 0, Qt::WindowFlags wFlags = 0); + ~CleanerParams(); + +private: + int *rate; + int *minsize; + Q3HBox *hbox1; + Q3VBox *vbox1; + Q3VBox *vbox2; + QPushButton *pb_doit; + QPushButton *pb_dontdoit; + QLabel *lb_rate; + QLabel *lb_minsize; + QSpinBox *sb_rate; + QSpinBox *sb_minsize; + +private slots: + void doit_pressed(); + void dontdoit_pressed(); +}; + +class MergeProjectsDialog : public QDialog +{ + Q_OBJECT +public: + MergeProjectsDialog(QWidget *parent = 0, const char *name = 0, + Qt::WindowFlags wFlags = 0); + ~MergeProjectsDialog(); + + void get_filenames(std::vector &filenames); + +private: + Q3HBoxLayout *hboxOverall; + Q3VBoxLayout *vboxFileList; + Q3VBoxLayout *vboxButtons; + Q3VBoxLayout *vboxEditButtons; + Q3VBoxLayout *vboxExecuteButtons; + QListWidget *fileListWidget; + QPushButton *addButton; + QPushButton *removeButton; + QPushButton *moveUpButton; + QPushButton *moveDownButton; + QPushButton *executeButton; + QPushButton *cancelButton; + +private slots: + void add_pressed(); + void remove_pressed(); + void move_up_pressed(); + void move_down_pressed(); +}; + +class CheckBoneConnectivityDialog : public QWidget +{ + Q_OBJECT + + enum BoneConnectionColumn { + kTissue1, + kTissue2, + kSliceNumber, + kColumnNumber + }; + + struct BoneConnectionInfo + { + BoneConnectionInfo(const tissues_size_t tis1, const tissues_size_t tis2, + const int slice) + : TissueID1(tis1), TissueID2(tis2), SliceNumber(slice) + { + } + + tissues_size_t TissueID1; + tissues_size_t TissueID2; + int SliceNumber; + + bool operator<(const BoneConnectionInfo &a) const + { + if (SliceNumber < a.SliceNumber) + { + return true; + } + else if (SliceNumber > a.SliceNumber) + { + return false; + } + else + { + return TissueID1 < a.TissueID1; + } + } + + bool operator==(const BoneConnectionInfo &a) const + { + return (SliceNumber == a.SliceNumber && + ((TissueID1 == a.TissueID1 && TissueID2 == a.TissueID2) || + (TissueID1 == a.TissueID2 && TissueID2 == a.TissueID1))); + } + }; + +public: + CheckBoneConnectivityDialog(SlicesHandler *hand3D, const char *name, + QWidget *parent = 0, + Qt::WindowFlags wFlags = 0); + ~CheckBoneConnectivityDialog(); + +signals: + void slice_changed(); + +private: + void ShowText(const std::string &text); + void CheckBoneExist(); + void LookForConnections(); + void FillConnectionsTable(); + + bool IsBone(const std::string &label_name) const; + +private: + SlicesHandler *handler3D; + + Q3HBox *mainBox; + Q3VBox *vbox1; + Q3HBox *hbox1; + Q3HBox *hbox2; + Q3HBox *hbox3; + Q3HBox *hbox4; + + QCheckBox *bonesFoundCB; + + QPushButton *executeButton; + QPushButton *cancelButton; + QPushButton *exportButton; + + QTableWidget *foundConnectionsTable; + + QLabel *progressText; + + std::vector foundConnections; + + Q3HBoxLayout *hboxOverall; + Q3VBoxLayout *vboxFileList; + Q3VBoxLayout *vboxButtons; + Q3VBoxLayout *vboxEditButtons; + Q3VBoxLayout *vboxExecuteButtons; + QListWidget *fileListWidget; + +private slots: + void cellClicked(int row, int col); + void execute_pressed(); + void cancel_pressed(); + void export_pressed(); +}; + +} // namespace iseg + +#endif diff --git a/iSeg/world.cpp b/iSeg/World.cpp similarity index 100% rename from iSeg/world.cpp rename to iSeg/World.cpp diff --git a/iSeg/world.h b/iSeg/World.h similarity index 100% rename from iSeg/world.h rename to iSeg/World.h diff --git a/iSeg/bmpshower.cpp b/iSeg/bmpshower.cpp index 0dde63fc..020c0230 100755 --- a/iSeg/bmpshower.cpp +++ b/iSeg/bmpshower.cpp @@ -14,8 +14,9 @@ #include "bmpshower.h" #include "TissueInfos.h" +#include "Interface/Point.h" + #include "Core/ColorLookupTable.h" -#include "Core/Point.h" #include #include diff --git a/iSeg/bmpshower.h b/iSeg/bmpshower.h index 607aa19c..a782853a 100755 --- a/iSeg/bmpshower.h +++ b/iSeg/bmpshower.h @@ -12,20 +12,18 @@ #include "Core/Mark.h" #include "Core/Pair.h" -#include "Core/Point.h" #include "Core/Types.h" #include #include #include -#include // BL TODO +#include #include #include #include #include #include #include -//Added by qt3to4: #include #include #include diff --git a/iSeg/main.cpp b/iSeg/main.cpp index 21cc0bee..b094f767 100755 --- a/iSeg/main.cpp +++ b/iSeg/main.cpp @@ -20,7 +20,6 @@ #include "Core/BranchItem.h" #include "Core/Log.h" #include "Core/Pair.h" -#include "Core/Point.h" #include #include @@ -55,25 +54,25 @@ namespace { class vtkCustomOutputWindow : public vtkOutputWindow { public: - static vtkCustomOutputWindow* New(); + static vtkCustomOutputWindow *New(); vtkTypeMacro(vtkCustomOutputWindow, vtkOutputWindow); - virtual void PrintSelf(ostream& os, vtkIndent indent) {} + virtual void PrintSelf(ostream &os, vtkIndent indent) {} // Put the text into the output stream. - virtual void DisplayText(const char* msg) { std::cerr << msg << std::endl; } + virtual void DisplayText(const char *msg) { std::cerr << msg << std::endl; } protected: vtkCustomOutputWindow() {} private: - vtkCustomOutputWindow(const vtkCustomOutputWindow&); // Not implemented. - void operator=(const vtkCustomOutputWindow&); // Not implemented. + vtkCustomOutputWindow(const vtkCustomOutputWindow &); // Not implemented. + void operator=(const vtkCustomOutputWindow &); // Not implemented. }; vtkStandardNewMacro(vtkCustomOutputWindow); } // namespace -int main(int argc, char** argv) +int main(int argc, char **argv) { auto eow = vtkCustomOutputWindow::New(); eow->SetInstance(eow); @@ -159,7 +158,7 @@ int main(int argc, char** argv) palette.setColor(QPalette::ButtonText, QColor(255, 255, 255)); palette.setColor(QPalette::ToolTipText, QColor(0, 0, 0)); qApp->setPalette(palette); - app.setPalette(palette); + app.setPalette(palette); #ifdef SHOWSPLASH QString pixmapstr = QString(splashpicpath.toAscii().data()); @@ -171,24 +170,24 @@ int main(int argc, char** argv) #endif app.processEvents(); - MainWindow* mainWindow = NULL; + MainWindow *mainWindow = NULL; if (argc > 1) { QString qstr(argv[1]); if (qstr.compare(QString("S4Llink")) == 0) { mainWindow = new MainWindow( - &slice_handler, locationpath, picpath, tmpdir, - true, nullptr, "MainWindow", - Qt::WDestructiveClose | Qt::WResizeNoErase, argv); + &slice_handler, locationpath, picpath, tmpdir, + true, nullptr, "MainWindow", + Qt::WDestructiveClose | Qt::WResizeNoErase, argv); } } if (mainWindow == nullptr) { mainWindow = new MainWindow( - &slice_handler, locationpath, picpath, tmpdir, - false, nullptr, "MainWindow", - Qt::WDestructiveClose | Qt::WResizeNoErase, argv); + &slice_handler, locationpath, picpath, tmpdir, + false, nullptr, "MainWindow", + Qt::WDestructiveClose | Qt::WResizeNoErase, argv); } // needed on MacOS, but not WIN32? @@ -211,7 +210,7 @@ int main(int argc, char** argv) } #ifdef SHOWSPLASH - while (now.msecsTo(QTime::currentTime()) < 2000) + while (now.msecsTo(QTime::currentTime()) < 1000) { } #endif @@ -219,6 +218,10 @@ int main(int argc, char** argv) mainWindow->showMaximized(); mainWindow->show(); +#ifdef SHOWSPLASH + splash_screen.finish(mainWindow); +#endif + QObject::connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit())); return app.exec(); diff --git a/iSeg/measurementwidget.h b/iSeg/measurementwidget.h deleted file mode 100755 index 2bc2f9ae..00000000 --- a/iSeg/measurementwidget.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2018 The Foundation for Research on Information Technologies in Society (IT'IS). - * - * This file is part of iSEG - * (see https://github.com/ITISFoundation/osparc-iseg). - * - * This software is released under the MIT License. - * https://opensource.org/licenses/MIT - */ -#ifndef MEASUREWIDGET_12DEZ07 -#define MEASUREWIDGET_12DEZ07 - -#include "SlicesHandler.h" -#include "bmp_read_1.h" - -#include "Plugin/WidgetInterface.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace iseg { - -class MeasurementWidget : public WidgetInterface -{ - Q_OBJECT -public: - MeasurementWidget(SlicesHandler* hand3D, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0); - ~MeasurementWidget(); - FILE* SaveParams(FILE* fp, int version); - FILE* LoadParams(FILE* fp, int version); - QSize sizeHint() const; - void init(); - void cleanup(); - void newloaded(); - void getlabels(); - float calculate(); - float calculatevec(unsigned short orient); - std::string GetName() { return std::string("Measurement"); }; - virtual QIcon GetIcon(QDir picdir) - { - return QIcon(picdir.absFilePath(QString("measurement.png")).ascii()); - }; - -private: - bmphandler* bmphand; - SlicesHandler* handler3D; - std::vector labels; - unsigned short activeslice; - Q3HBox* hboxoverall; - Q3VBox* vboxmethods; - Q3HBox* hbox2; - Q3HBox* hbox3; - Q3HBox* hbox4; - Q3VBox* vbox1; - QLabel* txt_displayer; - QLabel* txt_ccb1; - QLabel* txt_ccb2; - QLabel* txt_ccb3; - QLabel* txt_ccb4; - QRadioButton* rb_vector; - QRadioButton* rb_dist; - QRadioButton* rb_thick; - QRadioButton* rb_angle; - QRadioButton* rb_4ptangle; - QRadioButton* rb_vol; - QButtonGroup* modegroup; - QRadioButton* rb_pts; - QRadioButton* rb_lbls; - QButtonGroup* inputgroup; - QComboBox* cbb_lb1; - QComboBox* cbb_lb2; - QComboBox* cbb_lb3; - QComboBox* cbb_lb4; - int state; - int pt[4][3]; - bool drawing; - std::vector established; - std::vector dynamic; - Point p1; - void set_coord(unsigned short posit, Point p, unsigned short slicenr); - -signals: - void vp1_changed(std::vector* vp1); - void vpdyn_changed(std::vector* vpdyn); - void vp1dyn_changed(std::vector* vp1, std::vector* vpdyn, - bool also_points = false); - -private slots: - void marks_changed(); - void bmphand_changed(bmphandler* bmph); - void pt_clicked(Point); - void pt_moved(Point); - void cbb_changed(int); - void method_changed(int); - void inputtype_changed(int); - void update_visualization(); -}; - -} // namespace iseg - -#endif diff --git a/iSeg/widgetcollection.h b/iSeg/widgetcollection.h deleted file mode 100755 index 9ea1d079..00000000 --- a/iSeg/widgetcollection.h +++ /dev/null @@ -1,989 +0,0 @@ -/* - * Copyright (c) 2018 The Foundation for Research on Information Technologies in Society (IT'IS). - * - * This file is part of iSEG - * (see https://github.com/ITISFoundation/osparc-iseg). - * - * This software is released under the MIT License. - * https://opensource.org/licenses/MIT - */ -#ifndef WIDGETCOLLECTION -#define WIDGETCOLLECTION - -#include "Core/DataSelection.h" -#include "Core/Point.h" -#include "Core/Types.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -namespace iseg { - -class SlicesHandler; -class TissueHiearchy; -class TissueHierarchyItem; -class bmphandler; - -//class ScaleWork : public QWidget -class ScaleWork : public QDialog -{ - Q_OBJECT -public: - ScaleWork(SlicesHandler* hand3D, QDir picpath, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0); - ~ScaleWork(); - -private: - bmphandler* bmphand; - SlicesHandler* handler3D; - unsigned short activeslice; - Q3HBox* hbox1; - Q3HBox* hbox2; - Q3HBox* hbox3; - Q3HBox* hbox4; - Q3VBox* vbox1; - QPushButton* getRange; - QPushButton* doScale; - QPushButton* doCrop; - QSlider* sl_brighness; - QSlider* sl_contrast; - QLineEdit* limitLow; - QLineEdit* limitHigh; - QLabel* lL; - QLabel* lH; - QLabel* lb_brightness; - QLabel* lb_contrast; - QCheckBox* allslices; - float minval, maxval; - float minval1, maxval1; - bool dontundo; - QPushButton* closeButton; - -signals: - void begin_datachange(iseg::DataSelection& dataSelection, - QWidget* sender = NULL, bool beginUndo = true); - void end_datachange(QWidget* sender = NULL, - iseg::EndUndoAction undoAction = iseg::EndUndo); - -public slots: - void slicenr_changed(); - -private slots: - void bmphand_changed(bmphandler* bmph); - void getrange_pushed(); - void scale_pushed(); - void crop_pushed(); - void slider_changed(int newval); - void slider_pressed(); - void slider_released(); -}; - -class ImageMath : public QDialog -{ - Q_OBJECT -public: - ImageMath(SlicesHandler* hand3D, QWidget* parent = 0, const char* name = 0, - Qt::WindowFlags wFlags = 0); - ~ImageMath(); - -private: - bmphandler* bmphand; - SlicesHandler* handler3D; - unsigned short activeslice; - Q3HBox* hbox1; - Q3HBox* hbox2; - Q3HBox* hbox3; - Q3VBox* vbox1; - QPushButton* doAdd; - QPushButton* doSub; - QPushButton* doMult; - QPushButton* doNeg; - QButtonGroup* imgorval; - QRadioButton* rb_img; - QRadioButton* rb_val; - float val; - QLineEdit* le_val; - QLabel* lb_val; - QCheckBox* allslices; - QPushButton* closeButton; - -signals: - void begin_datachange(iseg::DataSelection& dataSelection, - QWidget* sender = NULL, bool beginUndo = true); - void end_datachange(QWidget* sender = NULL, - iseg::EndUndoAction undoAction = iseg::EndUndo); - -public slots: - void slicenr_changed(); - -private slots: - void bmphand_changed(bmphandler* bmph); - void add_pushed(); - void sub_pushed(); - void mult_pushed(); - void neg_pushed(); - void value_changed(); - void imgorval_changed(int); -}; - -class ImageOverlay : public QDialog -{ - Q_OBJECT -public: - ImageOverlay(SlicesHandler* hand3D, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0); - ~ImageOverlay(); - -protected: - virtual void closeEvent(QCloseEvent* e); - -private: - bmphandler* bmphand; - SlicesHandler* handler3D; - unsigned short activeslice; - Q3VBox* vbox1; - Q3HBox* hbox1; - Q3HBox* hbox2; - Q3HBox* hbox3; - QLabel* lbAlpha; - QSlider* slAlpha; - QLineEdit* leAlpha; - QCheckBox* allslices; - QPushButton* closeButton; - QPushButton* applyButton; - float alpha; - int sliderMax; - unsigned short sliderPrecision; - float* bkpWork; - -signals: - void begin_datachange(iseg::DataSelection& dataSelection, - QWidget* sender = NULL, bool beginUndo = true); - void end_datachange(QWidget* sender = NULL, - iseg::EndUndoAction undoAction = iseg::EndUndo); - -public slots: - void newloaded(); - void slicenr_changed(); - -private slots: - void bmphand_changed(bmphandler* bmph); - void apply_pushed(); - void alpha_changed(); - void slider_changed(int newval); -}; - -class HistoWin : public QWidget -{ - Q_OBJECT -public: - HistoWin(unsigned int* histo1, QWidget* parent = 0, const char* name = 0, - Qt::WindowFlags wFlags = 0); - void update(); - void histo_changed(unsigned int* histo1); - -protected: - void paintEvent(QPaintEvent* e); - -private: - QImage image; - unsigned int* histo; -}; - -class ShowHisto : public QDialog -{ - Q_OBJECT -public: - ShowHisto(SlicesHandler* hand3D, QWidget* parent = 0, const char* name = 0, - Qt::WindowFlags wFlags = 0); - ~ShowHisto(); - -private: - bmphandler* bmphand; - SlicesHandler* handler3D; - unsigned short activeslice; - Q3HBox* hbox1; - Q3HBox* hbox2; - Q3HBox* hbox3; - Q3HBox* hbox4; - HistoWin* histwindow; - Q3VBox* vbox1; - Q3VBox* vbox2; - QPushButton* closeButton; - QPushButton* updateSubsect; - QSpinBox* xoffset; - QSpinBox* yoffset; - QSpinBox* xlength; - QSpinBox* ylength; - QCheckBox* subsect; - QLabel* xoffs; - QLabel* yoffs; - QLabel* xl; - QLabel* yl; - QButtonGroup* pictselect; - QRadioButton* workpict; - QRadioButton* bmppict; - -public slots: - void slicenr_changed(); - void newloaded(); - -private slots: - void bmphand_changed(bmphandler* bmph); - void draw_histo(); - void subsect_toggled(); - void pict_toggled(bool on); - void subsect_update(); -}; - -class colorshower : public QWidget -{ - Q_OBJECT -public: - colorshower(int lx1, int ly1, QWidget* parent = 0, const char* name = 0, - Qt::WindowFlags wFlags = 0); - -protected: - void paintEvent(QPaintEvent* e); - -private: - int lx; - int ly; - float fr; - float fg; - float fb; - float opac; - -private slots: - void color_changed(float fr1, float fg1, float fb1, float opac1); -}; - -class TissueTreeWidget : public QTreeWidget -{ - Q_OBJECT -public: - TissueTreeWidget(TissueHiearchy* hierarchy, QDir picpath, - QWidget* parent = 0); - ~TissueTreeWidget(); - -public: - void initialize(); - - void set_tissue_filter(const QString& filter); - void update_visibility(); - void update_visibility_recursive(QTreeWidgetItem* item); - - // Add tree items - void insert_item(bool isFolder, const QString& name); - - // Delete tree items - void remove_tissue(const QString& name); - void remove_current_item(bool removeChildren = false); - void remove_all_folders(bool removeChildren = false); - - // Update items - void update_tissue_name(const QString& oldName, const QString& newName); - void update_tissue_icons(QTreeWidgetItem* parent = 0); - void update_folder_icons(QTreeWidgetItem* parent = 0); - void set_current_folder_name(const QString& name); - - // Current item - void set_current_item(QTreeWidgetItem* item); - void set_current_tissue(tissues_size_t type); - bool get_current_is_folder(); - tissues_size_t get_current_type(); - QString get_current_name(); - bool get_current_has_children(); - void get_current_child_tissues( - std::map& types); - - // Hierarchy - void - update_tree_widget(); // Updates QTreeWidget from internal representation - void update_hierarchy(); // Updates internal representation from QTreeWidget - unsigned short get_selected_hierarchy(); - unsigned short get_hierarchy_count(); - std::vector* get_hierarchy_names_ptr(); - QString get_current_hierarchy_name(); - void reset_default_hierarchy(); - void set_hierarchy(unsigned short index); - void add_new_hierarchy(const QString& name); - void remove_current_hierarchy(); - bool get_hierarchy_modified(); - void set_hierarchy_modified(bool val); - unsigned short get_tissue_instance_count(tissues_size_t type); - void get_sublevel_child_tissues( - std::map& types); - - // File IO - FILE* SaveParams(FILE* fp, int version); - FILE* LoadParams(FILE* fp, int version); - bool load_hierarchy(const QString& path); - bool save_hierarchy_as(const QString& name, const QString& path); - - // Display - bool get_tissue_indices_hidden(); - - QList get_all_items(); - -public slots: - void toggle_show_tissue_indices(); - void sort_by_tissue_name(); - void sort_by_tissue_index(); - tissues_size_t get_type(QTreeWidgetItem* item); - QString get_name(QTreeWidgetItem* item); - -protected: - // Drag & drop - void dropEvent(QDropEvent* de); - -private: - void resize_columns_to_contents(); - bool get_is_folder(QTreeWidgetItem* item); - - QTreeWidgetItem* find_tissue_item(tissues_size_t type, - QTreeWidgetItem* parent = 0); - void take_children_recursively(QTreeWidgetItem* parent, - QList& appendTo); - void get_child_tissues_recursively( - QTreeWidgetItem* parent, - std::map& types); - unsigned short - get_tissue_instance_count_recursively(QTreeWidgetItem* parent, - tissues_size_t type); - void insert_item(bool isFolder, const QString& name, - QTreeWidgetItem* insertAbove); - void insert_item(bool isFolder, const QString& name, - QTreeWidgetItem* parent, unsigned int index); - void remove_tissue_recursively(QTreeWidgetItem* parent, - const QString& name); - void update_tissue_name_widget(const QString& oldName, - const QString& newName, - QTreeWidgetItem* parent = 0); - short get_child_lockstates(QTreeWidgetItem* folder); - void pad_tissue_indices(); - void pad_tissue_indices_recursively(QTreeWidgetItem* parent, - unsigned short digits); - void update_tissue_indices(); - void update_tissue_indices_recursively(QTreeWidgetItem* parent); - - // Convert QTreeWidget to internal representation - TissueHierarchyItem* create_current_hierarchy(); - void create_hierarchy_recursively(QTreeWidgetItem* parentIn, - TissueHierarchyItem* parentOut); - TissueHierarchyItem* create_hierarchy_item(QTreeWidgetItem* item); - - // Convert internal representation to QTreeWidget - void build_tree_widget(TissueHierarchyItem* root); - void build_tree_widget_recursively(TissueHierarchyItem* parentIn, - QTreeWidgetItem* parentOut, - std::set* tissueTypes); - QTreeWidgetItem* create_hierarchy_item(bool isFolder, const QString& name); - - // SaveParams - FILE* save_hierarchy(FILE* fp, unsigned short idx); - FILE* load_hierarchy(FILE* fp); - -private: - TissueHiearchy* hierarchies; - std::string tissue_filter; - QDir picturePath; - bool modified; - bool sortByNameAscending; - bool sortByTypeAscending; - -signals: - void hierarchy_list_changed(void); - -private slots: - void resize_columns_to_contents(QTreeWidgetItem* item); -}; - -class TissueAdder : public QDialog -{ - Q_OBJECT -public: - TissueAdder(bool modifyTissue, TissueTreeWidget* tissueTree, - QWidget* parent = 0, const char* name = 0, - Qt::WindowFlags wFlags = 0); - ~TissueAdder(); - // FILE *save_proj(FILE *fp); - -private: - bool modify; - - Q3HBoxLayout* hbox1; - Q3HBoxLayout* hbox2; - Q3HBoxLayout* hbox3; - /* QHBoxLayout *hboxr; - QHBoxLayout *hboxg; - QHBoxLayout *hboxb;*/ - colorshower* cs; - Q3VBoxLayout* vbox1; - Q3VBoxLayout* vbox2; - Q3VBoxLayout* vbox3; - Q3VBoxLayout* vbox4; - QPushButton* closeButton; - // QPushButton *colorButton; - QPushButton* addTissue; - QLabel* red; - QLabel* green; - QLabel* blue; - QLabel* opac; - QLabel* tissuename; - QLineEdit* nameField; - QSlider* r; - QSlider* g; - QSlider* b; - QSlider* sl_transp; - QSpinBox* sb_r; - QSpinBox* sb_g; - QSpinBox* sb_b; - QSpinBox* sb_transp; - float fr1; - float fg1; - float fb1; - float transp1; - TissueTreeWidget* tissueTreeWidget; - // float **tc; - -signals: - void color_changed(float fr, float fg, float fb, float opac2); - -private slots: - void update_color_r(int v); - void update_color_g(int v); - void update_color_b(int v); - void update_opac(int v); - void update_color_rsb(int v); - void update_color_gsb(int v); - void update_color_bsb(int v); - void update_opacsb(int v); - void add_pressed(); -}; - -class TissueFolderAdder : public QDialog -{ - Q_OBJECT -public: - TissueFolderAdder(TissueTreeWidget* tissueTree, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0); - ~TissueFolderAdder(); - -private: - Q3HBoxLayout* hboxOverall; - Q3VBoxLayout* vboxOverall; - Q3HBoxLayout* hboxFolderName; - Q3HBoxLayout* hboxPushButtons; - QLabel* nameLabel; - QLineEdit* nameLineEdit; - QPushButton* addButton; - QPushButton* closeButton; - TissueTreeWidget* tissueTreeWidget; - -private slots: - void add_pressed(); -}; - -class TissueHierarchyWidget : public QWidget -{ - Q_OBJECT -public: - TissueHierarchyWidget(TissueTreeWidget* tissueTree, QWidget* parent = 0, - Qt::WindowFlags wFlags = 0); - ~TissueHierarchyWidget(); - - bool handle_changed_hierarchy(); - -private: - QDir picturePath; - Q3HBoxLayout* hboxOverall; - Q3VBoxLayout* vboxOverall; - Q3VBoxLayout* vboxHierarchyButtons; - QComboBox* hierarchyComboBox; - QPushButton* newHierarchyButton; - QPushButton* loadHierarchyButton; - QPushButton* saveHierarchyAsButton; - QPushButton* removeHierarchyButton; - TissueTreeWidget* tissueTreeWidget; - -public slots: - void update_hierarchy_combo_box(); - bool save_hierarchy_as_pressed(); - -private slots: - void hierarchy_changed(int index); - void new_hierarchy_pressed(); - void load_hierarchy_pressed(); - void remove_hierarchy_pressed(); -}; - -class bits_stack : public QWidget -{ - Q_OBJECT -public: - bits_stack(SlicesHandler* hand3D, QWidget* parent = 0, const char* name = 0, - Qt::WindowFlags wFlags = 0); - ~bits_stack(); - QMap* return_bitsnr(); - void newloaded(); - FILE* save_proj(FILE* fp); - FILE* load_proj(FILE* fp); - void clear_stack(); - -protected: - void push_helper(bool source, bool target, bool tissue); - void pop_helper(bool source, bool target, bool tissue); - -private: - unsigned short oldw, oldh; - SlicesHandler* handler3D; - QListWidget* bits_names; - Q3HBoxLayout* hbox1; - Q3VBoxLayout* vbox1; - QPushButton* pushwork; - QPushButton* pushbmp; - QPushButton* pushtissue; - QPushButton* popwork; - QPushButton* popbmp; - QPushButton* loaditem; - QPushButton* saveitem; - QPushButton* poptissue; - QPushButton* deletebtn; - QMap bits_nr; - tissues_size_t tissuenr; - -signals: - void stack_changed(); - void begin_datachange(iseg::DataSelection& dataSelection, - QWidget* sender = NULL, bool beginUndo = true); - void end_datachange(QWidget* sender = NULL, - iseg::EndUndoAction undoAction = iseg::EndUndo); - void begin_dataexport(iseg::DataSelection& dataSelection, - QWidget* sender = NULL); - void end_dataexport(QWidget* sender = NULL); - -public slots: - void tissuenr_changed(unsigned short i); - -private slots: - void pushwork_pressed(); - void pushbmp_pressed(); - void pushtissue_pressed(); - void popwork_pressed(); - void popbmp_pressed(); - void poptissue_pressed(); - void saveitem_pressed(); - void loaditem_pressed(); - void delete_pressed(); -}; - -class bits_stack_pushdialog : public QDialog -{ - Q_OBJECT -public: - bits_stack_pushdialog(QWidget* parent = 0, const char* name = 0, - Qt::WindowFlags wFlags = 0); - ~bits_stack_pushdialog(); - bool get_pushcurrentslice(); - unsigned int get_startslice(bool* ok); - unsigned int get_endslice(bool* ok); - -private: - Q3VBox* vboxoverall; - Q3HBox* hboxparams; - Q3VBox* vboxsliceselection; - Q3VBox* vboxdelimiter; - Q3HBox* hboxslicerange; - Q3VBox* vboxslicerangelabels; - Q3VBox* vboxslicerangelineedits; - Q3HBox* hboxpushbuttons; - QRadioButton* rb_currentslice; - QRadioButton* rb_multislices; - QButtonGroup* slicegroup; - QLabel* lb_startslice; - QLabel* lb_endslice; - QLineEdit* le_startslice; - QLineEdit* le_endslice; - QPushButton* pushexec; - QPushButton* pushcancel; - -private slots: - void sliceselection_changed(); -}; - -class extoverlay_widget : public QWidget -{ - Q_OBJECT -public: - extoverlay_widget(SlicesHandler* hand3D, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0); - ~extoverlay_widget(); - void newloaded(); - -private: - bmphandler* bmphand; - SlicesHandler* handler3D; - unsigned short activeslice; - - unsigned short selectedDataset; - std::vector datasetNames; - std::vector datasetFilepaths; - - float alpha; - int sliderMax; - unsigned short sliderPrecision; - - Q3HBoxLayout* hboxOverall; - Q3VBoxLayout* vboxOverall; - Q3HBoxLayout* hboxAlpha; - Q3HBoxLayout* hboxDisplaySrcTgt; - QComboBox* datasetComboBox; - QPushButton* loadDatasetButton; - QLabel* lbAlpha; - QSlider* slAlpha; - QLineEdit* leAlpha; - QCheckBox* srcCheckBox; - QCheckBox* tgtCheckBox; - -protected: - void initialize(); - void add_dataset(const QString& path); - void remove_dataset(unsigned short idx); - void reload_overlay(); - -signals: - void overlay_changed(); - void overlayalpha_changed(float newValue); - void bmpoverlayvisible_changed(bool newValue); - void workoverlayvisible_changed(bool newValue); - -public slots: - void slicenr_changed(); - -private slots: - void dataset_changed(int index); - void load_dataset_pressed(); - void alpha_changed(); - void slider_changed(int newval); - void source_toggled(); - void target_toggled(); -}; - -class MultiDataset_widget : public QWidget -{ - Q_OBJECT - -public: - struct SDatasetInfo - { - QRadioButton* m_RadioButton; - QString m_RadioButtonText; - QStringList m_DatasetFilepath; - unsigned m_Width; - unsigned m_Height; - std::vector m_BmpSlices; - std::vector m_WorkSlices; - bool m_IsActive; - }; - - enum DatasetTypeEnum { - DCM, - BMP, - PNG, - RAW, - MHD, - AVW, - VTK, - XDMF, - NIFTI, - RTDOSE - }; - - MultiDataset_widget(SlicesHandler* hand3D, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0); - ~MultiDataset_widget(); - void NewLoaded(); - int GetNumberOfDatasets(); - bool IsActive(const int multiDS_index); - bool IsChecked(const int multiDS_index); - - std::vector GetBmpData(const int multiDS_index); - void SetBmpData(const int multiDS_index, std::vector bmp_bits_vc); - - std::vector GetWorkingData(const int multiDS_index); - void SetWorkingData(const int multiDS_index, - std::vector work_bits_vc); - -protected: - void Initialize(); - void InitializeMap(); - void ClearRadioButtons(); - - bool - CheckInfoAndAddToList(MultiDataset_widget::SDatasetInfo& newRadioButton, - QStringList loadfilenames, unsigned short width, - unsigned short height, unsigned short nrofslices); - bool AddDatasetToList(MultiDataset_widget::SDatasetInfo& newRadioButton, - QStringList loadfilenames); - void CopyImagesSlices(SlicesHandler* handler3D, - MultiDataset_widget::SDatasetInfo& newRadioButton, - const bool saveOnlyWorkingBits = false); - -signals: - void begin_datachange(iseg::DataSelection& dataSelection, - QWidget* sender = NULL, bool beginUndo = true); - void end_datachange(QWidget* sender = NULL, - iseg::EndUndoAction undoAction = iseg::EndUndo); - void dataset_changed(); - -private slots: - void AddDatasetPressed(); - void SwitchDataset(); - void ChangeDatasetName(); - void RemoveDataset(); - void DatasetSelectionChanged(); - -private: - SlicesHandler* m_Handler3D; - std::vector m_RadioButtons; - - Q3HBoxLayout* hboxOverall; - Q3VBoxLayout* vboxOverall; - Q3VBoxLayout* m_VboxOverall; - Q3VBoxLayout* m_VboxDatasets; - QGroupBox* m_DatasetsGroupBox; - QPushButton* m_AddDatasetButton; - QPushButton* m_LoadDatasetButton; - QPushButton* m_ChangeNameButton; - QPushButton* m_RemoveDatasetButton; - - bool m_ItIsBeingLoaded; - std::map m_MapDatasetValues; -}; - -class zoomer_widget : public QWidget -{ - Q_OBJECT -public: - zoomer_widget(double zoom1, QDir picpath, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0); - ~zoomer_widget(); - double get_zoom(); - -public slots: - void zoom_changed(double); - -private: - double zoom; - Q3VBoxLayout* vbox1; - Q3HBoxLayout* hbox1; - QPushButton* pushzoomin; - QPushButton* pushzoomout; - QPushButton* pushunzoom; - QLineEdit* le_zoom_f; - QLabel* zoom_f; - -signals: - void zoom_in(); - void zoom_out(); - void unzoom(); - void set_zoom(double); - -private slots: - // void zoom_changed(double); - void zoomin_pushed(); - void zoomout_pushed(); - void unzoom_pushed(); - void le_zoom_changed(); -}; - -class CleanerParams : public QDialog -{ - Q_OBJECT -public: - CleanerParams(int* rate1, int* minsize1, QWidget* parent = 0, - const char* name = 0, Qt::WindowFlags wFlags = 0); - ~CleanerParams(); - -private: - int* rate; - int* minsize; - Q3HBox* hbox1; - Q3VBox* vbox1; - Q3VBox* vbox2; - QPushButton* pb_doit; - QPushButton* pb_dontdoit; - QLabel* lb_rate; - QLabel* lb_minsize; - QSpinBox* sb_rate; - QSpinBox* sb_minsize; - -private slots: - void doit_pressed(); - void dontdoit_pressed(); -}; - -class MergeProjectsDialog : public QDialog -{ - Q_OBJECT -public: - MergeProjectsDialog(QWidget* parent = 0, const char* name = 0, - Qt::WindowFlags wFlags = 0); - ~MergeProjectsDialog(); - - void get_filenames(std::vector& filenames); - -private: - Q3HBoxLayout* hboxOverall; - Q3VBoxLayout* vboxFileList; - Q3VBoxLayout* vboxButtons; - Q3VBoxLayout* vboxEditButtons; - Q3VBoxLayout* vboxExecuteButtons; - QListWidget* fileListWidget; - QPushButton* addButton; - QPushButton* removeButton; - QPushButton* moveUpButton; - QPushButton* moveDownButton; - QPushButton* executeButton; - QPushButton* cancelButton; - -private slots: - void add_pressed(); - void remove_pressed(); - void move_up_pressed(); - void move_down_pressed(); -}; - -class CheckBoneConnectivityDialog : public QWidget -{ - Q_OBJECT - - enum BoneConnectionColumn { - kTissue1, - kTissue2, - kSliceNumber, - kColumnNumber - }; - - struct BoneConnectionInfo - { - BoneConnectionInfo(const tissues_size_t tis1, const tissues_size_t tis2, - const int slice) - : TissueID1(tis1), TissueID2(tis2), SliceNumber(slice) - { - } - - tissues_size_t TissueID1; - tissues_size_t TissueID2; - int SliceNumber; - - bool operator<(const BoneConnectionInfo& a) const - { - if (SliceNumber < a.SliceNumber) - { - return true; - } - else if (SliceNumber > a.SliceNumber) - { - return false; - } - else - { - return TissueID1 < a.TissueID1; - } - } - - bool operator==(const BoneConnectionInfo& a) const - { - return (SliceNumber == a.SliceNumber && - ((TissueID1 == a.TissueID1 && TissueID2 == a.TissueID2) || - (TissueID1 == a.TissueID2 && TissueID2 == a.TissueID1))); - } - }; - -public: - CheckBoneConnectivityDialog(SlicesHandler* hand3D, const char* name, - QWidget* parent = 0, - Qt::WindowFlags wFlags = 0); - ~CheckBoneConnectivityDialog(); - -signals: - void slice_changed(); - -private: - void ShowText(const std::string& text); - void CheckBoneExist(); - void LookForConnections(); - void FillConnectionsTable(); - - bool IsBone(const std::string& label_name) const; - -private: - SlicesHandler* handler3D; - - Q3HBox* mainBox; - Q3VBox* vbox1; - Q3HBox* hbox1; - Q3HBox* hbox2; - Q3HBox* hbox3; - Q3HBox* hbox4; - - QCheckBox* bonesFoundCB; - - QPushButton* executeButton; - QPushButton* cancelButton; - QPushButton* exportButton; - - QTableWidget* foundConnectionsTable; - - QLabel* progressText; - - std::vector foundConnections; - - Q3HBoxLayout* hboxOverall; - Q3VBoxLayout* vboxFileList; - Q3VBoxLayout* vboxButtons; - Q3VBoxLayout* vboxEditButtons; - Q3VBoxLayout* vboxExecuteButtons; - QListWidget* fileListWidget; - -private slots: - void cellClicked(int row, int col); - void execute_pressed(); - void cancel_pressed(); - void export_pressed(); -}; - -} // namespace iseg - -#endif