Permalink
Browse files

ENH: Added BRAINSABC,BCD,BRAINSFit,BRAINSCommon

  • Loading branch information...
1 parent 339022c commit d98591cbcc94919fea3490265fa41ff3efc0f3e2 @hjmjohnson hjmjohnson committed Aug 3, 2011
Showing 710 changed files with 107,573 additions and 1 deletion.
View
@@ -0,0 +1,41 @@
+project(BRAINSABC)
+set(LOCAL_PROJECT_NAME BRAINSABC)
+cmake_minimum_required(VERSION 2.8)
+cmake_policy(VERSION 2.8)
+
+enable_testing()
+include(CTest)
+
+find_package(BRAINSCommonLib NO_MODULE REQUIRED)
+include(${BRAINSCommonLib_USE_FILE})
+
+include(${BRAINSCommonLib_BUILDSCRIPTS_DIR}/PreventInSourceBuilds.cmake)
+include(${BRAINSCommonLib_BUILDSCRIPTS_DIR}/CMakeBuildMacros.cmake)
+include(${BRAINSCommonLib_BUILDSCRIPTS_DIR}/SEMMacroBuildCLI.cmake)
+include(${BRAINSCommonLib_BUILDSCRIPTS_DIR}/CMakeBRAINS3BuildMacros.cmake)
+include(${BRAINSCommonLib_BUILDSCRIPTS_DIR}/IJMacros.txt)
+
+###
+SETIFEMPTY(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
+SETIFEMPTY(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
+SETIFEMPTY(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
+SETIFEMPTY(CMAKE_BUNDLE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
+link_directories(${CMAKE_LIBRARY_OUTPUT_DIRECTORY} ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
+
+if(NOT ITK_FOUND)
+ find_package(ITK REQUIRED)
+ include(${ITK_USE_FILE})
+endif(NOT ITK_FOUND)
+
+#-----------------------------------------------------------------------------
+# Output directories.
+#
+#SETOPTIONALDEBUGIMAGEVIEWER()
+
+###
+add_subdirectory(brainseg)
+
+if(1)
+ add_subdirectory(TestSuite)
+endif(1)
+
@@ -0,0 +1,14 @@
+## This file should be placed in the root directory of your project.
+## Then modify the CMakeLists.txt file in the root directory of your
+## project to incorporate the testing dashboard.
+## # The following are required to uses Dart and the Cdash dashboard
+## enable_testing()
+## include(CTest)
+set(CTEST_PROJECT_NAME "BRAINSABC")
+set(CTEST_NIGHTLY_START_TIME "00:00:00 EST")
+
+set(CTEST_DROP_METHOD "http")
+set(CTEST_DROP_SITE "testing.psychiatry.uiowa.edu")
+set(CTEST_DROP_LOCATION "/CDash/submit.php?project=BRAINSABC")
+set(CTEST_DROP_SITE_CDASH TRUE)
+set(CTEST_TEST_TIMEOUT 3600) ## Set timeout to one hour for now. There is a lot of work to be done.
@@ -0,0 +1 @@
+24d6e8d67a2fa417853e1b86449c8cfb
@@ -0,0 +1,23 @@
+//
+//A test driver to append the
+//itk image processing test
+//commands to an
+//the SEM compatibile program
+//
+#if defined(_MSC_VER)
+#pragma warning ( disable : 4786 )
+#endif
+
+#ifdef WIN32
+#define MODULE_IMPORT __declspec(dllimport)
+#else
+#define MODULE_IMPORT
+#endif
+
+extern "C" MODULE_IMPORT int ModuleEntryPoint(int, char* []);
+
+int BRAINSABCTest(int argc, char** argv)
+{
+ return ModuleEntryPoint(argc, argv);
+}
+
@@ -0,0 +1,54 @@
+#include "itkImage.h"
+#include "itkBlendImageFilter.h"
+#include "itkRandomImageSource.h"
+#include "itkImageRegionConstIterator.h"
+#include "vnl/vnl_math.h"
+
+int main(int, char * *)
+{
+ typedef itk::Image<float, 2> ImageType;
+
+ std::cout << "Create input image using RandomImageSource" << std::endl;
+ ImageType::Pointer images[2];
+ for( unsigned i = 0; i < 2; i++ )
+ {
+ typedef itk::RandomImageSource<ImageType> SourceType;
+ SourceType::Pointer source = SourceType::New();
+ ImageType::SizeValueType size[2] = {64, 64};
+ source->SetSize( size );
+ source->SetMin(0.0);
+ source->SetMax(1.0);
+ source->Update();
+ images[i] = source->GetOutput();
+ }
+ typedef itk::BlendImageFilter<ImageType, ImageType>
+ BlendImageFilterType;
+ BlendImageFilterType::Pointer filter =
+ BlendImageFilterType::New();
+ filter->SetInput1(images[0]);
+ filter->SetInput2(images[1]);
+ filter->SetBlend1(0.2);
+ filter->SetBlend2(0.8);
+ filter->Update();
+ ImageType::Pointer blendImage = filter->GetOutput();
+ itk::ImageRegionConstIterator<ImageType>
+ it1(images[0],
+ images[0]->GetLargestPossibleRegion() ),
+ it2(images[1],
+ images[1]->GetLargestPossibleRegion() ),
+ itBlend(blendImage,
+ blendImage->GetLargestPossibleRegion() );
+ for( ; !it1.IsAtEnd() && !it2.IsAtEnd() && !itBlend.IsAtEnd();
+ ++it1, ++it2, ++itBlend )
+ {
+ float blend = (it1.Get() * 0.2) + (it2.Get() * 0.8);
+ if( vcl_fabs(blend - itBlend.Get() ) > 0.0001 )
+ {
+ std::cerr << "Expected " << blend << " found " << itBlend.Get()
+ << std::endl;
+ exit(1);
+ }
+ }
+ exit(0);
+}
+
@@ -0,0 +1,60 @@
+list(APPEND ExternalData_URL_TEMPLATES
+ # Local data store populated by the ITK pre-commit hook
+ "file:///${CMAKE_SOURCE_DIR}/.ExternalData/%(algo)/%(hash)"
+ # Data published by Iowa Psychiatry web interface
+ "http://www.psychiatry.uiowa.edu/users/brainstestdata/ctestdata/%(algo)/%(hash)"
+
+ # Data published by MIDAS
+ "http://midas.kitware.com/api/rest/midas.bitstream.by.hash?hash=%(hash)&algorithm=%(algo)"
+
+ # Data published by developers using git-gerrit-push.
+ "http://www.itk.org/files/ExternalData/%(algo)/%(hash)"
+ )
+
+# Tell ExternalData commands to transform raw files to content links.
+# TODO: Condition this feature on presence of our pre-commit hook.
+set(ExternalData_LINK_CONTENT MD5)
+include(${BRAINSCommonLib_BUILDSCRIPTS_DIR}/ExternalData.cmake)
+
+include_directories(
+ ${BRAINSABC_SOURCE_DIR}/brainseg
+ ${BRAINSABC_SOURCE_DIR}/common
+ ${BRAINSABC_BINARY_DIR}/brainseg
+)
+
+
+
+MakeTestDriverFromSEMTool(BRAINSABC BRAINSABCTest.cxx)
+
+ExternalData_add_test( FetchData NAME BRAINSABCLongTest
+ COMMAND ${LAUNCH_EXE} $<TARGET_FILE:BRAINSABCTestDriver>
+ --compare DATA{test_data/refResults/labels.nii.gz}
+ ${CMAKE_CURRENT_BINARY_DIR}/labels.nii.gz
+ --compareIntensityTolerance 1
+ --compareRadiusTolerance 1
+ --compareNumberOfPixelsTolerance 10000
+ BRAINSABCTest
+ --inputVolumes DATA{test_data/small_ISO_T1_REP0.nii.gz} --inputVolumes DATA{test_data/small_ISO_T2_REP0.nii.gz}
+ --outputVolumes ${CMAKE_CURRENT_BINARY_DIR}/T1_cleaned.nii.gz,${CMAKE_CURRENT_BINARY_DIR}/T2_cleaned.nii.gz
+ --outputLabels ${CMAKE_CURRENT_BINARY_DIR}/labels.nii.gz
+ --outputDirtyLabels ${CMAKE_CURRENT_BINARY_DIR}/dirty_labels.nii.gz
+ --posteriorTemplate ${CMAKE_CURRENT_BINARY_DIR}/POST_%s.nii.gz
+ --inputVolumeTypes T1,T2
+ --filterIteration 3
+ --maxIterations 2
+ --maxBiasDegree 2
+ --debuglevel 0
+ --outputFormat NIFTI
+ --outputDir ${CMAKE_CURRENT_BINARY_DIR}
+ --gridSize 5,3,4
+ --atlasDefinition ${CMAKE_CURRENT_BINARY_DIR}/../../src/bin/Atlas/Atlas_20110607/AtlasPVDefinition.xml
+)
+set_tests_properties(BRAINSABCLongTest PROPERTIES TIMEOUT 6500)
+
+if(0) # This should be restored after fixing.
+add_executable(BlendImageFilterTest BlendImageFilterTest.cxx)
+target_link_libraries(BlendImageFilterTest ${ITK_LIBRARIES})
+ExternalData_add_test( FetchData NAME BlendImageFilterTest COMMAND ${LAUNCH_EXE} $<TARGET_FILE:BlendImageFilterTest> )
+endif()
+
+ExternalData_Add_Target( FetchData ) # Name of data management target
Oops, something went wrong.

0 comments on commit d98591c

Please sign in to comment.