Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: remove qt3support #81

Merged
merged 33 commits into from
Mar 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
2bc4b2c
remove unused Q3Support headers
dyollb Feb 8, 2019
ae95705
get rid of Q3Action
dyollb Feb 8, 2019
03a40fb
fix: prevent crash during SaveSettings for certain configurations (Ma…
dyollb Feb 7, 2019
a5782c3
get rid of Q3ListWidget
dyollb Feb 8, 2019
d14b1d5
get rid of Q3PopupMenu
dyollb Feb 8, 2019
a254873
replace isOn by isChecked (buttons, like QRadioButton)
dyollb Feb 8, 2019
2f1ece2
refactor undo dialog: use QFormLayout
dyollb Feb 11, 2019
21e81fd
refactor watershed widget: use QFormLayout, remove Qt3 stuff
dyollb Feb 11, 2019
6695877
remove unused header includes
dyollb Feb 11, 2019
2300195
refactor fuzzy widget: use QFormLayout, remove Qt3 stuff
dyollb Feb 12, 2019
e61dbc0
refactor active slices dialog: use QFormLayout, remove Qt3 stuff
dyollb Feb 12, 2019
6ef90bb
refactor IFT widget: use QFormLayout, remove Qt3 stuff
dyollb Feb 12, 2019
06f9736
remove q3 headers from Precompiled.h
dyollb Feb 12, 2019
779aa84
refactor BiasCorrection widget: use QFormLayout, remove Qt3 stuff
dyollb Feb 12, 2019
9c173ae
refactor Feature widget: use QFormLayout, remove Qt3 stuff
dyollb Feb 12, 2019
fc5b6fc
refactor Picker widget: use QFormLayout, remove Qt3 stuff
dyollb Feb 12, 2019
7b4c603
refactor Measurement widget: use Qt4 layouting, remove Qt3 stuff
dyollb Feb 18, 2019
a75353f
Merge branch 'master' into refactor/remove_qt3support
dyollb Feb 18, 2019
3a2c4f3
refactor Livewire widget: use Qt4 layouting, remove Qt3 stuff
dyollb Feb 19, 2019
1b2b10f
Merge branch 'master' into refactor/remove_qt3support
dyollb Feb 20, 2019
81170e6
feature: add voxeling of lines (currently via .vtk file format)
dyollb Feb 20, 2019
5c86ca0
ThresholdWidget
sanderegg Feb 22, 2019
c04b3c8
Merge branch 'refactor/remove_qt3support' of https://github.com/dyoll…
dyollb Feb 22, 2019
a644733
remove dead code
dyollb Feb 22, 2019
e553b51
minor edits
dyollb Feb 25, 2019
39a5ecc
refactoringadded kmeans codeadded SaveParams/LoadParams stuff
sanderegg Feb 26, 2019
ed81399
removed thresholdwidget
sanderegg Feb 26, 2019
2739ea3
Merge branch 'iSeg_Qt4_Example' of https://github.com/sanderegg/ospar…
Feb 26, 2019
e96d975
fix: mode (stack index) was no initialized to last mode correctly
Feb 26, 2019
16cb60c
Merge branch 'sanderegg-iSeg_Qt4_Example' into refactor/remove_qt3sup…
Feb 26, 2019
8fa26bb
cleanup
dyollb Mar 14, 2019
e14dc59
Merge branch 'refactor/remove_qt3support' of https://github.com/dyoll…
dyollb Mar 14, 2019
8e485d1
Merge branch 'master' into refactor/remove_qt3support
dyollb Mar 26, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
# Precompiled Headers
*.gch
*.pch
*.ipch
*.bin

# Compiled Dynamic libraries
*.so
Expand Down
5 changes: 5 additions & 0 deletions .vscode/.cmaketools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"variant": null,
"activeEnvironments": [],
"codeModel": null
}
16 changes: 16 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"configurations": [
{
"name": "null",
"includePath": [],
"defines": [],
"browse": {
"path": [],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"intelliSenseMode": "msvc-x64"
}
],
"version": 4
}
14 changes: 7 additions & 7 deletions CMake/ThirdPartyEigen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
# - preprocessor definitions needed by package
#

#SET(EigenRootDir "" CACHE PATH "Directory containing Eigen/Cholesky")
#SET(EIGEN_INCLUDE_DIR ${EigenRootDir})

MACRO(USE_EIGEN)
find_package (Eigen3 3.3 REQUIRED NO_MODULE)

