Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation: refactoring #25

Open
wants to merge 55 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
a237f3e
wip: orion_multiscaleLaplacianFilter: implement multiscale processing
zmughal Nov 5, 2015
ac96bd8
add notes on the construction of the Laplacian in the Fourier domain
zmughal Jan 2, 2016
04664d4
WIP: stub out multiscale Laplacian filter
zmughal Jan 21, 2016
9b5c7fa
Rename volume parameter for orion_readNegativeSamples
zmughal Mar 18, 2016
cd7ace1
Finalise the multiscale Laplacian filter
zmughal Mar 28, 2016
8d5c472
Implement readNegativeSamples
zmughal Mar 28, 2016
9a74027
Add comment about getFeatures function
zmughal Mar 28, 2016
7df9471
Remove TODO
zmughal Mar 28, 2016
55f3491
Add notes about the contents of the Laplacian response
zmughal Mar 31, 2016
73dc304
Compute features with scales adjusted by the volume spacing
zmughal Mar 31, 2016
b58fe55
Helper function to compute features
zmughal Mar 31, 2016
e2575b8
Translate the Gaussian response into feature vectors
zmughal Mar 31, 2016
9c975c7
ndarray3 function to compute minimum and maximum values
zmughal Mar 31, 2016
9a4f5e9
build: fix for linking of binary with ITK dep
zmughal Mar 31, 2016
4bd97ae
Add function to reset array container size to zero
zmughal Mar 31, 2016
fce3af8
Export the filepath function for concatenating paths
zmughal Mar 31, 2016
846be22
Add struct member for classifying background voxels by Laplacian resp…
zmughal Mar 31, 2016
70b9321
Fix Laplacian adjusted scale creation
zmughal Mar 31, 2016
90aa001
Add debug logging for multiscale Laplacian filter function
zmughal Mar 31, 2016
ed05617
Read ORION3 configuration format to set parameters for segmentation
zmughal Mar 31, 2016
f13e145
Initialise multiscale segmentation to zero
zmughal Mar 31, 2016
2c5fdb9
Show usage when tool is not given any arguments
zmughal Mar 31, 2016
7453e9d
Add list of Debian packages required for building
zmughal Mar 31, 2016
0079ec3
Use more general FFT that does not require even dimensions
zmughal Apr 1, 2016
85eea22
Use more general n-d FFT functions when applying Laplacian filter
zmughal Apr 1, 2016
5f67276
Fix two memory bugs
zmughal Apr 1, 2016
4c3a94d
Add PD KISS99 RNG code
zmughal Apr 7, 2016
2291b9f
Refactor the KISS99 RNG code
zmughal Apr 7, 2016
1d8a420
Organise the KISS99 RNG headers and tests
zmughal Apr 11, 2016
811515f
Remove unused variable
zmughal Apr 11, 2016
953ecdd
Add structure member to segmentation parameters for RNG state
zmughal Apr 11, 2016
f077520
Add function to free RNG state
zmughal Apr 16, 2016
0ca88ca
initialise the RNG when starting the segmentation
zmughal Apr 16, 2016
39c203d
Project specific Vim settings with autocmd
zmughal Apr 16, 2016
821a7d9
Add algorithm for sampling without replacement
zmughal Apr 16, 2016
11469a8
Add test for uniform RNG (mean and variance)
zmughal Apr 16, 2016
3f4f731
Return the sample array
zmughal Apr 17, 2016
e4087ba
Update the discriminant function code
zmughal Apr 25, 2016
f15e982
Use die() instead of exit() for failures in _orion_rand_seeds
zmughal Apr 25, 2016
7ee10ec
Add platform-specific defines
zmughal Apr 25, 2016
fb29a59
Configuration generator output needs warning about editing
zmughal Apr 25, 2016
9405b05
Add NOECHO setting to decrease build output
zmughal Apr 25, 2016
8ccb0e4
Add a macro to increment ndarray3 elements
zmughal Apr 25, 2016
b10251d
Add functions to init and manipulate the 2D histogram
zmughal Apr 26, 2016
79c0e10
Improve indexing of histogram
zmughal Apr 26, 2016
8a9b234
VTK build configuration
zmughal May 24, 2016
52ee36d
Move the generated ITK/VTK make configuration into the BUILDDIR
zmughal Jun 10, 2016
3e17468
Travis-CI: Add libvtk5-dev to the list of packages
zmughal Jun 10, 2016
2dff9bb
Travis-CI: build in trusty environment
zmughal Jun 11, 2016
de503ea
Travis-CI: install ITK/VTK version from trusty packages
zmughal Jun 11, 2016
f9c5cf6
build: Add support for VTK C++ compilation
zmughal Jun 11, 2016
9642be5
Identify TODO items
zmughal Jun 29, 2016
82fea6a
VTK linking and histogram normalisation work
zmughal Jun 29, 2016
94de3fe
Set up Doxygen
zmughal Dec 23, 2016
4c4d700
Change Doxygen settings for this project
zmughal Dec 23, 2016
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
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ CMakeFiles
ITKIOFactoryRegistration
cmake_install.cmake

/make/itk/itk-config.mk.gen

/ComputeFrangi/Makefile
/ComputeFrangi/ComputeEigenValue_Sorted_Frangi

Expand All @@ -21,6 +19,7 @@ ComputeFilter
/.build
/.deps
/bin
/doxygen-doc

*~
*.a
Expand Down
13 changes: 8 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
language: c
sudo: false
os: linux
dist: trusty
sudo: required
addons:
apt:
packages:
- libvtk6-dev
- libinsighttoolkit4-dev
env:
- PROD=1 TEST_VERBOSE=1
- PROD=1 TEST_VERBOSE=1 COVERAGE=1
compiler:
- gcc
- clang
before_install:
- mkdir build
- git clone https://github.com/CBL-ORION/ITK-builds.git external/ITK
# path for CMake to search for built ITK
- export ITK_DIR="`( cd external/ITK/usr/local/lib/cmake/ITK-4.9 && pwd )`"
- if [ "$COVERAGE" = 1 ]; then pip install --user cpp-coveralls; fi
script:
# version of gcc on Travis-CI does not support ASAN flag
Expand Down
21 changes: 19 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ BIN_SRC_CONFIG.c := $(SRCDIR)/config/configurator.c
BIN_SRC.cc := $(SRCDIR)/compute-filter/ComputeFilter.cxx $(SRCDIR)/subsample-volume/SubsampleVolume.cxx
#LIB_SRC.c := $(LIBDIR)/ndarray/ndarray3.c # $(LIBDIR)/filter/hdaf/Makefilter.c
LIB_SRC.c := $(shell find $(LIBDIR) -path lib/t -prune -o -type f -name '*.c' \! -name '*_impl.c' -print)
LIB_SRC.cc := $(shell find $(LIBDIR) \
-path lib/t -prune -o \
-path lib/vaa3d-plugin -prune -o \
-path lib/config -prune -o \
-path lib/filter/vesselness -prune -o \
-path lib/integration -prune -o \
-type f -name '*.cxx' -print)
$(echo $(LIB_SRC.cc))
TEST.c := $(shell find $(TESTDIR) -path lib/t/liborion3mat -prune -o -type f -name "*.c" -print)
ifdef FEAT_LIBORION3MAT
TEST.c += $(TESTDIR)/liborion3mat/test.c
Expand All @@ -16,11 +24,13 @@ include make/autodep.mk

## Target files
OBJ_PATHSUBST.c = $(patsubst $(LIBDIR)/%.c,$(BUILDDIR)/%.o,$(1))
OBJ_PATHSUBST.cc = $(patsubst $(LIBDIR)/%.cxx,$(BUILDDIR)/%.o,$(1))
TEST_PATHSUBST.c = $(patsubst $(TESTDIR)/%.c,$(BUILDTESTDIR)/%$(EXEEXT),$(1))
BIN_PATHSUBST.c = $(patsubst $(SRCDIR)/%.c,$(BINDIR)/%$(EXEEXT),$(1))
BIN_PATHSUBST.cc = $(patsubst $(SRCDIR)/%.cxx,$(BINDIR)/%$(EXEEXT),$(1))

MKDIR_BUILD = mkdir -p `dirname $(call OBJ_PATHSUBST.c,$<)`
MKDIR_BUILD.c = mkdir -p `dirname $(call OBJ_PATHSUBST.c,$<)`
MKDIR_BUILD.cc = mkdir -p `dirname $(call OBJ_PATHSUBST.cc,$<)`
MKDIR_BIN = mkdir -p `dirname $(call BIN_PATHSUBST.c,$<)`
MKDIR_BUILDTESTDIR = mkdir -p `dirname $(call TEST_PATHSUBST.c,$<)`

Expand All @@ -29,9 +39,11 @@ include make/vaa3d-plugin-config.mk
include make/test-config.mk
include make/liborion3mat-config.mk
include make/misc-config.mk
include make/liborion-config.mk

## Generate the targets
LIB_OBJ:= $(call OBJ_PATHSUBST.c,$(LIB_SRC.c))
LIB_OBJ+= $(call OBJ_PATHSUBST.cc,$(LIB_SRC.cc))

TEST_OBJ:= $(call TEST_PATHSUBST.c,$(TEST.c))

Expand All @@ -43,7 +55,7 @@ CONFIG_HEADER_FILE := $(LIBDIR)/config/config.h
$(CONFIG_HEADER_FILE): $(BIN_BIN_CONFIG.c)
$(BIN_BIN_CONFIG.c) > $@

.PHONY: tags
.PHONY: tags $(DOXYGENDIR)

