Skip to content
Snippets Groups Projects
Commit cd260ce2 authored by Floris Berendsen's avatar Floris Berendsen
Browse files

Merge branch 'develop' into ELASTIX-24-Component-Interface-Handshake

parents d845a26d 27392ab4
No related branches found
No related tags found
No related merge requests found
......@@ -15,10 +15,6 @@ set( ELASTIX_DASHBOARD_LOGSTASH_RSA_PRIVATE_KEY "elxLogstash.key" )
mark_as_advanced( ELASTIX_DASHBOARD_VOLUME )
if( NOT EXISTS "${ELASTIX_DASHBOARD_VOLUME}" )
message( STATUS
"ELASTIX_DASHBOARD_VOLUME points to the folder ${CMAKE_BINARY_DIR}/Testing/Dashboard/Data in your build directory. In production you should point this variable to a safe directory outside the build tree."
)
set( ELASTIX_DASHBOARD_VOLUME "${ELASTIX_DASHBOARD_BINARY_DIR}/Data" )
file( MAKE_DIRECTORY "${ELASTIX_DASHBOARD_VOLUME}" )
endif()
......@@ -46,4 +42,9 @@ configure_file(
configure_file(
${ELASTIX_DASHBOARD_SOURCE_DIR}/elxLogstashForwarder.json.in
${ELASTIX_DASHBOARD_BINARY_DIR}/elxLogstashForwarder.json
)
\ No newline at end of file
)
# ---------------------------------------------------------------------
# SSL certificates
# Use the following OpenSSL command to generate a test certificate and key if needed
# openssl req -subj '/CN=*/' -x509 -batch -nodes -days 9999 -newkey rsa:2048 -keyout elxLogstash.key -out elxLogstash.crt
-----BEGIN CERTIFICATE-----
MIIDGjCCAgKgAwIBAgIJAMF8GSVtnyB6MA0GCSqGSIb3DQEBBQUAMBIxEDAOBgNV
BAMTB2VsYXN0aXgwHhcNMTUwODEyMTQxNjE1WhcNMTUwOTExMTQxNjE1WjASMRAw
DgYDVQQDEwdlbGFzdGl4MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
01P404f+W/aBLxlQTFyHy1o7m07edUmFIjJuN9JjGTzZtlhAEc7dXJ8fUwr/hnLq
HUeaGRbNcpFDj+/Xq2W9jH7/VyxivA8Ib7ycLNxywgmheZVxXetPIeYmK+Rqovyd
G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GPLluXjFe
Ryq4/l5C07pyyx9BaHP1Xx5vlQkCYOVDCTu6tKk+TesEgTHIXoedkAMCgYEAy7WB
SOHj8h2r5QQ33VoPIqDPORg5WwsFEPw+efCzevmTOCzLYwdcZudtA3xRZPSE7wwY
s2J1MO9QzKeuzSldsBCUDeQoXblOVUJX/qveCka+Zn1AE4pztq3fo6JJIvVSpFC6
YNJDfOXNwtMdwWeoy1x9aJl/auykMdSwzARi3k8CgYA9oO4QK2b76hhLzQzGuf4f
yvQIs0Zll2ITMfvTARxYttF45d6q+gxhAu4KVkpLhLIeQmWhFTtfCCHKqtv5c7np
VFJicA5Ss9KUZxSZfK0CfgNZmeJ2jMOJEL7IiNst5Q4Zi+fYe2zFTGIq8EzPMDyh
Q9uBELn1doAK4At51+qzlwKBgETOMbTkV5HX48+e9R+W47XWiyfFvtm5hySNjqyx
WG4ZDljTCH+SZOt9D501yGhJDv2PIGi2wM6ehrQZjzlM15A4iUmH3vqJNKQnnIEw
m/bsnjMP6yyufxcc84TZs8pTAm7ttYYufw0Ysb80f8Brut+1hcZm0lrTQ0JxjKXc
dWiRAoGBANIerU9KV0GYgvY0wvBitwP/0j4jLfHfVPCp6Y515MB5hXCf6RF3vAg4
WWOu55cOqBGzouJoCJGcYR5Re/7b2AKqsfjnfFF6gl87T7xSGFEHjNK0q/UcPQQ/
FxCfc2iwx90m56ZahbFnMh1y1i/NVqD0y3xUyJN0kt6zIT3j+BR1
-----END RSA PRIVATE KEY-----
Subproject commit 7c508e6611f14cbc0da048c0e726870b93b1cc00
......@@ -5,9 +5,8 @@
set( ElastixUnitTestFilenames
elxExampleUnitTest.cxx
elxBluePrintTest.cxx
itkRegistration.cxx
)
elxBlueprintTest.cxx
)
# ---------------------------------------------------------------------
# Set data directories
......@@ -45,11 +44,9 @@ list( APPEND TEST_LIBRARIES
foreach( ElastixUnitTestFilename ${ElastixUnitTestFilenames} )
# Build tests executables
string( REPLACE ".cxx" "" ElastixUnitTest ${ElastixUnitTestFilename} )
add_executable( "${ElastixUnitTest}" ${ElastixUnitTestFilename} )
add_executable( ${ElastixUnitTest} ${ElastixUnitTestFilename} )
target_link_libraries( "${ElastixUnitTest}" ${ELASTIX_LIBRARIES} ${ITK_LIBRARIES} ${TEST_LIBRARIES} )
ExternalData_Add_Test( ElastixData
NAME ${ElastixUnitTest}
COMMAND ${ElastixUnitTest} "--gtest_output=xml:${CMAKE_BINARY_DIR}/Testing/Unit/${ElastixUnitTest}.xml"
)
# Add GoogleTest to CTest
GTEST_ADD_TESTS( ${ElastixUnitTest} "--gtest_output=xml:${CMAKE_BINARY_DIR}/Testing/Unit/${ElastixUnitTest}.xml" ${ElastixUnitTestFilename} )
endforeach()
#include "elxBlueprint.h"
#include "elxComponentDescriptor.h"
#include "gtest/gtest.h"
namespace elx {
TEST( Blueprint, Instantiation )
class BlueprintTest : public ::testing::Test {
public:
typedef Blueprint::Pointer BlueprintPointerType;
typedef Blueprint::ComponentIndexType ComponentIndexType;
typedef Blueprint::ParameterMapType ParameterMapType;
typedef Blueprint::ParameterValueType ParameterValueType;
virtual void SetUp() {
parameterMap["ComponentName"] = ParameterValueType(1, "TestName");
}
ParameterMapType parameterMap;
};
TEST_F( BlueprintTest, AddComponent )
{
BlueprintPointerType blueprint;
EXPECT_NO_THROW( blueprint = Blueprint::New() );
ComponentIndexType index0;
EXPECT_NO_THROW( index0 = blueprint->AddComponent() );
ComponentIndexType index1;
EXPECT_NO_THROW( index1 = blueprint->AddComponent( parameterMap ) );
}
TEST_F( BlueprintTest, GetComponent )
{
BlueprintPointerType blueprint = Blueprint::New();
ComponentIndexType index = blueprint->AddComponent( parameterMap );
ParameterMapType parameterMapTest;
EXPECT_NO_THROW( parameterMapTest = blueprint->GetComponent( index ) );
EXPECT_EQ( parameterMap["ComponentName"], parameterMapTest["ComponentName"] );
}
TEST_F( BlueprintTest, SetComponent )
{
BlueprintPointerType blueprint = Blueprint::New();
ComponentIndexType index = blueprint->AddComponent( parameterMap );
ParameterMapType parameterMapTest;
EXPECT_NO_THROW( blueprint->SetComponent( index, parameterMap ) );
EXPECT_NO_THROW( parameterMapTest = blueprint->GetComponent( index ) );
EXPECT_EQ( parameterMap["ComponentName"], parameterMapTest["ComponentName"] );
}
// TODO: The final line segfaults because GetComponent does not check that the index actually
// actually exist. How can we do that? See also explanation in elxBlueprint.h
// TEST_F( BlueprintTest, DeleteComponent )
// {
// BlueprintPointerType blueprint = Blueprint::New();
// ComponentIndexType index = blueprint->AddComponent( parameterMap );
//
// ParameterMapType parameterMapTest;
// EXPECT_NO_THROW( parameterMapTest = blueprint->GetComponent( index ) );
// EXPECT_EQ( parameterMap["ComponentName"], parameterMapTest["ComponentName"] );
//
// EXPECT_NO_THROW( blueprint->DeleteComponent( index ) );
// EXPECT_ANY_THROW( parameterMapTest = blueprint->GetComponent( index ) );
// }
TEST_F( BlueprintTest, AddConnection )
{
BlueprintPointerType blueprint = Blueprint::New();
ComponentIndexType index0 = blueprint->AddComponent();
ComponentIndexType index1 = blueprint->AddComponent();
ComponentIndexType index2 = blueprint->AddComponent();
// Connection should not exist
EXPECT_FALSE( blueprint->ConnectionExists( index0, index1 ) );
// Connection should be added
EXPECT_TRUE( blueprint->AddConnection( index0, index1 ) );
// Connection should exist
EXPECT_TRUE( blueprint->ConnectionExists( index0, index1 ) );
// Another connection between same components should not be added
// (user should use SetComponent() instead)
EXPECT_FALSE( blueprint->AddConnection( index0, index1 ) );
// Connection should be empty
ParameterMapType parameterMapTest0;
EXPECT_NO_THROW( parameterMapTest0 = blueprint->GetConnection( index0, index1 ) );
EXPECT_EQ( 0u, parameterMapTest0.size() );
// Connection with properties should be added. Testing if properties was
// properly set requires a call to GetConnection() which is the responsibility
// of the next test.
ParameterMapType parameterMapTest1;
EXPECT_TRUE( blueprint->AddConnection( index1, index2, parameterMap ) );
// It is not be possible to add connection between components that do not exist
// because you do not have necessary indexes
}
TEST_F( BlueprintTest, GetConnection )
{
BlueprintPointerType blueprint = Blueprint::New();
ComponentIndexType index0 = blueprint->AddComponent();
ComponentIndexType index1 = blueprint->AddComponent();
ParameterMapType parameterMapTest0;
EXPECT_TRUE( blueprint->AddConnection( index0, index1, parameterMap ) );
EXPECT_NO_THROW( parameterMapTest0 = blueprint->GetConnection( index0, index1 ) );
EXPECT_EQ( parameterMap["ComponentName"], parameterMapTest0["ComponentName"] );
}
TEST_F( BlueprintTest, SetConnection )
{
BlueprintPointerType blueprint = Blueprint::New();
ComponentIndexType index0 = blueprint->AddComponent();
ComponentIndexType index1 = blueprint->AddComponent();
blueprint->AddConnection( index0, index1, parameterMap );
ParameterMapType parameterMapTest0;
parameterMapTest0 = blueprint->GetConnection( index0, index1 );
EXPECT_EQ( parameterMap["ComponentName"], parameterMapTest0["ComponentName"] );
ParameterMapType parameterMapTest1;
parameterMapTest1["ComponentName"] = ParameterValueType(1, "OtherName");
EXPECT_TRUE( blueprint->SetConnection( index0, index1, parameterMapTest1 ) );
ParameterMapType parameterMapTest2;
EXPECT_NO_THROW( parameterMapTest2 = blueprint->GetConnection( index0, index1 ) );
EXPECT_EQ( parameterMapTest1["ComponentName"], parameterMapTest2["ComponentName"] );
}
TEST_F( BlueprintTest, DeleteConnection )
{
typedef Blueprint< ComponentDescriptor > BlueprintType;
BlueprintType::Pointer blueprint;
EXPECT_NO_THROW( blueprint = BlueprintType::New() );
BlueprintPointerType blueprint = Blueprint::New();
typedef BlueprintType::ComponentDescriptorType ComponentDescriptorType;
ComponentDescriptorType::Pointer componentDescriptor;
EXPECT_NO_THROW( componentDescriptor = ComponentDescriptorType::New() );
ComponentIndexType index0 = blueprint->AddComponent();
ComponentIndexType index1 = blueprint->AddComponent();
blueprint->AddConnection( index0, index1 );
// Connection should exist
EXPECT_TRUE( blueprint->ConnectionExists( index0, index1 ) );
// Connection be deleted
EXPECT_TRUE( blueprint->DeleteConnection( index0, index1 ) );
// Connection should not exist
EXPECT_FALSE( blueprint->ConnectionExists( index0, index1 ) );
}
TEST_F( BlueprintTest, WriteBlueprint )
{
BlueprintPointerType blueprint = Blueprint::New();
typedef ComponentDescriptorType::ComponentNameType ComponentNameType;
ComponentNameType componentName;
EXPECT_NO_THROW( componentName = ComponentNameType("Metric") );
EXPECT_NO_THROW( componentDescriptor->SetComponentName( componentName ) );
ComponentIndexType index0 = blueprint->AddComponent();
ComponentIndexType index1 = blueprint->AddComponent();
ComponentIndexType index2 = blueprint->AddComponent();
ComponentIndexType index3 = blueprint->AddComponent();
EXPECT_NO_THROW( blueprint->TestFunction() );
blueprint->AddConnection( index0, index1 );
blueprint->AddConnection( index0, index2 );
blueprint->AddConnection( index2, index3 );
ASSERT_TRUE( true );
EXPECT_NO_THROW( blueprint->WriteBlueprint( "blueprint.dot" ) );
}
} // namespace elx
#include "itkImage.h"
#include "itkImageFileReader.h"
#include "elxDataManager.h"
#include "gtest/gtest.h"
#include "itkImageRegistrationMethod.h"
#include "itkTranslationTransform.h"
#include "itkMeanSquaresImageToImageMetric.h"
#include "itkLinearInterpolateImageFunction.h"
#include "itkRegularStepGradientDescentOptimizer.h"
#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkResampleImageFilter.h"
#include "itkCastImageFilter.h"
class itkRegistration : public ::testing::Test {
public:
virtual void SetUp()
{
// TODO: Loading images here result in segfault
}
typedef itk::Image< unsigned short, 2 > ImageType;
typedef itk::ImageFileReader< ImageType > FixedImageReaderType;
typedef itk::ImageFileReader< ImageType > MovingImageReaderType;
FixedImageReaderType::Pointer fixedImageReader;
MovingImageReaderType::Pointer movingImageReader;
};
TEST_F( itkRegistration, ImageRegistration3 )
{
typedef itk::TranslationTransform< double, ImageType::ImageDimension > TransformType;
typedef itk::RegularStepGradientDescentOptimizer OptimizerType;
typedef itk::LinearInterpolateImageFunction< ImageType, double > InterpolatorType;
typedef itk::ImageRegistrationMethod< ImageType, ImageType > RegistrationType;
typedef itk::MeanSquaresImageToImageMetric< ImageType, ImageType > MetricType;
TransformType::Pointer transform = TransformType::New();
OptimizerType::Pointer optimizer = OptimizerType::New();
InterpolatorType::Pointer interpolator = InterpolatorType::New();
RegistrationType::Pointer registration = RegistrationType::New();
MetricType::Pointer metric = MetricType::New();
registration->SetMetric( metric );
registration->SetOptimizer( optimizer );
registration->SetTransform( transform );
registration->SetInterpolator( interpolator );
FixedImageReaderType::Pointer fixedImageReader = FixedImageReaderType::New();
MovingImageReaderType::Pointer movingImageReader = MovingImageReaderType::New();
DataManager::Pointer dataManager = DataManager::New();
fixedImageReader->SetFileName( dataManager->GetInputFullPath( "BrainProtonDensitySlice.png" ) );
movingImageReader->SetFileName( dataManager->GetInputFullPath( "BrainProtonDensitySliceR10X13Y17.png" ) );
registration->SetFixedImage( fixedImageReader->GetOutput() );
registration->SetMovingImage( movingImageReader->GetOutput() );
fixedImageReader->Update(); // This is needed to make the BufferedRegion valid.
registration->SetFixedImageRegion( fixedImageReader->GetOutput()->GetBufferedRegion() );
typedef RegistrationType::ParametersType ParametersType;
ParametersType initialParameters( transform->GetNumberOfParameters() );
initialParameters[0] = 0.0; // Initial offset in mm along X
initialParameters[1] = 0.0; // Initial offset in mm along Y
registration->SetInitialTransformParameters( initialParameters );
optimizer->SetMaximumStepLength( 4.00 );
optimizer->SetMinimumStepLength( 0.01 );
optimizer->SetNumberOfIterations( 200 );
optimizer->MaximizeOff();
EXPECT_NO_THROW( registration->Update() );
RecordProperty( "MetricValue", optimizer->GetValue() );
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment