Skip to content

Commit

Permalink
Updates cmake files and installation info.
Browse files Browse the repository at this point in the history
Cleans and updates cmakelist files and updates installation info
accordingly in readme file. Also renames the main executable file to simul_atrophy.
  • Loading branch information
bishesh committed Jul 7, 2016
1 parent 628215b commit 7a1d357
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 91 deletions.
59 changes: 18 additions & 41 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,47 +1,14 @@
cmake_minimum_required(VERSION 2.8)
project(ADDeformationModeling)

# For cluster use argument: -DIS_CLUSTER:bool=true
set(IS_CLUSTER false CACHE BOOL "cmake run in the cluster: true or false")

# For new cluster also use argument: -DIS_NEW_CLUSTER:bool=true
set(IS_NEW_CLUSTER false CACHE BOOL "cmake run in new cluster: true or false")
project(simul@atrophy)

# add cmake modules path to the default one:
MESSAGE("The directory is: ${CMAKE_SOURCE_DIR}")
#add cmake modules path to the default one:
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules")

#Find the external library for Petsc
find_package(PETSc COMPONENTS CXX REQUIRED)
#find_package(PETSc COMPONENTS)
set(CMAKE_CXX_COMPILER ${PETSC_COMPILER})

#Home directory
if(IS_CLUSTER)
if(IS_NEW_CLUSTER)
set(ITK_DIR /data/asclepios/user/bkhanal/softwares/ITK-build)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
# This part taken from: http://stackoverflow.com/questions/10851247/how-to-activate-c-11-in-cmake
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
message("setting up for new cluster")

else(IS_NEW_CLUSTER)
set(ITK_DIR /epi/asclepios2/bkhanal/ITK-build)
message("setting up for legacy cluster")
endif(IS_NEW_CLUSTER)
# Use cxx11 or not; If yes run cmake as: cmake -DUSE_CXX11:bool=true ..
set(USE_CXX11 false CACHE BOOL "use cxx11: true or false")

else(IS_CLUSTER)
set(ITK_DIR /home/bkhanal/Documents/softwares/ITK-build)
set(CMAKE_EXPORT_COMPILE_COMMANDS on) #Will generate compile_commands.json file used by irony-mode in emacs code completion.
if(USE_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
# This part taken from: http://stackoverflow.com/questions/10851247/how-to-activate-c-11-in-cmake
include(CheckCXXCompilerFlag)
Expand All @@ -54,9 +21,19 @@ else(IS_CLUSTER)
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
message("setting up for delorme")
endif(IS_CLUSTER)
endif(USE_CXX11)


# Find the external library for PETSc
# PETSc must have been configured with --with-clanguage=cxx option!
find_package(PETSc COMPONENTS CXX REQUIRED)
set(CMAKE_CXX_COMPILER ${PETSC_COMPILER})

# Generate compile_commands.json file used by irony-mode in emacs code completion.
set(CMAKE_EXPORT_COMPILE_COMMANDS on)


# Find ITK
FIND_PACKAGE(ITK)
IF(ITK_FOUND)
INCLUDE(${ITK_USE_FILE})
Expand All @@ -65,7 +42,7 @@ ELSE(ITK_FOUND)
"ITK not found. Please set ITK_DIR.")
ENDIF(ITK_FOUND)

#boost
# Find boost
find_package(Boost COMPONENTS program_options REQUIRED)

add_subdirectory(src)
Expand Down
48 changes: 41 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,52 @@
### Requirements
1. Cmake > 2.8
2. [PETSc](https://www.mcs.anl.gov/petsc/index.html) version 3.6.3.1
**Use `--with-clanguage=cxx` option** when configuring PETSc.
3. [ITK](https://itk.org/) version 4.9

First install right versions of PETSc and ITK.
## Installation
First make sure that:

## Quickstart
Clone this repository and create a `build` directory inside it.
Get into the `build` directory and run `cmake ..` followed by `make all`
* You have **right versions** of PETSc and ITK.
* That you configured PETSc with `--with-clanguage=cxx` option.
* Set `PETSC_DIR`, `PETSC_ARCH` and `ITK_DIR`.
For example, I have my `.bashrc` with:
```
ITK_DIR=/home/bkhanal/Documents/softwares/ITK-build
export ITK_DIR
PETSC_DIR=/home/bkhanal/Documents/softwares/petsc
export PETSC_DIR
PETSC_ARCH=arch-linux2-cxx-debug
export PETSC_ARCH
```

Now, build `simul@trophy` with the following steps. *I assume that you are inside a `curr_dir`, replace `curr_dir` with a directory of your choice.*

```bash
curr_dir$ git clone https://github.com/Inria-Asclepios/simul-atrophy.git
curr_dir$ cd simul-atrophy
simul-atrophy$ mkdir build && cd build
```
Use `cmake` to build the files.
```bash
build$ cmake ..
build$ make
```

If you have ITK installed with `c++11`, then use the following options with cmake:

The main simulator executable is `build/src/AdLemMain`.
Run with `-h` option to see the arguments that must be given.
```bash
build$ cmake -DUSE_CXX11:bool=true ..
build$ make
```

This should install the software to your machine.

## Quickstart
The main simulator executable is `build/src/simul_atrophy`.
Run with `-h` option to see in detail how to use it.

If you have python, it might be easier to use `scripts/runAdLemModel.py` instead of the executable.
Otherwise, there is also a python script at 'simul-atrophy/scripts/simul_atrophy.py' which you can use.
Once again, use `-h` option to see the details.


2 changes: 1 addition & 1 deletion scripts/bish_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Copying a directory tree.
"""
# Author: Bishesh Khanal <[email protected]>
#
# Asclepios INRIA Sophia Antipolis
#

import subprocess
Expand Down
39 changes: 0 additions & 39 deletions scripts/compare_with_reg.py

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/create_atrophy_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
or input images.
"""
# Author: Bishesh Khanal <[email protected]>
#
# Asclepios INRIA Sophia Antipolis
#

import argparse as ag
Expand Down
7 changes: 7 additions & 0 deletions scripts/extractSliceVideoFrom4d.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#!/usr/bin/env python
""" Script to:
Extract 3D images from a 4D image and then extract one selected slice
from each of these 3D images and combine them as a gif.
"""
# Author: Bishesh Khanal <[email protected]>
# Asclepios INRIA Sophia Antipolis

import subprocess
import sys
import argparse as ag
Expand Down
6 changes: 6 additions & 0 deletions scripts/runAdLemModel.py → scripts/simul_atrophy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/usr/bin/env python
""" Script to run simul@atrophy
"""
# Author: Bishesh Khanal <[email protected]>
# Asclepios INRIA Sophia Antipolis
#

import os
import os.path as op
import argparse as ag
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/usr/bin/env python
""" Script to run simul@atrophy for multiple images
"""
# Author: Bishesh Khanal <[email protected]>
# Asclepios INRIA Sophia Antipolis
#

import os
import os.path as op
import argparse as ag
Expand Down
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ link_directories(${PETSC_LIBRARIES})
# PetscAdLemMain.cxx
# )

add_executable(AdLemMain
add_executable(simul_atrophy
PetscAdLemMain.cxx
)
target_link_libraries(AdLemMain ${PETSC_LIBRARIES} ${ITK_LIBRARIES})
target_link_libraries(simul_atrophy ${PETSC_LIBRARIES} ${ITK_LIBRARIES})


add_executable(UpdateMaskAndAtrophy
Expand Down

0 comments on commit 7a1d357

Please sign in to comment.