Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 7 additions & 5 deletions Superbuild/ITKExternal.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ SET(itk_CACHE_ARGS
"-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}"
"-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>"
"-DITK_BUILD_DEFAULT_MODULES:BOOL=OFF"
"-DITKV3_COMPATIBILITY:BOOL=ON"
"-DITKV4_COMPATIBILITY:BOOL=OFF"
"-DITK_LEGACY_REMOVE:BOOL=ON"
"-DITK_FUTURE_LEGACY_REMOVE:BOOL=OFF"
"-DModule_ITKRegistrationCommon:BOOL=ON"
"-DModule_ITKSmoothing:BOOL=ON"
"-DModule_ITKAnisotropicSmoothing:BOOL=ON"
Expand All @@ -68,7 +70,7 @@ SET(itk_CACHE_ARGS
"-DModule_ITKIOGIPL:BOOL=ON"
"-DModule_IITKIOMeta:BOOL=ON"
"-DModule_ITKIONRRD:BOOL=ON"
"-DModule_ITKDeprecated:BOOL=ON"
"-DModule_ITKDeprecated:BOOL=OFF"
"-DCMAKE_CXX_FLAGS:STATIC=${CMAKE_CXX_FLAGS}"
"-DCMAKE_CXX_FLAGS_DEBUG:STATIC=${CMAKE_CXX_FLAGS_DEBUG}"
"-DCMAKE_C_FLAGS:STATIC=${CMAKE_C_FLAGS}"
Expand All @@ -86,12 +88,12 @@ IF(BUILD_MOSAIC_TOOLS)
)
ENDIF()

SET(itk_GIT_TAG "origin/itk-4.13.1")
SET(itk_GIT_TAG "master")

# If CMake ever allows overriding the checkout command or adding flags,
# git checkout -q will silence message about detached head (harmless).
ExternalProject_Add(ITK_external
GIT_REPOSITORY "https://github.com/CIBC-Internal/itk.git"
GIT_REPOSITORY "https://github.com/InsightSoftwareConsortium/ITK.git"
GIT_TAG ${itk_GIT_TAG}
UPDATE_COMMAND ""
PATCH_COMMAND ""
Expand All @@ -101,6 +103,6 @@ ExternalProject_Add(ITK_external

# hardcoded, since we need this before ITK's configure step
ExternalProject_Get_Property(ITK_external INSTALL_DIR)
SET(ITK_DIR "${INSTALL_DIR}/lib/cmake/ITK-4.13" CACHE PATH "")
SET(ITK_DIR "${INSTALL_DIR}/lib/cmake/ITK-5.2" CACHE PATH "")

MESSAGE(STATUS "ITK_DIR=${ITK_DIR}")
19 changes: 7 additions & 12 deletions Superbuild/Superbuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -156,22 +156,16 @@ ENDIF()
IF(SEG3D_BUILD_INTERFACE)
SET(Qt5_PATH "" CACHE PATH "Path to directory where Qt 5 is installed. Directory should contain lib and bin subdirectories.")
#SET(CMAKE_AUTOMOC ON)

FIND_PACKAGE(Qt5 COMPONENTS Core Gui OpenGL Svg REQUIRED HINTS ${Qt5_PATH})

IF(IS_DIRECTORY ${Qt5_PATH})
FIND_PACKAGE(Qt5Core REQUIRED HINTS ${Qt5_PATH})
FIND_PACKAGE(Qt5Gui REQUIRED HINTS ${Qt5_PATH})
FIND_PACKAGE(Qt5OpenGL REQUIRED HINTS ${Qt5_PATH})
ELSE()
MESSAGE(SEND_ERROR "Set Qt5_PATH to directory where Qt 5 is installed (containing lib and bin subdirectories) or set SEG3D_BUILD_INTERFACE to OFF.")
ENDIF()

IF(Qt5Core_FOUND)
MESSAGE(STATUS "Found Qt version: ${Qt5Core_VERSION}")
IF(${Qt5Core_VERSION} VERSION_LESS "5.12")
IF(Qt5_FOUND)
MESSAGE(STATUS "Found Qt version: ${Qt5_VERSION}")
IF(${Qt5_VERSION} VERSION_LESS "5.12")
MESSAGE(FATAL_ERROR "Qt 5.12 or greater is required for building the Seg3D GUI")
ENDIF()
ELSE()
MESSAGE(FATAL_ERROR "Qt5 is required for building the Seg3D GUI")
MESSAGE(FATAL_ERROR "Qt5 is required for building the Seg3D GUI. Set Qt5_PATH to directory where Qt 5 is installed (containing lib and bin subdirectories) or set SEG3D_BUILD_INTERFACE to OFF.")
ENDIF()

IF(APPLE)
Expand Down Expand Up @@ -343,6 +337,7 @@ IF(SEG3D_BUILD_INTERFACE)
"-DQt5Core_DIR:PATH=${Qt5Core_DIR}"
"-DQt5Gui_DIR:PATH=${Qt5Gui_DIR}"
"-DQt5OpenGL_DIR:PATH=${Qt5OpenGL_DIR}"
"-DQt5Svg_DIR:PATH=${Qt5Svg_DIR}"
"-DMACDEPLOYQT_OUTPUT_LEVEL:STRING=${MACDEPLOYQT_OUTPUT_LEVEL}"
)
ENDIF()
Expand Down
6 changes: 5 additions & 1 deletion src/Application/Clipboard/ClipboardItem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ ClipboardItem::~ClipboardItem()

ClipboardItemHandle ClipboardItem::clone() const
{
ClipboardItem* cpy = new ClipboardItem( this->private_->width_,
ClipboardItem* cpy = new ClipboardItem( this->private_->width_,
this->private_->height_, this->private_->data_type_ );
cpy->private_->buffer_ = this->private_->buffer_;
cpy->private_->provenance_id_ = this->private_->provenance_id_;
Expand Down Expand Up @@ -126,6 +126,10 @@ void ClipboardItem::resize( size_t width, size_t height, Core::DataType data_typ
case Core::DataType::UINT_E:
buffer_size = sizeof( int );
break;
case Core::DataType::LONGLONG_E:
case Core::DataType::ULONGLONG_E:
buffer_size = sizeof( long long );
break;
case Core::DataType::FLOAT_E:
buffer_size = sizeof( float );
break;
Expand Down
68 changes: 34 additions & 34 deletions src/Application/DatabaseManager/DatabaseManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ DatabaseManager::DatabaseManager( const DatabaseManager& src ) :
"main", src.private_->database_, "main" );
if ( db_backup_obj == NULL )
{
CORE_THROW_EXCEPTION( std::string( "Failed to copy database: " ) +
CORE_THROW_EXCEPTION( std::string( "Failed to copy database: " ) +
sqlite3_errmsg( this->private_->database_ ) );
}

Expand All @@ -94,7 +94,7 @@ DatabaseManager::DatabaseManager( const DatabaseManager& src ) :
}

DatabaseManager::~DatabaseManager()
{
{
// We need to close the database to avoid memory leak.
if ( this->private_->database_ )
{
Expand All @@ -118,7 +118,7 @@ static int InternalExecuteSqlStatement( sqlite3_stmt* statement, ResultSet& resu
case SQLITE_TEXT:
case SQLITE_BLOB:
{
std::string string_result = std::string( reinterpret_cast< const char* >(
std::string string_result = std::string( reinterpret_cast< const char* >(
sqlite3_column_text( statement, j ) ) );
temp_any = boost::any( string_result );
break;
Expand Down Expand Up @@ -156,7 +156,7 @@ bool DatabaseManager::run_sql_statement( const std::string& sql_str, std::string
return this->run_sql_statement( sql_str, dummy_results, error );
}

bool DatabaseManager::run_sql_statement( const std::string& sql_str, ResultSet& results,
bool DatabaseManager::run_sql_statement( const std::string& sql_str, ResultSet& results,
std::string& error )
{
results.clear();
Expand All @@ -170,7 +170,7 @@ bool DatabaseManager::run_sql_statement( const std::string& sql_str, ResultSet&
}

sqlite3_stmt* statement = NULL;
if ( sqlite3_prepare_v2( this->private_->database_, sql_str.c_str(),
if ( sqlite3_prepare_v2( this->private_->database_, sql_str.c_str(),
static_cast< int >( sql_str.size() ), &statement, NULL ) != SQLITE_OK )
{
error = "The SQL statement '" + sql_str + "' failed to compile with error: "
Expand All @@ -183,7 +183,7 @@ bool DatabaseManager::run_sql_statement( const std::string& sql_str, ResultSet&
error = "The SQL statement '" + sql_str + "' returned error: "
+ sqlite3_errmsg( this->private_->database_ );
return false;
}
}

return true;
}
Expand All @@ -202,11 +202,11 @@ bool DatabaseManager::run_sql_script( const std::string& sql_str, std::string& e
const char* head = sql_str.c_str();
const char* tail = NULL;
// The input string length including the null terminator
int num_bytes = static_cast< int >( sql_str.size() + 1 );
int num_bytes = static_cast< int >( sql_str.size() + 1 );
while ( num_bytes > 1 )
{
sqlite3_stmt* statement = NULL;
if ( sqlite3_prepare_v2( this->private_->database_, head,
if ( sqlite3_prepare_v2( this->private_->database_, head,
num_bytes, &statement, &tail ) != SQLITE_OK )
{
error = "The SQL statement '" + std::string( head ) + "' failed to compile with error: "
Expand All @@ -221,7 +221,7 @@ bool DatabaseManager::run_sql_script( const std::string& sql_str, std::string& e
error = "The SQL statement '" + std::string( head ) + "' returned error: "
+ sqlite3_errmsg( this->private_->database_ );
return false;
}
}

num_bytes -= static_cast< int >( tail - head );
head = tail;
Expand All @@ -230,87 +230,87 @@ bool DatabaseManager::run_sql_script( const std::string& sql_str, std::string& e
return true;
}

bool DatabaseManager::load_database( const boost::filesystem::path& database_file,
bool DatabaseManager::load_database( const boost::filesystem::path& database_file,
std::string& error )
{
DatabaseManagerPrivate::lock_type lock( this->private_->get_mutex() );

int result;
sqlite3* temp_open_database;
sqlite3_backup* backup_database_object;

result = sqlite3_open( database_file.string().c_str(), &temp_open_database );
if ( result != SQLITE_OK )

if ( result != SQLITE_OK )
{
sqlite3_close( temp_open_database );
error = std::string( "Could not open database file '" ) + database_file.string() + "'.";
return false;
}
backup_database_object =

backup_database_object =
sqlite3_backup_init( this->private_->database_, "main", temp_open_database, "main" );

if ( backup_database_object )
{
sqlite3_backup_step( backup_database_object, -1 );
sqlite3_backup_finish( backup_database_object );
}

sqlite3_close( temp_open_database );

result = sqlite3_errcode( this->private_->database_ );
if ( result != SQLITE_OK )
if ( result != SQLITE_OK )
{
error = "Internal error in database.";
return false;
}

// Enable foreign key
this->run_sql_statement( "PRAGMA foreign_keys = ON;", error );

error = "";
return true;
return true;
}


bool DatabaseManager::save_database( const boost::filesystem::path& database_file,
bool DatabaseManager::save_database( const boost::filesystem::path& database_file,
std::string& error )
{
DatabaseManagerPrivate::lock_type lock( this->private_->get_mutex() );
int result;
sqlite3* temp_open_database;
sqlite3_backup* backup_database_object;

result = sqlite3_open( database_file.string().c_str(), &temp_open_database );
if ( result != SQLITE_OK )

if ( result != SQLITE_OK )
{
sqlite3_close( temp_open_database );
error = std::string( "Could not open database file '" ) + database_file.string() + "'.";
return false;
}
backup_database_object =

backup_database_object =
sqlite3_backup_init( temp_open_database, "main", this->private_->database_, "main" );

if ( backup_database_object )
{
sqlite3_backup_step( backup_database_object, -1 );
sqlite3_backup_finish( backup_database_object );
}

result = sqlite3_errcode( temp_open_database );
if ( result != SQLITE_OK )
if ( result != SQLITE_OK )
{
error = "Internal error in database.";
return false;
}

sqlite3_close( temp_open_database );

error = "";
return true;
return true;
}

long long DatabaseManager::get_last_insert_rowid()
Expand All @@ -323,9 +323,9 @@ long long DatabaseManager::get_last_insert_rowid()
return 0;
}

bool DatabaseManager::get_column_metadata( const std::string& table_name,
const std::string& column_name, char const** data_type /*= NULL*/,
char const** coll_seq /*= NULL*/, int* not_null /*= NULL*/,
bool DatabaseManager::get_column_metadata( const std::string& table_name,
const std::string& column_name, char const** data_type /*= NULL*/,
char const** coll_seq /*= NULL*/, int* not_null /*= NULL*/,
int* primary_key /*= NULL*/, int* auto_inc /*= NULL */ )
{
if ( this->private_->database_ == 0 )
Expand Down
13 changes: 6 additions & 7 deletions src/Application/DatabaseManager/DatabaseManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
#endif

// STL includes
#include <map>
Expand Down Expand Up @@ -64,7 +64,7 @@ class DatabaseManager : public boost::noncopyable
DatabaseManager( const DatabaseManager& src );

virtual ~DatabaseManager();

public:
/// RUN_SQL_STATEMENT:
/// Execute the given SQL statement on the database. If the statement generates
Expand All @@ -76,15 +76,15 @@ class DatabaseManager : public boost::noncopyable
/// Execute the given SQL statement on the database.
/// Returns true on success, otherwise false.
bool run_sql_statement( const std::string& sql_str, std::string& error );

/// RUN_SQL_SCRIPT:
/// Execute multiple SQL statements sequentially.
bool run_sql_script( const std::string& sql_str, std::string& error );

/// SAVE_DATABASE:
/// Save the database to disk
bool save_database( const boost::filesystem::path& database_file, std::string& error );

/// LOAD_DATABASE:
/// Load the database from disk
bool load_database( const boost::filesystem::path& database_file, std::string& error );
Expand All @@ -97,8 +97,8 @@ class DatabaseManager : public boost::noncopyable
/// Get metadata about a specific column of a specific database table.
/// Returns true if the table and column exist, otherwise false.
bool get_column_metadata( const std::string& table_name, const std::string& column_name,
char const** data_type = NULL, char const** coll_seq = NULL,
int* not_null = NULL, int* primary_key = NULL, int* auto_inc = NULL );
char const** data_type = NULL, char const** coll_seq = NULL,
int* not_null = NULL, int* primary_key = NULL, int* auto_inc = NULL );

private:
boost::shared_ptr< DatabaseManagerPrivate > private_;
Expand All @@ -112,4 +112,3 @@ class DatabaseManager : public boost::noncopyable
} // end namespace seg3d

#endif

Loading