ifdef PROD
DEV_TARGETS :=
Expand All @@ -66,6 +78,7 @@ clean:
-find . -type f -name '*.o' -delete
-find . -type f \( -name '*.gcda' -o -name '*.gcno' -o -name '*.gcov' \) -delete
-rm -Rf $(OUTPUT_DIRS)
-rm -Rf $(DOXYGENDIR)
-rm -Rf $(ITK_CONFIG_MK)
-rm -Rf $(GCOVDIR) $(LCOVDIR)
-rm -Rf $(CONFIG_HEADER_FILE)
Expand All @@ -78,6 +91,10 @@ include make/00-implicit-rules.mk
-include $(LIB_SRC.c:$(LIBDIR)/%.c=$(DEPDIR)/$(LIBDIR)/%.P)
-include $(TEST.c:$(TESTDIR)/%.c=$(DEPDIR)/$(TESTDIR)/%.P)

doc: $(DOXYGENDIR)

$(DOXYGENDIR): make/Doxyfile
doxygen $<
tags:
ctags --exclude=external -R .
# add the ORION 3 code to the tags so that it is easy to jump to the other codebase
Expand Down
2 changes: 2 additions & 0 deletions debian-packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cmake
libinsighttoolkit4-dev
41 changes: 41 additions & 0 deletions lib/config/platform.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#ifndef CONFIG_PLATFORM_H
#define CONFIG_PLATFORM_H 1

/* define OS_* macros */
#if defined(_WIN32)
#define OS_WINDOWS 1
#else
#define OS_UNIX 1
#endif


/* Platform specific settings */

/* On Windows */
#if OS_WINDOWS
#if _MSC_VER && !__INTEL_COMPILER
/* Microsoft compiler */

/* needed for the secure rand_s function */
#define _CRT_RAND_S 1
#include <stdlib.h>

#endif

/* the extension used for executables */
#ifndef PLATFORM_EXE_EXT
#define PLATFORM_EXE_EXT ".exe"
#endif /* PLATFORM_EXE_EXT */

#endif /* OS_WINDOWS */

#if OS_UNIX

/* the extension used for executables */
#ifndef PLATFORM_EXE_EXT
#define PLATFORM_EXE_EXT ""
#endif /* PLATFORM_EXE_EXT */

#endif /* OS_UNIX */

#endif /* CONFIG_PLATFORM_H */
5 changes: 5 additions & 0 deletions lib/container/array_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,8 @@ void TYPED_NAME(array_resize) ( TYPED_NAME(array)* array, size_t new_capacity )
RESIZE_COUNT(array->data, TYPE, new_capacity);
array->capacity = new_capacity;
}

void TYPED_NAME(array_reset) ( TYPED_NAME(array)* array ) {
assert( array != NULL );
array->length = 0;
}
2 changes: 2 additions & 0 deletions lib/container/array_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ extern void TYPED_NAME(array_add) ( TYPED_NAME(array)* array, TYPE data );

/* ==== memory management ==== */
extern void TYPED_NAME(array_resize) ( TYPED_NAME(array)* array, size_t new_capacity );
/* Resets the length of the array to zero. Does not free elements! */
extern void TYPED_NAME(array_reset) ( TYPED_NAME(array)* array );

#ifdef __cplusplus
};
Expand Down
1 change: 0 additions & 1 deletion lib/io/path/path.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ orion_filepath* orion_filepath_new_from_string(const char* fp_string) {
char* fp_string_norm;
size_t fp_string_norm_len;
safe_malloc_and_strcpy(&fp_string_norm, fp_string);
size_t fp_string_len = strlen( fp_string );

orion_filepath* fp = _orion_filepath_init();

Expand Down
1 change: 1 addition & 0 deletions lib/io/path/path.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ extern char* orion_filepath_to_string(orion_filepath* fp);
extern orion_filepath* orion_filepath_base( orion_filepath* fp );
extern orion_filepath* orion_filepath_dir( orion_filepath* fp );

extern orion_filepath* orion_filepath_cat( orion_filepath* fp1, orion_filepath* fp2 );
extern orion_filepath* orion_filepath_sibling( orion_filepath* base, orion_filepath* relative);

#ifdef __cplusplus
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* dead code
/* TODO turn into test
*
* Refactor testSigma
*
* external/orion3mat/01_Segmentation/dendrites_main/DetectTrainingSet/How_sigma_relates_to_radii/testSigma.m
*/
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/*
* Refactor: Makefilter
*/

#include "kitchen-sink/01_Segmentation/dendrites_main/DetectTrainingSet/IsotropicFilter/Makefilter.h"

Expand All @@ -11,6 +8,10 @@

#include "kitchen-sink/01_Segmentation/dendrites_main/DetectTrainingSet/IsotropicFilter/hdaf.h"

/* MATLAB version: Makefilter */

/* TODO document
*/
ndarray3* orion_Makefilter(
size_t nx, size_t ny, size_t nz,
int hdaf_approx_degree,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* TODO
/* TODO: part of testing
*
* Refactor: compute_LP
*/
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* TODO
/* dead code
*
* Refactor: compute_Laplacian
*/
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/*
* Refactor: hdaf
*/
#include "hdaf.h"

#include <math.h>

#include "numeric/func.h"

/* MATLAB version: hdaf */

/*
* orion_hdaf( hdaf_approx_degree, scaling_constant, x)
*
Expand Down
Loading