#INCLUDE_DIRECTORIES( ${EIGEN_INCLUDE_DIR} )
LIST( APPEND MY_EXTERNAL_LINK_LIBRARIES Eigen3::Eigen )
FIND_PACKAGE (Eigen3 3.3 REQUIRED QUIET NO_MODULE)
IF (Eigen3_FOUND)
LIST( APPEND MY_EXTERNAL_LINK_LIBRARIES Eigen3::Eigen )
ELSE()
FIND_PATH(EIGEN_INCLUDE_DIR NAMES Eigen/Dense Eigen/Dense PATHS /usr/local/include/eigen3)
INCLUDE_DIRECTORIES( ${EIGEN_INCLUDE_DIR} )
ENDIF()
ENDMACRO()

# tell Eigen to use MKL BLAS, LAPACK and Intel VML (for vector operations)
Expand Down
4 changes: 2 additions & 2 deletions Core/ImageWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "VtkGlue/itkImageToVTKImageFilter.h"

#include "Data/Logger.h"
#include "Data/SliceHandlerItkWrapper.h"
#include "Data/SlicesHandlerITKInterface.h"
#include "Data/Transform.h"

#include <itkCastImageFilter.h>
Expand All @@ -30,7 +30,7 @@
using namespace iseg;

template<typename T>
bool ImageWriter::writeVolume(const std::string& filename, const std::vector<T*>& all_slices, bool active_slices, const SliceHandlerInterface* handler)
bool ImageWriter::writeVolume(const std::string& filename, const std::vector<T*>& all_slices, bool active_slices, const SlicesHandlerInterface* handler)
{
unsigned dims[3] = {handler->width(), handler->height(), handler->num_slices()};
auto image = wrapToITK(all_slices, dims, handler->start_slice(), handler->end_slice(), handler->spacing(), handler->transform());
Expand Down
8 changes: 4 additions & 4 deletions Core/ImageWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

namespace iseg {

class SliceHandlerInterface;
class SlicesHandlerInterface;

/** \brief Image writer based on ITK image writer factory
*/
Expand All @@ -29,16 +29,16 @@ class ImageWriter
ImageWriter(bool binary = true) : m_Binary(binary) {}

template<typename T>
bool writeVolume(const std::string& filename, const std::vector<T*>& all_slices, bool active_slices, const SliceHandlerInterface* handler);
bool writeVolume(const std::string& filename, const std::vector<T*>& all_slices, bool active_slices, const SlicesHandlerInterface* handler);

private:
bool m_Binary;
};

iSegCore_TEMPLATE template ISEG_CORE_API bool ImageWriter::writeVolume<float>(
const std::string& filename, const std::vector<float*>& all_slices, bool active_slices, const SliceHandlerInterface* handler);
const std::string& filename, const std::vector<float*>& all_slices, bool active_slices, const SlicesHandlerInterface* handler);

iSegCore_TEMPLATE template ISEG_CORE_API bool ImageWriter::writeVolume<tissues_size_t>(
const std::string& filename, const std::vector<tissues_size_t*>& all_slices, bool active_slices, const SliceHandlerInterface* handler);
const std::string& filename, const std::vector<tissues_size_t*>& all_slices, bool active_slices, const SlicesHandlerInterface* handler);

} // namespace iseg
8 changes: 4 additions & 4 deletions Core/Morpho.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#pragma once

#include "Data/ItkUtils.h"
#include "Data/SliceHandlerItkWrapper.h"
#include "Data/SlicesHandlerITKInterface.h"

#include <itkBinaryDilateImageFilter.h>
#include <itkBinaryErodeImageFilter.h>
Expand Down Expand Up @@ -133,13 +133,13 @@ typename TOutputImage::Pointer

