Skip to content

Commit

Permalink
Merge commit '3260f34bfd791c462d897dada86d05c48b5030da'
Browse files Browse the repository at this point in the history
  • Loading branch information
pjarosik committed Jan 22, 2021
2 parents 4973be6 + 3260f34 commit 304f120
Show file tree
Hide file tree
Showing 317 changed files with 24,014 additions and 3,725 deletions.
4 changes: 2 additions & 2 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Configuration for probot-stale - https://github.com/probot/stale

# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 60
daysUntilStale: 365

# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
daysUntilClose: 7
daysUntilClose: 365

# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
onlyLabels: []
Expand Down
82 changes: 70 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
cmake_minimum_required(VERSION 3.17.0)

project(arrus LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
# Version
set(PROJECT_VERSION 0.4.6)
set(PROJECT_VERSION 0.5.9)

option(ARRUS_DEVELOP_VERSION "Build develop version." ON)
if(ARRUS_DEVELOP_VERSION)
set(PROJECT_FULL_VERSION "${PROJECT_VERSION}-dev")
Expand All @@ -11,20 +13,28 @@ else()
endif()

string(TIMESTAMP CURRENT_YEAR "%Y")
set(CMAKE_CXX_STANDARD 17)

################################################################################
# Modules
################################################################################
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
set(CMAKE_MODULE_PATH
"${PROJECT_SOURCE_DIR}/cmake"
${CMAKE_BINARY_DIR} # Includes cmake scripts generated by conan package
${CMAKE_MODULE_PATH}
)

################################################################################
# Global options and settings
################################################################################
include(common)

set(ARRUS_ROOT_DIR ${CMAKE_SOURCE_DIR})
set(ARRUS_DOCS_INSTALL_DIR docs)
set(ARRUS_MATLAB_INSTALL_DIR matlab)
set(ARRUS_PYTHON_INSTALL_DIR python)

set(Us4_LIB_DIR ${Us4_ROOT_DIR}/lib64)

option(ARRUS_BUILD_PY "Build python API." OFF)
option(ARRUS_BUILD_MATLAB "Build MATLAB API." OFF)
option(ARRUS_BUILD_DOCS "Build documentation." OFF)
Expand All @@ -39,20 +49,64 @@ if(NOT ARRUS_BUILD_SWIG)
message(WARNING "BUILDING PACKAGE WITHOUT LOW-LEVEL API WRAPPERS!")
endif()

# Determining host platform.
if(MSVC)
set(ARRUS_BUILD_PLATFORM windows)
elseif(UNIX AND NOT APPLE)
set(ARRUS_BUILD_PLATFORM linux)
else()
message(FATAL_ERROR "Unsupported platform.")
endif()

# Common C++ compile options
if("${ARRUS_BUILD_PLATFORM}" STREQUAL "windows")
# permissive- is required by range-v3/0.5.0
set(ARRUS_CPP_COMMON_COMPILE_OPTIONS /permissive- /EHsc)
set(ARRUS_CPP_STRICT_COMPILE_OPTIONS "/W4 /WX")

set(ARRUS_CPP_COMMON_COMPILE_DEFINITIONS
_WIN32
# warnings occurs in boost bimap implementation headers
_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING
_CRT_SECURE_NO_WARNINGS)
else("${ARRUS_BUILD_PLATFORM}" STREQUAL "linux")
set(ARRUS_CPP_COMMON_COMPILE_OPTIONS "")
set(ARRUS_CPP_STRICT_COMPILE_OPTIONS "-Wall -Wextra -pedantic -Werror")
set(ARRUS_CPP_COMMON_COMPILE_DEFINITIONS
ARRUS_LINUX
_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING)
endif()

# installation directories
set(ARRUS_BIN_INSTALL_DIR bin)
set(ARRUS_LIB_INSTALL_DIR lib64)
set(ARRUS_INCLUDE_INSTALL_DIR include)
set(ARRUS_DOCS_INSTALL_DIR docs)

################################################################################
# Common dependencies
################################################################################
if(ARRUS_BUILD_SWIG)
find_package(Us4 0.4.6 EXACT REQUIRED US4OEM HV256 DBARLite)
find_package(Us4 0.5.3 EXACT REQUIRED US4OEM HV256 DBARLite)
endif()

find_package(Boost REQUIRED)
set(Boost_USE_STATIC_LIBS ON)
find_package(protobuf REQUIRED)
# Use project root to search for .proto files.
set(Protobuf_IMPORT_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
find_package(fmt REQUIRED)
find_package(Microsoft.GSL REQUIRED)
find_package(Eigen3 REQUIRED)
################################################################################
# Sub-projects
################################################################################
add_subdirectory(core)
if(ARRUS_RUN_TESTS)
include(tests)
enable_testing()
endif()

add_subdirectory(arrus/core)

if(ARRUS_BUILD_PY)
add_subdirectory(api/python)
endif()
Expand All @@ -76,26 +130,30 @@ install(
# Embed external dependencies
################################################################################
if(ARRUS_EMBED_DEPS)
message("ROOT DIR: ${Us4_ROOT_DIR}")
# TODO Remove transitive dependency on boost (embed deps directly).
message("Us4r API ROOT DIR: ${Us4_ROOT_DIR}")
# Sanitize provided path.
string(REPLACE "\\" "/" Us4_ROOT_DIR_SANITIZED ${Us4_ROOT_DIR})

install(
DIRECTORY
${Us4_ROOT_DIR}/lib64/
${Us4_ROOT_DIR_SANITIZED}/lib64/
DESTINATION
lib64
${ARRUS_LIB_INSTALL_DIR}
)
install(
FILES
# TODO(pjarosik) make it more general (will not work for OS!=win)
${Us4_ROOT_DIR}/matlab/Us4MEX.mexw64
${Us4_ROOT_DIR_SANITIZED}/matlab/Us4MEX.mexw64
DESTINATION
matlab/arrus
)
install(
FILES
# TODO(pjarosik) make it more general (will not work for OS!=win)
${Us4_ROOT_DIR}/bin/us4OEMFirmwareUpdate.exe
${Us4_ROOT_DIR_SANITIZED}/bin/us4OEMFirmwareUpdate.exe
DESTINATION
bin
${ARRUS_BIN_INSTALL_DIR}
)
endif()

2 changes: 2 additions & 0 deletions api/matlab/+arrus/+devices/+probe/Probe.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
classdef Probe < arrus.MexObject
end
29 changes: 29 additions & 0 deletions api/matlab/+arrus/+devices/+probe/ProbeModel.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
classdef ProbeModel
% Probe model.
%
% :param modelId: id of the model
% :param nElements: (scalar (for 2-D probe) or a pair (for 3-D probe))\
% probe's number of elements
% :param pitch: (scalar (for 2-D probe) or a pair (for 3-D probe))\
% probe's element pitch
% :param txFrequencyRange: (a pair - two-element vector)
% a range [min, max] of the available tx center frequencies

properties(GetAccess = public, SetAccess = private)
modelId arrus.devices.probe.ProbeModelId
nElements
pitch
txFrequencyRange (1, 2)
end

methods
function obj = ProbeModel(modelId, nElements, pitch, ...
txFrequencyRange)
obj.modelId = modelId;
obj.nElements = nElements;
obj.pitch = pitch;
obj.txFrequencyRange = txFrequencyRange;
end
end

end
19 changes: 19 additions & 0 deletions api/matlab/+arrus/+devices/+probe/ProbeModelId.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
classdef ProbeModelId
% Probe model id.
%
% :param manufacturer: name of the manufacturer
% :param name: name of the model

properties(GetAccess = public, SetAccess = private)
manufacturer
name
end

methods
function obj = ProbeModelId(manufacturer, name)
obj.manufacturer = convertCharsToStrings(manufacturer);
obj.name = convertCharsToStrings(name);
end
end
end

22 changes: 22 additions & 0 deletions api/matlab/+arrus/+devices/+probe/ProbeSettings.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
classdef ProbeSettings
% Probe adapter settings.
%
% :param probeModel: probe's model description
% :param channelMapping: (vector 1 x nChannels) channel mapping to \
% apply; if the `i`-th value is equal to `j`, it means that the \
% probe's channel `i` is connected to connector's channel `j`.

properties(GetAccess = public, SetAccess = private)
probeModel arrus.devices.probe.ProbeModel
channelMapping
end

methods(Access = public)

function obj = ProbeSettings(probeModel, channelMapping)
obj.probeModel = probeModel;
obj.channelMapping = channelMapping;
end

end
end
2 changes: 2 additions & 0 deletions api/matlab/+arrus/+devices/+us4r/ProbeAdapter.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
classdef ProbeAdapter < arrus.MexObject
end
19 changes: 19 additions & 0 deletions api/matlab/+arrus/+devices/+us4r/ProbeAdapterModelId.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
classdef ProbeAdapterModelId
% Probe adapter model id.
%
% :param name: name of the model
% :param manufacturer: name of the manufacturer

properties(GetAccess = public, SetAccess = private)
manufacturer
name
end

methods
function obj = ProbeAdapterModelId(manufacturer, name)
obj.manufacturer = convertCharsToStrings(manufacturer);
obj.name = convertCharsToStrings(name);
end
end
end

28 changes: 28 additions & 0 deletions api/matlab/+arrus/+devices/+us4r/ProbeAdapterSettings.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
classdef ProbeAdapterSettings
% Probe adapter settings.
%
% :param modelId: id of the model
% :param nChannels: number of adapter output channels
% :param channelMapping: (matrix 2 x nChannels) channel mapping to \
% apply; for each i-th column the first row should be equal to the \
% Us4OEM's ordinal number (`o`), second row should be equal to \
% Us4OEM's channel; such a column means that adapter's channel \
% `i` is connected to o-th Us4OEM, channel number `ch`.

properties(GetAccess = public, SetAccess = private)
modelId arrus.devices.us4r.ProbeAdapterModelId
nChannels (1, 1)
channelMapping
end

methods(Access = public)
function obj = ProbeAdapterSettings(modelId, nChannels, ...
channelMapping)

obj.modelId = modelId;
obj.nChannels = nChannels;
obj.channelMapping = channelMapping;
end
end

end
48 changes: 48 additions & 0 deletions api/matlab/+arrus/+devices/+us4r/RxSettings.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
classdef RxSettings
% Us4R data acquisition settings.
%
% :param dtgcAttenuation: (scalar, optional), DTGC attenuation value, \
% when set to empty array, DTGC will be off [dB]
% :param pgaGain: (scalar) Programable Gain Amplifier gain value [dB]
% :param lnaGain: (scalar) Low-noise Amplifier gain value [dB]
% :param tgcSamples: (vector, optional) TGC curve to apply, when set \
% to empty array, TGC will be off [dB]
% :param lpfCutoff: Low-pass filter cutoff value [Hz]
% :param activeTermination: active termination value

properties(GetAccess = public, SetAccess = private)
dtgcAttenuation
pgaGain (1, 1)
lnaGain (1, 1)
tgcSamples
lpfCutoff
activeTermination
end

methods(Access = public)

function obj = RxSettings(varargin)
% Rx settings constructor.
%
% Values can be provided in the order of the class properties
% or by providing a list of 'param1Name', 'param1Value',
% 'param2Name', 'param2Value', ...
mc = metaclass(obj);
nParams = size(mc.PropertyList);
nParams = nParams(1);
if nargin == nParams
for i = 1:nParams
obj.(mc.PropertyList(i).Name) = varargin{i};
end
elseif nargin == 2*nParams
for i = 1:2:nargin
obj.(varargin{i}) = varargin{i+1};
end
else
error("ARRUS:IllegalArgument", "Invalid number of arguments.");
end
end

end

end
3 changes: 3 additions & 0 deletions api/matlab/+arrus/+devices/+us4r/Us4OEM.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
classdef Us4OEM < arrus.MexObject

end
27 changes: 27 additions & 0 deletions api/matlab/+arrus/+devices/+us4r/Us4OEMSettings.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
classdef Us4OEMSettings
% Us4OEM module settings.
%
% :param channelMapping: (128 element vector) channel mapping
% (permutation) to apply for given Us4OEM
% :param activeChannelGroups: (16 element vector) a boolean vector,
% true at position `i` means that the i-th group should be active.
% :param rxSettings: Rx settings to apply to given Us4OEM

properties(GetAccess = public, SetAccess = private)
channelMapping (1, 128)
activeChannelGroups (1, 16)
rxSettings arrus.devices.us4r.RxSettings
end

methods(Access = public)
function obj = Us4OEMSettings(channelMapping, ...
activeChannelGroups, ...
rxSettings)

obj.channelMapping = channelMapping;
obj.activeChannelGroups = activeChannelGroups;
obj.rxSettings = rxSettings;
end
end

end
3 changes: 3 additions & 0 deletions api/matlab/+arrus/+devices/+us4r/Us4R.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
classdef Us4R < arrus.MexObject

end
Loading

0 comments on commit 304f120

Please sign in to comment.