Skip to content

Add DrawEM_BUILD_N4 and DrawEM_ATLASES options #27

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
44 changes: 26 additions & 18 deletions Atlases.cmake
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
cmake_minimum_required(VERSION 2.7)
set(ATLASES_URL "https://biomedic.doc.ic.ac.uk/brain-development/downloads/dHCP/atlases-dhcp-structural-pipeline-v1.zip")
set(ATLASES_MD5 "77e924bc17a4906f5814874009f5eca6")
set(ATLASES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/atlases")

include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
set(_default ON)
if (IS_DIRECTORY "${ATLASES_DIR}")
set(_default OFF)
endif ()
option(DrawEM_ATLASES "Whether to download DrawEM atlases during build step" ${_default})
unset(_default)

set(ATLAS_URL "https://biomedic.doc.ic.ac.uk/brain-development/downloads/dHCP/atlases-dhcp-structural-pipeline-v1.zip")
set(ATLAS_MD5 77e924bc17a4906f5814874009f5eca6)
if (DrawEM_ATLASES)

if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/atlases)
ExternalProject_Add(atlases
URL ${ATLAS_URL}
URL_MD5 ${ATLAS_MD5}
PREFIX atlases
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
include(ExternalProject)

add_custom_target(atlases_move ALL
${CMAKE_COMMAND} -E rename ${CMAKE_CURRENT_BINARY_DIR}/atlases/src/atlases ${CMAKE_CURRENT_SOURCE_DIR}/atlases
)
ExternalProject_Add(atlases
URL ${ATLASES_URL}
URL_MD5 ${ATLASES_MD5}
PREFIX atlases
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)

ADD_DEPENDENCIES(atlases_move atlases)
endif()
ExternalProject_Add_Step(atlases rename
COMMAND ${CMAKE_COMMAND} -E rename "${CMAKE_CURRENT_BINARY_DIR}/atlases/src/atlases" "${ATLASES_DIR}"
COMMENT "Move extracted atlases to source directory"
DEPENDEES download
)

endif ()
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,9 @@ endif ()

mirtk_configure_module()

add_subdirectory(ThirdParty/ANTs)
option(DrawEM_BUILD_N4 "Whether to build ANTs N4 from sources included in DrawEM" ON)
if (DrawEM_BUILD_N4)
add_subdirectory(ThirdParty/ANTs)
endif()

include(Atlases.cmake)