/** \brief Do morpological operation on target image
*/
void MorphologicalOperation(iseg::SliceHandlerInterface* handler,
void MorphologicalOperation(iseg::SlicesHandlerInterface* handler,
boost::variant<int, float> radius, eOperation operation, bool true3d)
{
iseg::SliceHandlerItkWrapper itkhandler(handler);
iseg::SlicesHandlerITKInterface itkhandler(handler);
if (true3d)
{
using input_type = iseg::SliceHandlerItkWrapper::image_ref_type;
using input_type = iseg::SlicesHandlerITKInterface::image_ref_type;
using output_type = itk::Image<unsigned char, 3>;

auto target = itkhandler.GetTarget(true); // get active slices
Expand Down
2 changes: 0 additions & 2 deletions Core/PolyLines.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ void PolylinesToEdges(const std::vector<std::vector<Index>>& polylines, std::vec
template<typename Index, typename Tuple>
void RemoveDuplicateEdges(std::vector<Tuple>& edges);

template<typename TVec3>
void WritePolylinesToVtk(std::vector<std::vector<TVec3>>& polylines, const std::string& file_name);
} // namespace iseg

#include "PolyLines.inl"
59 changes: 0 additions & 59 deletions Core/PolyLines.inl
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#pragma once

#include <fstream>

namespace iseg {

namespace detail {
Expand Down Expand Up @@ -248,61 +246,4 @@ void RemoveDuplicateEdges(std::vector<Tuple>& edges)
std::swap(new_edges, edges);
}

template<typename TVec3>
void WritePolylinesToVtk(std::vector<std::vector<TVec3>>& polylines, const std::string& file_name)
{
using bit32 = unsigned int;
std::vector<std::vector<bit32>> polylines_idx;
std::vector<TVec3> points;
bit32 point_count = 0;
size_t lines_counts = 0;
for (auto pline : polylines)
{
bool is_closed = (pline.front() == pline.back());

std::vector<bit32> iline;
for (size_t i = 0; i < (is_closed ? pline.size() - 1 : pline.size()); i++)
{
iline.push_back(point_count++);
points.push_back(pline[i]);
}
if (is_closed)
{
iline.push_back(iline.front());
}
polylines_idx.push_back(iline);
lines_counts += iline.size();
}

const bit32 num_points = (bit32)points.size();
const bit32 num_lines = (bit32)polylines_idx.size();

std::ofstream ofile;
ofile.open(file_name.c_str());

ofile << "# vtk DataFile Version 3.0\n";
ofile << "vtk output\n";
ofile << "ASCII\n";
ofile << "DATASET POLYDATA\n";

ofile << "POINTS " << num_points << " float\n";
for (bit32 i = 0; i < num_points; i++)
{
auto p = points[i];
ofile << p[0] << " " << p[1] << " " << p[2] << "\n";
}

ofile << "LINES " << num_lines << " " << lines_counts + num_lines << "\n";
for (bit32 i = 0; i < num_lines; i++)
{
auto line = polylines_idx[i];
ofile << line.size();
for (auto id : line)
ofile << " " << id;
ofile << "\n";
}

ofile.close();
}

} // namespace iseg
8 changes: 4 additions & 4 deletions Core/SmoothTissues.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "SmoothTissues.h"

#include "../Data/ItkUtils.h"
#include "../Data/SliceHandlerItkWrapper.h"
#include "../Data/SlicesHandlerITKInterface.h"

#include <itkDiscreteGaussianImageFilter.h>
#include <itkSignedMaurerDistanceMapImageFilter.h>
Expand Down Expand Up @@ -105,14 +105,14 @@ bool _SmoothTissues(TInput* tissues, const std::vector<bool>& locks, double sigm
return ok;
}

bool SmoothTissues(SliceHandlerInterface* handler, size_t start_slice, size_t end_slice, double sigma, bool smooth3d)
bool SmoothTissues(SlicesHandlerInterface* handler, size_t start_slice, size_t end_slice, double sigma, bool smooth3d)
{
SliceHandlerItkWrapper itkhandler(handler);
SlicesHandlerITKInterface itkhandler(handler);
auto locks = handler->tissue_locks();

if (smooth3d)
{
using label_image_type = SliceHandlerItkWrapper::tissues_ref_type;
using label_image_type = SlicesHandlerITKInterface::tissues_ref_type;

auto tissues = itkhandler.GetTissues(start_slice, end_slice);

Expand Down
4 changes: 2 additions & 2 deletions Core/SmoothTissues.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

namespace iseg {

class SliceHandlerInterface;
class SlicesHandlerInterface;

ISEG_CORE_API bool SmoothTissues(SliceHandlerInterface* handler, size_t start_slice, size_t end_slice, double sigma, bool smooth3d);
ISEG_CORE_API bool SmoothTissues(SlicesHandlerInterface* handler, size_t start_slice, size_t end_slice, double sigma, bool smooth3d);

} // namespace iseg
10 changes: 5 additions & 5 deletions Core/VotingReplaceLabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
#include "itkLabelVotingBinaryImageFilter.h"

#include "../Data/ItkUtils.h"
#include "../Data/SliceHandlerItkWrapper.h"
#include "../Data/SlicesHandlerITKInterface.h"

#include <itkCastImageFilter.h>

namespace iseg {

size_t VotingReplaceLabel(SliceHandlerInterface* handler,
size_t VotingReplaceLabel(SlicesHandlerInterface* handler,
tissues_size_t foreground,
tissues_size_t background,
std::array<unsigned int, 3> iradius,
Expand All @@ -30,10 +30,10 @@ size_t VotingReplaceLabel(SliceHandlerInterface* handler,
using image_type = itk::Image<tissues_size_t, 3>;
using voting_filter_type = itk::LabelVotingBinaryImageFilter<image_type, image_type>;

SliceHandlerItkWrapper itkhandler(handler);
SlicesHandlerITKInterface itkhandler(handler);
auto tissues = itkhandler.GetTissues(true);

auto cast = itk::CastImageFilter<SliceHandlerItkWrapper::tissues_ref_type, image_type>::New();
auto cast = itk::CastImageFilter<SlicesHandlerITKInterface::tissues_ref_type, image_type>::New();
cast->SetInput(tissues);
cast->Update();
auto input = cast->GetOutput();
Expand Down Expand Up @@ -83,7 +83,7 @@ size_t VotingReplaceLabel(SliceHandlerInterface* handler,
}

// paste into output
iseg::Paste<image_type, SliceHandlerItkWrapper::tissues_ref_type>(output, tissues);
iseg::Paste<image_type, SlicesHandlerITKInterface::tissues_ref_type>(output, tissues);

return number_remaining;
}
Expand Down
4 changes: 2 additions & 2 deletions Core/VotingReplaceLabel.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

namespace iseg {

class SliceHandlerInterface;
class SlicesHandlerInterface;

ISEG_CORE_API size_t VotingReplaceLabel(SliceHandlerInterface* handler, tissues_size_t foreground, tissues_size_t background,
ISEG_CORE_API size_t VotingReplaceLabel(SlicesHandlerInterface* handler, tissues_size_t foreground, tissues_size_t background,
std::array<unsigned int, 3> iradius, unsigned int majority_threshold, unsigned int max_iterations);

} // namespace iseg
2 changes: 1 addition & 1 deletion Core/testsuite/test_ImageIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace iseg {

namespace {

class TestHandler : public SliceHandlerInterface
class TestHandler : public SlicesHandlerInterface
{
unsigned short _dims[3];
unsigned short _start;
Expand Down
2 changes: 1 addition & 1 deletion Data/BrushInteraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace iseg {

void BrushInteraction::init(iseg::SliceHandlerInterface* handler)
void BrushInteraction::init(iseg::SlicesHandlerInterface* handler)
{
if (handler == nullptr)
throw std::runtime_error("null slice handler");
Expand Down
6 changes: 3 additions & 3 deletions Data/BrushInteraction.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace iseg {
class ISEG_DATA_API BrushInteraction
{
public:
BrushInteraction(SliceHandlerInterface* handler,
BrushInteraction(SlicesHandlerInterface* handler,
const boost::function<void(DataSelection)>& begin,
const boost::function<void(EndUndoAction)>& end,
const boost::function<void(std::vector<Point>*)>& vpdynchanged)
Expand All @@ -34,7 +34,7 @@ namespace iseg {
}

/// throws std::runtime_error if handler is invalid
void init(SliceHandlerInterface* handler);
void init(SlicesHandlerInterface* handler);

void set_radius(float radius) { _radius = radius; }
void set_brush_target(bool on) { _brush_target = on; }
Expand All @@ -54,7 +54,7 @@ namespace iseg {
boost::function<void(EndUndoAction)> end_datachange;
boost::function<void(std::vector<Point>*)> vpdyn_changed;

SliceHandlerInterface* _slice_handler;
SlicesHandlerInterface* _slice_handler;
std::vector<bool> _cached_tissue_locks;
unsigned _width;
unsigned _height;
Expand Down
2 changes: 1 addition & 1 deletion Data/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ SET(SOURCES
Color.cpp
ItkProgressObserver.cpp
LogApi.cpp
SliceHandlerItkWrapper.cpp
SlicesHandlerITKInterface.cpp
Transform.cpp
)

Expand Down
Loading