Skip to content

Commit

Permalink
Update to inviwo commit 1abb2b923c51d684af8b6205c3b3e8ece2f86c6a
Browse files Browse the repository at this point in the history
* CI: Use vcpkg 
* Disable Python in CMakePresets.json
* Update to inviwo commit 1abb2b923c51d684af8b6205c3b3e8ece2f86c6a
* Fix uppdated include path for inviwocommondefines.h
* Fix packaging setup CMakePresets.json
* MacOS 13 packaging fix actions/runner-images#7522 (comment)
  • Loading branch information
ResearchDaniel committed Apr 23, 2024
2 parents 57ec66c + 8fbb5c3 commit 7fd3e4b
Show file tree
Hide file tree
Showing 18 changed files with 86 additions and 69 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/test-installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
# launch the nsis installer in "silent mode" (/S), should run without user interaction
Invoke-expression "./'$exe' /S"
# this will spawn the installer in the background so we need to wait for it to finish
$proc = Get-Process | where {$_.ProcessName -like "Visual Neuro-*"} | Select-Object -First 1
$proc = Get-Process | where {$_.ProcessName -like "VisualNeuro*"} | Select-Object -First 1
if ($proc) {
Wait-Process -Id $proc.id
}
Expand All @@ -52,8 +52,8 @@ jobs:
if: runner.os == 'Windows'
shell: pwsh
run: |
$ver = (Get-ChildItem -Name C:/"Program Files/Visual Neuro"/*)
Invoke-expression "C:/'Program Files/Visual Neuro/$ver/bin/Visual Neuro.exe' --logconsole --quit"
$ver = (Get-ChildItem -Name C:/"Program Files/VisualNeuroApp"/*)
Invoke-expression "C:/'Program Files/VisualNeuroApp/$ver/bin/VisualNeuro.exe' --logconsole --quit"
###############################################################################
# Macos
Expand All @@ -67,15 +67,15 @@ jobs:
# Mount installer image
hdiutil attach "$DMG"
# Install by copying Visual Neuro.app to applications folder
cp -r "/Volumes/${DMG%%.dmg}/Visual Neuro.app" /Applications/
cp -r "/Volumes/${DMG%%.dmg}/VisualNeuroApp.app" /Applications/
hdiutil detach "/Volumes/${DMG%%.dmg}/"
- name: Run Visual Neuro
if: runner.os == 'macOS'
shell: bash
run: |
cd "/Applications/Visual Neuro.app/Contents/MacOS/"
./"Visual Neuro" --logconsole --quit
cd "/Applications/VisualNeuroApp.app/Contents/MacOS/"
./"VisualNeuro" --logconsole --quit
###############################################################################
# Linux
Expand All @@ -90,4 +90,4 @@ jobs:
tar zxvf "$TGZ"
# Get folder name and move into the folder
cd "${TGZ%.tar.gz}"
./"bin/Visual Neuro" --logconsole --quit
./"bin/VisualNeuro" --logconsole --quit
8 changes: 5 additions & 3 deletions .github/workflows/visualneuro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
matrix:
system: [windows, macos, linux]
linkage: [dynamic]
cmake_linkage: ['ON']
configuration: [Release]

include:
Expand All @@ -31,23 +32,23 @@ jobs:
preset: msvc-visualneuro
targets: 'ALL_BUILD package'
installer: 'visualneuro-installer-win'
artifact: 'build/Visual Neuro-v*.exe'
artifact: 'build/VisualNeuroApp-v*.exe'
- system: macos
os: 'macos-13' # for now macos-latest == macos-12 since macos-13 is still "beta"
triplet: 'x64-osx'
cmake: '-DVCPKG_APPLOCAL_DEPS=OFF'
preset: ninja-visualneuro
targets: 'all package'
installer: 'visualneuro-installer-macos'
artifact: 'build/Visual Neuro-v*.dmg'
artifact: 'build/VisualNeuroApp-v*.dmg'
- system: linux
os: 'ubuntu-22.04'
triplet: 'x64-linux'
cmake: '-DIVW_PACKAGE_INSTALLER=OFF'
preset: ninja-visualneuro
targets: 'all package'
installer: 'visualneuro-installer-ubuntu'
artifact: 'build/Visual Neuro-v*.tar.gz'
artifact: 'build/VisualNeuroApp-v*.tar.gz'
fail-fast: false

runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -131,6 +132,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: 'inviwo/inviwo'
ref: '1abb2b923c51d684af8b6205c3b3e8ece2f86c6a'
path: 'inviwo'
submodules: recursive

Expand Down
9 changes: 5 additions & 4 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"IVW_EXTERNAL_PROJECTS" : "${sourceParentDir}/visualneuro/apps;",

"BUILD_SHARED_LIBS": { "type": "BOOL", "value": "ON"},
"IVW_ENABLE_PYTHON": { "type": "BOOL", "value": "OFF"},
"IVW_CFG_CMAKE_DEBUG": { "type": "BOOL", "value": "ON"},
"IVW_CFG_PROFILING": { "type": "BOOL", "value": "OFF"},
"IVW_CFG_PRECOMPILED_HEADERS": { "type": "BOOL", "value": "OFF"},
Expand All @@ -28,7 +29,7 @@
"IVW_TEST_INTEGRATION_TESTS": { "type": "BOOL", "value": "OFF"},

"IVW_PACKAGE_INSTALLER": { "type": "BOOL", "value": "ON"},
"IVW_APP_INSTALL_NAME": "Visual Neuro",
"IVW_APP_INSTALL_NAME": "VisualNeuroApp",
"IVW_PACKAGE_SELECT_APP": "VisualNeuroApp",

"IVW_USE_OPENMP": { "type": "BOOL", "value": "OFF"},
Expand Down Expand Up @@ -56,20 +57,20 @@
"name": "msvc-visualneuro",
"displayName": "MSVC Visual Neuro",
"description": "Visual Studio configuration",
"inherits": ["msvc", "user", "vcpkg", "visualneuro"]
"inherits": ["visualneuro", "msvc", "user", "vcpkg"]
},
{
"name": "ninja-visualneuro",
"displayName": "Ninja Visual Neuro",
"description": "Ninja configuration",
"inherits": ["ninja", "user", "vcpkg", "visualneuro"]
"inherits": ["visualneuro", "ninja", "user", "vcpkg"]
},
{
"name": "xcode-visualneuro",
"displayName": "Visual Neuro XCode",
"description": "XCode development configuration",
"generator": "Xcode",
"inherits": ["user", "visualneuro"]
"inherits": ["visualneuro", "user"]
}
]
}
13 changes: 7 additions & 6 deletions apps/visualneuro/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#--------------------------------------------------------------------
# Brain Cohort Analyzer
# Do not name the CMake project VisualNeuro because it can be confused with the module
project(VisualNeuroApp)

include(version.cmake)
Expand Down Expand Up @@ -58,7 +59,7 @@ add_executable(${PROJECT_NAME} MACOSX_BUNDLE WIN32
${RES_FILES})
# Do not name the CMake project VisualNeuro because it can be confused with the module
# However, we still want the the executable to be called VisualNeuro
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "Visual Neuro")
#set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "VisualNeuroApp")
target_link_libraries(${PROJECT_NAME} PUBLIC
inviwo::core
inviwo::module-system
Expand All @@ -83,19 +84,19 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# https://cmake.org/cmake/help/v3.15/prop_tgt/MACOSX_BUNDLE_INFO_PLIST.html
string(TIMESTAMP YEAR "%Y")
set_target_properties(${PROJECT_NAME} PROPERTIES
MACOSX_BUNDLE_INFO_STRING "Visual Neuro ${VISUALNEURO_VERSION}"
MACOSX_BUNDLE_INFO_STRING "${IVW_APP_INSTALL_NAME} ${VISUALNEURO_VERSION}"
MACOSX_BUNDLE_ICON_FILE "favicon.icns"
MACOSX_BUNDLE_GUI_IDENTIFIER "com.VisualNeuro"
MACOSX_BUNDLE_LONG_VERSION_STRING "${VISUALNEURO_VERSION}"
MACOSX_BUNDLE_BUNDLE_NAME "Visual Neuro"
MACOSX_BUNDLE_BUNDLE_NAME "${IVW_APP_INSTALL_NAME}"
MACOSX_BUNDLE_SHORT_VERSION_STRING "${VISUALNEURO_VERSION}"
MACOSX_BUNDLE_BUNDLE_VERSION "${VISUALNEURO_VERSION}"
MACOSX_BUNDLE_COPYRIGHT "C) 2012-${YEAR} Daniel Jönsson"
)

install(
DIRECTORY ${IVW_ROOT_DIR}/data/
DESTINATION VisualNeuro.app/Contents/Resources/data
DESTINATION ${IVW_APP_INSTALL_NAME}.app/Contents/Resources/data
COMPONENT Application
)

Expand All @@ -110,8 +111,8 @@ endif()

ivw_deploy_qt(${PROJECT_NAME})

set_property(CACHE IVW_PACKAGE_SELECT_APP APPEND PROPERTY STRINGS "Visual Neuro")
set_property(CACHE IVW_PACKAGE_SELECT_APP APPEND PROPERTY STRINGS "VisualNeuroApp")

if(IVW_PACKAGE_SELECT_APP STREQUAL "Visual Neuro")
if(IVW_PACKAGE_SELECT_APP STREQUAL "VisualNeuroApp")
include(packaging/packaging.cmake) # Package creation
endif()
1 change: 1 addition & 0 deletions apps/visualneuro/consolewidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include <warn/pop>

#include <chrono>
#include <mutex>

class QLabel;
class QKeyEvent;
Expand Down
11 changes: 10 additions & 1 deletion apps/visualneuro/packaging/packaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,16 @@ set(CMAKE_INSTALL_OPENMP_LIBRARIES TRUE)
set(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT Application)
include (InstallRequiredSystemLibraries)

set(CPACK_PACKAGE_NAME "Visual Neuro")

if(APPLE)
# Fix for CPack Error on MacOS 13
# Error generating temporary disk image.
# hdiutil: create failed - Resource busy
# https://github.com/actions/runner-images/issues/7522#issuecomment-1564467252
set(CPACK_COMMAND_HDIUTIL "/usr/bin/sudo /usr/bin/hdiutil")
endif()

set(CPACK_PACKAGE_NAME "VisualNeuroApp")
set(CPACK_PACKAGE_CONTACT "Daniel Jönsson <info@visualneuro.com>")
set(CPACK_PACKAGE_VENDOR "Daniel Jönsson")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Interactive brain cohort analysis")
Expand Down
2 changes: 1 addition & 1 deletion apps/visualneuro/resources/visualneuro.rc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
id ICON "favicon.ico"
IDI_ICON1 ICON "favicon.ico"
2 changes: 1 addition & 1 deletion apps/visualneuro/splashscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*********************************************************************************/

#include "splashscreen.h"
#include <inviwo/core/inviwocommondefines.h>
#include <inviwo/core/common/inviwocommondefines.h>
#include <inviwo/core/util/commandlineparser.h>
#include <inviwo/core/util/stringconversion.h>
#include <modules/qtwidgets/inviwoqtutils.h>
Expand Down
2 changes: 1 addition & 1 deletion modules/visualneuro/src/datastructures/volumeatlas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ int VolumeAtlas::getLabelId(vec3 worldPos) const {
}

double VolumeAtlas::getLabelIdNormalized(int labelId) const {
return atlas_->dataMap_.mapFromValueToNormalized(static_cast<double>(labelId));
return atlas_->dataMap.mapFromValueToNormalized(static_cast<double>(labelId));
}

std::optional<VolumeAtlas::Label> VolumeAtlas::getLabel(int id) const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ fMRITransferFunctionController::fMRITransferFunctionController()
tTestVolume_.onChange([this]() {
if (tTestVolume_.hasData()) {
NetworkLock lock(this);
auto dataMap = tTestVolume_.getData()->dataMap_;
auto dataMap = tTestVolume_.getData()->dataMap;
double maxValueRange =
std::max(glm::abs(dataMap.valueRange).x, glm::abs(dataMap.valueRange).y);
thresholdtTestTF_.setMaxValue(maxValueRange);
Expand Down Expand Up @@ -353,30 +353,30 @@ void fMRITransferFunctionController::updateTFs(ActiveInput input) {
if (input == ActiveInput::Mean && meanVolume_.hasData()) {
if (TFtype(*inputDataTFtype_) == TFtype::Linear) {
updateLinearTF(linearTF2D_.get(), true, thresholdLinearTF_.get(),
opacityLinearTF_.get(), meanVolume_.getData()->dataMap_);
opacityLinearTF_.get(), meanVolume_.getData()->dataMap);
updateLinearTF(linearTF3D_.get(), false, thresholdLinearTF_.get(),
opacityLinearTF_.get(), meanVolume_.getData()->dataMap_);
opacityLinearTF_.get(), meanVolume_.getData()->dataMap);
} else if (TFtype(*inputDataTFtype_) == TFtype::Symmetric && meanVolume_.hasData()) {
updateSymmetricTF(symmetricTF2D_.get(), true, thresholdSymmetricTF_.get(),
opacitySymmetricTF_.get(), meanVolume_.getData()->dataMap_);
opacitySymmetricTF_.get(), meanVolume_.getData()->dataMap);
updateSymmetricTF(symmetricTF3D_.get(), false, thresholdSymmetricTF_.get(),
opacitySymmetricTF_.get(), meanVolume_.getData()->dataMap_);
opacitySymmetricTF_.get(), meanVolume_.getData()->dataMap);
}
} else if (input == ActiveInput::Correlation && correlationVolume_.hasData()) {
if (correlationVolume_.getData()->dataMap_.valueRange.x < 0) {
if (correlationVolume_.getData()->dataMap.valueRange.x < 0) {
updateSymmetricTF(correlationTF2D_.get(), true, thresholdCorrelationTF_.get(),
opacityCorrelationTF_.get(), correlationVolume_.getData()->dataMap_);
opacityCorrelationTF_.get(), correlationVolume_.getData()->dataMap);
updateSymmetricTF(correlationTF3D_.get(), false, thresholdCorrelationTF_.get(),
opacityCorrelationTF_.get(), correlationVolume_.getData()->dataMap_);
opacityCorrelationTF_.get(), correlationVolume_.getData()->dataMap);
} else {
updateLinearTF(correlationTF2D_.get(), true, thresholdCorrelationTF_.get(),
opacityCorrelationTF_.get(), correlationVolume_.getData()->dataMap_);
opacityCorrelationTF_.get(), correlationVolume_.getData()->dataMap);
updateLinearTF(correlationTF3D_.get(), false, thresholdCorrelationTF_.get(),
opacityCorrelationTF_.get(), correlationVolume_.getData()->dataMap_);
opacityCorrelationTF_.get(), correlationVolume_.getData()->dataMap);
}

} else if (input == ActiveInput::tTest && tTestVolume_.hasData()) {
if (tTestVolume_.getData()->dataMap_.valueRange.x < 0) {
if (tTestVolume_.getData()->dataMap.valueRange.x < 0) {
// Colormap, reversed, PuOr_8
auto leftColors = {vec3(0.32941176470588235, 0.15294117647058825, 0.5333333333333333),
vec3(0.5019607843137255, 0.45098039215686275, 0.6745098039215687),
Expand All @@ -389,16 +389,16 @@ void fMRITransferFunctionController::updateTFs(ActiveInput input) {
vec3(0.7019607843137254, 0.34509803921568627, 0.023529411764705882)};

updateSymmetricTF(tTestTF2D_.get(), true, thresholdtTestTF_.get(),
opacitytTestTF_.get(), tTestVolume_.getData()->dataMap_, leftColors,
opacitytTestTF_.get(), tTestVolume_.getData()->dataMap, leftColors,
rightColors);
updateSymmetricTF(tTestTF3D_.get(), false, thresholdtTestTF_.get(),
opacitytTestTF_.get(), tTestVolume_.getData()->dataMap_, leftColors,
opacitytTestTF_.get(), tTestVolume_.getData()->dataMap, leftColors,
rightColors);
} else {
updateLinearTF(tTestTF2D_.get(), true, thresholdtTestTF_.get(), opacitytTestTF_.get(),
tTestVolume_.getData()->dataMap_);
tTestVolume_.getData()->dataMap);
updateLinearTF(tTestTF3D_.get(), false, thresholdtTestTF_.get(), opacitytTestTF_.get(),
tTestVolume_.getData()->dataMap_);
tTestVolume_.getData()->dataMap);
}
}
} // namespace inviwo
Expand Down Expand Up @@ -472,7 +472,7 @@ void fMRITransferFunctionController::updateSymmetricTF(TransferFunction &tf, con
void fMRITransferFunctionController::updateMeanVolumeSliders(const bool updateSetValue) {
if (meanVolume_.hasData()) {
NetworkLock lock(this);
auto dataMap = meanVolume_.getData()->dataMap_;
auto dataMap = meanVolume_.getData()->dataMap;
thresholdLinearTF_.set(thresholdLinearTF_.get(), dataMap.valueRange.x, dataMap.valueRange.y,
abs(dataMap.valueRange.y - dataMap.valueRange.x) * 0.01);
double maxValueRange =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void ParameterVolumeSequenceCorrelation::process() {
for (size_t index = 0; index < volumeRAMs.size(); index++) {
if (filter[index]) continue;

auto dataMap = (*volumeSequence)[index]->dataMap_;
auto dataMap = (*volumeSequence)[index]->dataMap;
volumeRAMs[index]->dispatch<void, dispatching::filter::Scalars>(
[&values, vxlNmbr, &dataMap](auto vr) {
auto ptr_first_vxl = vr->getDataTyped();
Expand Down Expand Up @@ -207,8 +207,8 @@ void ParameterVolumeSequenceCorrelation::process() {

// Set data range and value range to (-1,1) since that's the range of the Pearson/Spearman
// correlation.
resVol->dataMap_.dataRange = dvec2(-1.0, 1.0);
resVol->dataMap_.valueRange = dvec2(-1.0, 1.0);
resVol->dataMap.dataRange = dvec2(-1.0, 1.0);
resVol->dataMap.valueRange = dvec2(-1.0, 1.0);

resVol->setModelMatrix(volumes->front()->getModelMatrix());
resVol->setWorldMatrix(volumes->front()->getWorldMatrix());
Expand Down
23 changes: 13 additions & 10 deletions modules/visualneuro/src/processors/volume4dsequencesource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ std::shared_ptr<Volume4DSequence> Volume4DSequenceSource::loadFolder(std::filesy
if (auto reader1 = rf->getReaderForTypeAndExtension<Volume>(file)) {
auto volume = reader1->readData(file, this);
volume->setMetaData<StringMetaData>("filename", file.generic_string());
volumes->push_back(std::make_shared<VolumeSequence>(1, volume));
auto tmp = std::vector<std::shared_ptr<Volume>>(1, volume);

volumes->push_back(std::make_shared<VolumeSequence>(
std::span<std::shared_ptr<Volume> >{tmp}));

} else if (auto reader2 = rf->getReaderForTypeAndExtension<VolumeSequence>(file)) {
auto volumeSeq = reader2->readData(file, this);
Expand Down Expand Up @@ -196,11 +199,11 @@ void Volume4DSequenceSource::process() {
if (!volume->hasMetaData<StringMetaData>("filename"))
volume->setMetaData<StringMetaData>("filename", file_.get().generic_string());

valueRange.x = std::min(valueRange.x, volume->dataMap_.valueRange.x);
valueRange.y = std::max(valueRange.y, volume->dataMap_.valueRange.y);
valueRange.x = std::min(valueRange.x, volume->dataMap.valueRange.x);
valueRange.y = std::max(valueRange.y, volume->dataMap.valueRange.y);

dataRange.x = std::min(dataRange.x, volume->dataMap_.dataRange.x);
dataRange.y = std::max(dataRange.y, volume->dataMap_.dataRange.y);
dataRange.x = std::min(dataRange.x, volume->dataMap.dataRange.x);
dataRange.y = std::max(dataRange.y, volume->dataMap.dataRange.y);
}
if (!volume4d->empty()) {
// set basis of first volume
Expand Down Expand Up @@ -232,11 +235,11 @@ void Volume4DSequenceSource::process() {
if (result && !result->empty()) {
// Update value range
for (auto& volumeSequence : *result) {
for (auto& volume : *volumeSequence) {
volume->dataMap_.dataRange = dvec2(
volume->dataMap_.mapFromValueToData(information_.valueRange.get().x),
volume->dataMap_.mapFromValueToData(information_.valueRange.get().y));
volume->dataMap_.valueRange = information_.valueRange.get();
for (auto volume : *volumeSequence) {
volume->dataMap.dataRange = dvec2(
volume->dataMap.mapFromValueToData(information_.valueRange.get().x),
volume->dataMap.mapFromValueToData(information_.valueRange.get().y));
volume->dataMap.valueRange = information_.valueRange.get();
}
}
outport_.setData(result);
Expand Down
Loading

0 comments on commit 7fd3e4b

Please sign in to comment.