Skip to content

Commit

Permalink
Fix signal slot errors and all compile warnings (#8)
Browse files Browse the repository at this point in the history
* - log file was not truncated on MacOS
- now MacOS app has an icon
- started fixing several errors related to signal-slot connections, where either slot or signal does not exist

* don't show warnings related missing override keyword (reduce warnings by factor 2, i.e. focus on real problems)

* update CImg library (and get rid of warnings)

* get rid of warnings
- conversion (NULL) to int -> use 0
- warning about missing/confusing brackets in if/else if

* get rid of warnings
- use BF_TYPE instead of 'MB', multi-character warning

* if (pos = 0 && ... probably should have been if (pos == 0 &&

* pass const char* for filenames/comments, etc

* fix get rid of warnings
- conversion (NULL) to int -> use 0

* fix last clang warning

* cleanup and simplify main.cpp
- remove unused variables, code and strange copies of QString instances

* Fixed issue compiling bmpreader_1.cpp id BF_TYPE not existing on Windows. Documentation states it should be "BM" or ox4D42 corresponding to "BM" in ASCII encoding
  • Loading branch information
dyollb authored and sanderegg committed Apr 6, 2018
1 parent bb28d11 commit bb0a14a
Show file tree
Hide file tree
Showing 22 changed files with 26,813 additions and 13,632 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h)
IF(MSVC)
ADD_DEFINITIONS("/D _CRT_SECURE_NO_WARNINGS /D _SCL_SECURE_NO_WARNINGS")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP4")
ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override")
ENDIF(MSVC)


Expand Down
4 changes: 1 addition & 3 deletions Core/HDF5Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,7 @@ int HDF5Writer::write_attribute(const std::string& value,
{
hid_t tid1 = H5Tcopy(H5T_C_S1);
herr_t ret = H5Tset_size(tid1, value.length() + 1);
&ret;
hid_t attribute_id = H5Acreate(group_andle, attribute_name.c_str(), tid1,
dataspace_id, H5P_DEFAULT);
hid_t attribute_id = H5Acreate(group_andle, attribute_name.c_str(), tid1, dataspace_id, H5P_DEFAULT);
if (attribute_id >= 0)
{
herr_t status = H5Awrite(attribute_id, tid1, value.c_str());
Expand Down
14 changes: 3 additions & 11 deletions Core/Log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@

#include "Log.h"

//#include <cassert>
//#include <cstdlib>
//#include <fstream>
//#include <iostream>
//#include <sstream>

namespace iseg {

void quit(const std::string& msg, const int code)
Expand All @@ -31,8 +25,7 @@ void quit(const std::string& msg, const int code)
void error(const std::string& msg, const int code)
{
const std::string msg2 = "Tools::error() : " + msg;
std::cerr << "\n"
<< msg2 << "\n";
std::cerr << "\n" << msg2 << "\n";
if (flog.is_open())
flog.close();
exit(code);
Expand All @@ -41,14 +34,13 @@ void error(const std::string& msg, const int code)
void warning(const std::string& msg)
{
const std::string msg2 = "Tools::warning() : " + msg;
std::cerr << "\n"
<< msg2 << "\n\n";
std::cerr << "\n" << msg2 << "\n\n";
}

bool interceptOutput(const std::string& logname)
{
if (!flog.is_open())
flog.open(logname.c_str(), std::ofstream::out);
flog.open(logname.c_str(), std::ofstream::out | std::ofstream::trunc);

if (flog.is_open())
{
Expand Down
20 changes: 10 additions & 10 deletions Core/MatlabExport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ using namespace std;
using namespace iseg;

bool matexport::print_mat(const char* filename, float* matrix, int nx, int ny,
int nz, char* comment, int commentlength,
char* varname, int varnamelength, bool complex)
int nz, const char* comment, int commentlength,
const char* varname, int varnamelength, bool complex)
{
FILE* fp;
fp = fopen(filename, "wb");
Expand Down Expand Up @@ -117,8 +117,8 @@ bool matexport::print_mat(const char* filename, float* matrix, int nx, int ny,
}

bool matexport::print_matslices(const char* filename, float** matrix, int nx,
int ny, int nz, char* comment,
int commentlength, char* varname,
int ny, int nz, const char* comment,
int commentlength, const char* varname,
int varnamelength, bool complex)
{
FILE* fp;
Expand Down Expand Up @@ -221,8 +221,8 @@ bool matexport::print_matslices(const char* filename, float** matrix, int nx,
}

bool matexport::print_mat(const char* filename, unsigned char* matrix, int nx,
int ny, int nz, char* comment, int commentlength,
char* varname, int varnamelength)
int ny, int nz, const char* comment, int commentlength,
const char* varname, int varnamelength)
{
FILE* fp;
fp = fopen(filename, "wb");
Expand Down Expand Up @@ -311,8 +311,8 @@ bool matexport::print_mat(const char* filename, unsigned char* matrix, int nx,
return true;
}
bool matexport::print_matslices(const char* filename, unsigned char** matrix,
int nx, int ny, int nz, char* comment,
int commentlength, char* varname,
int nx, int ny, int nz, const char* comment,
int commentlength, const char* varname,
int varnamelength)
{
FILE* fp;
Expand Down Expand Up @@ -520,8 +520,8 @@ bool matexport::print_mat(const char* filename, tissues_size_t* matrix, int nx,
return true;
}
bool matexport::print_matslices(const char* filename, tissues_size_t** matrix,
int nx, int ny, int nz, char* comment,
int commentlength, char* varname,
int nx, int ny, int nz, const char* comment,
int commentlength, const char* varname,
int varnamelength)
{
FILE* fp;
Expand Down
20 changes: 10 additions & 10 deletions Core/MatlabExport.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
namespace iseg { namespace matexport {

iSegCore_API bool print_mat(const char* filename, float* matrix, int nx, int ny,
int nz, char* comment, int commentlength,
char* varname, int varnamelength,
int nz, const char* comment, int commentlength,
const char* varname, int varnamelength,
bool complex = false);
iSegCore_API bool print_matslices(const char* filename, float** matrix, int nx,
int ny, int nz, char* comment,
int commentlength, char* varname,
int ny, int nz, const char* comment,
int commentlength, const char* varname,
int varnamelength, bool complex = false);
iSegCore_API bool print_mat(const char* filename, unsigned char* matrix, int nx,
int ny, int nz, char* comment, int commentlength,
char* varname, int varnamelength);
int ny, int nz, const char* comment, int commentlength,
const char* varname, int varnamelength);
iSegCore_API bool print_matslices(const char* filename, unsigned char** matrix,
int nx, int ny, int nz, char* comment,
int commentlength, char* varname,
int nx, int ny, int nz, const char* comment,
int commentlength, const char* varname,
int varnamelength);

#ifdef TISSUES_SIZE_TYPEDEF
Expand All @@ -37,8 +37,8 @@ iSegCore_API bool print_mat(const char* filename, tissues_size_t* matrix,
int commentlength, char* varname,
int varnamelength);
iSegCore_API bool print_matslices(const char* filename, tissues_size_t** matrix,
int nx, int ny, int nz, char* comment,
int commentlength, char* varname,
int nx, int ny, int nz, const char* comment,
int commentlength, const char* varname,
int varnamelength);

#endif // TISSUES_SIZE_TYPEDEF
Expand Down
1 change: 1 addition & 0 deletions Core/RTDoseWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,7 @@ void RTDoseWriter::AdjustVRTypeString(gdcm::VR::VRType& vr, unsigned int vm,
case gdcm::VR::UL: break;
case gdcm::VR::UN: break;
case gdcm::VR::US: break;
default: break;
}

if (vm == 1)
Expand Down
4 changes: 2 additions & 2 deletions Core/VTIreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ bool VTIreader::getSlice(const char* filename, float* slice, unsigned slicenr,
return false;
if (ext[1] - ext[0] + 1 != (int)width)
return false;
if (slicenr < 0 || slicenr > ext[5] - ext[4])
if (slicenr > ext[5] - ext[4])
return false;
unsigned long long pos = 0;

Expand Down Expand Up @@ -129,7 +129,7 @@ float* VTIreader::getSliceInfo(const char* filename, unsigned slicenr,
img->GetOrigin(org);
std::string className = img->GetPointData()->GetScalars()->GetClassName();

if (slicenr < 0 || slicenr > ext[5] - ext[4])
if (slicenr > ext[5] - ext[4])
return nullptr;
height = (unsigned)ext[3] - ext[2] + 1;
width = (unsigned)ext[1] - ext[0] + 1;
Expand Down
2 changes: 1 addition & 1 deletion Plugins/ConfidenceConnected/Confidence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ConfidenceWidget::ConfidenceWidget(iseg::SliceHandlerInterface* hand3D, QWidget*
sl_h2 = new QSpinBox(0, 50, 1, hbox2);
sl_h2->setValue(1);
txt_h3 = new QLabel("Multiplier(*10-1) ", hbox3);
sl_h3 = new QSpinBox(0, 100, 0.1, hbox3);
sl_h3 = new QSpinBox(0, 100, 0, hbox3); // BL: todo this is wrong
sl_h3->setValue(25);
txt_h4 = new QLabel("Neighborhoodradius: ", hbox4);
sl_h4 = new QSpinBox(0, 10, 1, hbox4);
Expand Down
Loading

0 comments on commit bb0a14a

Please sign in to comment.