Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3a80dab
First step in completing migration from ITKv3 to ITKv4
dzenanz Sep 24, 2020
e51885c
Disable ITKV3_COMPATIBILITY
dzenanz Sep 24, 2020
172d606
Finish migration to ITKv4
dzenanz Sep 24, 2020
61dc389
Prepare for migration to ITKv5
dzenanz Sep 24, 2020
092f263
Update ITK version to 5.1.0
allywarner Aug 7, 2020
b6b6599
7 errors left
allywarner Aug 24, 2020
5c75e65
ENH: Migration to ITK 5.1.0
Leengit Oct 1, 2020
efbe607
Use main ITK repository directly
dzenanz Oct 2, 2020
feb5255
Avoid use of legacy code
dzenanz Oct 2, 2020
c459be7
WIP: trying to fix HDF5 inclusion
dzenanz Oct 2, 2020
5e8c755
Exposing H5HL in ITK seems to work (it is on by default)
dzenanz Oct 2, 2020
386b258
ENH: Migration to ITK 5.1.0
Leengit Oct 5, 2020
c396034
Copy implementations of 4 functions from H5LTpublic.h
dzenanz Oct 8, 2020
6c6404b
Using ITK master
dzenanz Nov 2, 2020
0217159
Disabling ITKV4 compatibility
dzenanz Nov 2, 2020
840b28c
Remove ITK legacy code
dzenanz Nov 2, 2020
8a07fa2
SQL errors
allywarner Nov 3, 2020
e173aca
Update extraxt filter
allywarner Nov 3, 2020
2430c96
SQL errors
allywarner Nov 3, 2020
9797810
Tinyxml updates
allywarner Nov 3, 2020
92bf2b5
SQL errors
allywarner Nov 3, 2020
f84f590
Update extraxt filter
allywarner Nov 3, 2020
67e114f
SQL errors
allywarner Nov 3, 2020
c4e85e4
Tinyxml updates
allywarner Nov 3, 2020
cb172d7
Removing fiddling with HDF5 library which is no longer needed
dzenanz Nov 4, 2020
ce479c2
Merge branch 'itk5migration' of https://github.com/dzenanz/Seg3D into…
allywarner Nov 5, 2020
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}")
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