Commit b94ca71c authored by Emmanuel Promayon's avatar Emmanuel Promayon

Merge branch 'feature/modernize-c++' into 'develop'

Feature/modernize c++

Closes #46

See merge request !92
parents e5f3cc13 cbb499d5
......@@ -52,14 +52,12 @@ ConnectedComponents::ConnectedComponents(ActionExtension* extension) : Action(ex
}
// --------------- destructor -------------------
ConnectedComponents::~ConnectedComponents() {
}
// --------------- getNbConnectedComponents -------------------
int ConnectedComponents::getNbConnectedComponents() const {
return nbConnectedComponents;
}
// --------------- setNbConnectedComponents -------------------
void ConnectedComponents::setNbConnectedComponents(const int nbConnectedComponents) {
this->nbConnectedComponents = nbConnectedComponents;
}
......
......@@ -52,7 +52,7 @@ public:
ConnectedComponents(camitk::ActionExtension*);
/// Default Destructor
virtual ~ConnectedComponents();
virtual ~ConnectedComponents() = default;
public slots:
/** this method is automatically called when the action is triggered.
......
......@@ -50,10 +50,6 @@ GradientMagnitude::GradientMagnitude(ActionExtension* extension) : Action(extens
this->addTag("Contours");
}
// --------------- destructor -------------------
GradientMagnitude::~GradientMagnitude() {
}
// --------------- apply -------------------
Action::ApplyStatus GradientMagnitude::apply() {
foreach (Component * comp, getTargets()) {
......
......@@ -48,7 +48,7 @@ public:
GradientMagnitude(camitk::ActionExtension*);
/// Default Destructor
virtual ~GradientMagnitude();
virtual ~GradientMagnitude() = default;
public slots:
/** this method is automatically called when the action is triggered.
......
......@@ -54,10 +54,6 @@ LaplacianSharpening::LaplacianSharpening(ActionExtension* extension) : Action(ex
}
// --------------- destructor -------------------
LaplacianSharpening::~LaplacianSharpening() {
}
// --------------- apply -------------------
Action::ApplyStatus LaplacianSharpening::apply() {
foreach (Component * comp, getTargets()) {
......
......@@ -48,7 +48,7 @@ public:
LaplacianSharpening(camitk::ActionExtension*);
/// Default Destructor
virtual ~LaplacianSharpening();
virtual ~LaplacianSharpening() = default;
public slots:
/** this method is automatically called when the action is triggered.
......
......@@ -58,10 +58,6 @@ SobelEdgeDetection::SobelEdgeDetection(ActionExtension* extension) : Action(exte
addParameter(keepOrgVoxelTypeProperty);
}
// --------------- destructor -------------------
SobelEdgeDetection::~SobelEdgeDetection() {
}
// --------------- apply -------------------
Action::ApplyStatus SobelEdgeDetection::apply() {
foreach (Component* comp, getTargets()) {
......
......@@ -50,7 +50,7 @@ public:
SobelEdgeDetection(camitk::ActionExtension*);
/// Default Destructor
virtual ~SobelEdgeDetection();
virtual ~SobelEdgeDetection() = default;
public slots:
/** this method is automatically called when the action is triggered.
......
......@@ -45,7 +45,7 @@ public:
ITKSegmentationExtension() : ActionExtension() {};
/// the destructor
virtual ~ITKSegmentationExtension() {};
virtual ~ITKSegmentationExtension() = default;
/// Method that return the action extension name
virtual QString getName() {
......
......@@ -40,11 +40,6 @@ RegionGrowingWidget::RegionGrowingWidget(Action* action)
ui.seedPointGroupBox->layout()->addWidget(pickingW);
QObject::connect(ui.applyButton, SIGNAL(clicked()), myAction, SLOT(apply()));
}
RegionGrowingWidget::~RegionGrowingWidget() {
}
bool RegionGrowingWidget::isSmoothingChecked() {
......
......@@ -49,7 +49,7 @@ public:
RegionGrowingWidget(camitk::Action* action);
/// destructor
~RegionGrowingWidget();
~RegionGrowingWidget() override = default;
/// Update the widget with the correct PickedPixelMap (ImageComponent + Qlist of the selected points)
void updateComponent(camitk::ImageComponent* image);
......
......@@ -44,7 +44,7 @@
using namespace camitk;
// --------------- Constructor -------------------
DicomComponent::DicomComponent(DicomSerie* dicomSerie) throw(AbortException) : ImageComponent("") {
DicomComponent::DicomComponent(DicomSerie* dicomSerie) : ImageComponent("") {
// associated the component's dicom series
serie = dicomSerie;
......@@ -189,7 +189,7 @@ camitk::ImageOrientationHelper::PossibleImageOrientations DicomComponent::readDi
// convert the string into the appropriate couple of cosine vectors
double x[3] = {0.0, 0.0, 0.0};
double y[3] = {0.0, 0.0, 0.0};
std::sscanf(value.c_str(), "%lf\\%lf\\%lf\\%lf\\%lf\\%lf", &x[0], &x[1], &x[2], &y[0], &y[1], &y[2]);
std::sscanf(value.c_str(), R"(%lf\%lf\%lf\%lf\%lf\%lf)", &x[0], &x[1], &x[2], &y[0], &y[1], &y[2]);
// get the 90 degrees closest cosines for each vector
x[0] = roundCosine(x[0]);
......
......@@ -49,9 +49,10 @@ class DicomComponent : public camitk::ImageComponent {
public:
/**
* Create a new Component that handles DICOM images
* @param pointor to the associated DicomSerie
* This method may throw an AbortException if a problem occurs.
* @param dSerie to the associated DicomSerie
**/
DicomComponent(DicomSerie*) throw(camitk::AbortException);
DicomComponent(DicomSerie* dSerie);
/**
* @brief Get the DicomSerie associated to this component.
......
......@@ -52,7 +52,7 @@ QStringList DicomComponentExtension::getFileExtensions() const {
}
// --------------- Open -------------------
Component* DicomComponentExtension::open(const QString& path) throw (AbortException) {
Component* DicomComponentExtension::open(const QString& path) {
serieParsed = DicomParser::parseDirectory(path);
......
......@@ -56,7 +56,7 @@ class DicomComponentExtension : public camitk::ComponentExtension {
public:
/// Constructor
DicomComponentExtension() : ComponentExtension() {}
DicomComponentExtension() : ComponentExtension() {};
/// Method returning the component extension name
virtual QString getName() const {
......@@ -75,8 +75,9 @@ public:
virtual QStringList getFileExtensions() const;
/** Open a single .dcm image or a directory containing files to be read
* This method may throw an AbortException if a problem occurs.
*/
virtual camitk::Component* open(const QString&) throw (camitk::AbortException);
virtual camitk::Component* open(const QString&);
/** Save a given Component (does not have to be top-level)
* into one of the currently managed format.
......@@ -89,7 +90,7 @@ public:
protected:
/// Destructor
virtual ~DicomComponentExtension() {}
virtual ~DicomComponentExtension() = default;
private:
/// Last opened component. When opening the directory, create 1 component per files
......
......@@ -65,9 +65,6 @@ DicomDialog::DicomDialog(QList<DicomDialogEntry*> elements): QDialog() {
exec();
}
//--------------- Destructor ---------------------------------
DicomDialog::~DicomDialog() {}
//--------------- getSelectedDicomDialogEntries ---------------------------------
QList<DicomDialogEntry*> DicomDialog::getSelectedDicomDialogEntries() {
......
......@@ -50,7 +50,7 @@ public:
/**Default Constructor*/
DicomDialog(QList<DicomDialogEntry*>);
/**Destructor*/
~DicomDialog();
~DicomDialog() override = default;
/// Get the list of DicomDialogEntry selected for opening
QList<DicomDialogEntry*> getSelectedDicomDialogEntries();
......
......@@ -34,11 +34,6 @@ DicomDialogEntry::DicomDialogEntry() {
patientName = "NOT FOUND";
}
// --------------- Destructor -------------------
DicomDialogEntry::~DicomDialogEntry() {
}
// --------------- Getters -------------------
bool DicomDialogEntry::isSelected() {
return selected;
......
......@@ -45,7 +45,7 @@ public:
DicomDialogEntry();
/// Default Destructor
virtual ~DicomDialogEntry();
virtual ~DicomDialogEntry() = default;
///@name Getters
///@{
......
......@@ -36,7 +36,7 @@
#include <QCoreApplication>
// C++ includes
#include <stdlib.h>
#include <cstdlib>
#include <vector>
......@@ -54,10 +54,10 @@ Q_DECLARE_TR_FUNCTIONS(DicomParser)
public:
DicomParser() {};
DicomParser() = default;
/// Default Destructor
virtual ~DicomParser() {};
virtual ~DicomParser() = default;
/**
* @brief Parse the input directory for DICOM series.
......
......@@ -34,11 +34,6 @@ DicomSerie::DicomSerie() {
patientName = "NOT FOUND";
}
// --------------- Destructor -------------------
DicomSerie::~DicomSerie() {
}
// --------------- Getters -------------------
QDate DicomSerie::getAcquisitionDate() const {
return acquisitionDate;
......
......@@ -53,7 +53,7 @@ public:
DicomSerie();
/// Default Destructor
virtual ~DicomSerie();
virtual ~DicomSerie() = default;
///@name Getters
///@{
......
......@@ -45,7 +45,7 @@ using namespace camitk;
#include <Log.h>
// -------------------- constructor --------------------
ItkImageComponent::ItkImageComponent(const QString& fileName) throw(AbortException)
ItkImageComponent::ItkImageComponent(const QString& fileName)
: ImageComponent(fileName) {
createComponent(fileName);
}
......
......@@ -40,11 +40,13 @@
class ItkImageComponent : public camitk::ImageComponent {
Q_OBJECT
public:
/// default constructor: give it the name of the file containing the data
ItkImageComponent(const QString&) throw (camitk::AbortException);
/** default constructor: give it the name of the file containing the data.
* This method may throw an AbortException if a problem occurs.
*/
ItkImageComponent(const QString&);
/// needed for deleting
virtual ~ItkImageComponent() {};
virtual ~ItkImageComponent() = default;
virtual void createComponent(const QString&);
......
......@@ -66,8 +66,8 @@ QStringList ItkImageComponentExtension::getFileExtensions() const {
}
// --------------- open -------------------
Component* ItkImageComponentExtension::open(const QString& fileName) throw (AbortException) {
ItkImageComponent* res = NULL;
Component* ItkImageComponentExtension::open(const QString& fileName) {
ItkImageComponent* res = nullptr;
try {
res = new ItkImageComponent(fileName);
}
......
......@@ -43,7 +43,7 @@ class ItkImageComponentExtension : public camitk::ImageComponentExtension {
public:
/// the constructor (do nothing really)
ItkImageComponentExtension() : ImageComponentExtension() {}
ItkImageComponentExtension() : ImageComponentExtension() {};
/// get the plugin name
virtual QString getName() const;
......@@ -54,8 +54,10 @@ public:
/// get the list of managed extensions (each file with an extension in the list can be loaded by this Extension
virtual QStringList getFileExtensions() const;
/// get a new instance from data stored in a file (this is the most important method to redefine in your subclass)
virtual camitk::Component* open(const QString&) throw(camitk::AbortException);
/** get a new instance from data stored in a file.
* This method may throw an AbortException if a problem occurs.
*/
virtual camitk::Component* open(const QString&);
/** save a given Component (does not have to be top-level) into one of the currently managed format.
*
......@@ -65,7 +67,7 @@ public:
protected:
/// the destructor
virtual ~ItkImageComponentExtension() {};
virtual ~ItkImageComponentExtension() = default;
template <class ImageType> static bool saveImage(camitk::ImageComponent*);
......
......@@ -76,7 +76,7 @@ Action::ApplyStatus GenerateModel::apply() {
QString originalFilename = targetMesh->getFileName();
if ( originalFilename.isEmpty() ) {
// ask the user
originalFilename = QFileDialog::getSaveFileName( NULL, "Generate Model", "", "ModelingML (*.mml)" );
originalFilename = QFileDialog::getSaveFileName( nullptr, "Generate Model", "", "ModelingML (*.mml)" );
if ( originalFilename.isNull() ) {
QApplication::restoreOverrideCursor();
CAMITK_WARNING(tr("Filename required. Action Aborted."))
......
......@@ -50,7 +50,7 @@ public:
GenerateModel(camitk::ActionExtension*);
/// the destructor
virtual ~GenerateModel() {};
virtual ~GenerateModel() = default;
/// default widget
virtual QWidget* getWidget() {
......
......@@ -44,10 +44,10 @@ class MMLActionExtension : public camitk::ActionExtension {
public:
/// the constructor
MMLActionExtension() : ActionExtension() {}
MMLActionExtension() : ActionExtension() {};
/// the destructor
virtual ~MMLActionExtension() {}
virtual ~MMLActionExtension() = default;
/// Method must be reimplemented when an ActionExtension is done,
/// the own actions of an extension are load there.
......
......@@ -45,10 +45,6 @@ SimulationDialog::SimulationDialog(ActionExtension* extension) : Action(extensio
setFamily("Modeling");
}
// --------------- destructor -------------------
SimulationDialog::~SimulationDialog() {
}
// --------------- getWidget -------------------
QWidget* SimulationDialog::getWidget() {
MMLComponent* input = dynamic_cast<MMLComponent*> (getTargets().last());
......
......@@ -23,7 +23,7 @@ public:
SimulationDialog(camitk::ActionExtension*);
/// Default Destructor
virtual ~SimulationDialog();
virtual ~SimulationDialog() = default;
public slots:
/** this method is automatically called when the action is triggered.
......
......@@ -38,7 +38,7 @@ class CamiTKPropertyList : public QObject {
public:
// destructor
virtual ~CamiTKPropertyList();
~CamiTKPropertyList() override;
/** Get a Property given its name
* @param name the property name
......
......@@ -45,7 +45,7 @@ public:
CreateSC(camitk::ActionExtension*);
/// the destructor
virtual ~CreateSC() {};