Differences between revisions 9 and 184 (spanning 175 versions)
Revision 9 as of 2005-03-25 13:36:59
Size: 1927
Editor: KevinTeich
Comment:
Revision 184 as of 2019-02-03 13:18:17
Size: 1693
Editor: AndrewHoopes
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
#pragma section-numbers on #acl LcnGroup:read,write,delete,revert All:read
Line 3: Line 3:
[[Navigation(children)]] = FreeSurfer Dev Guide =
Line 5: Line 5:
'''Index'''  * Visit the BuildGuide for instructions on building and installing freesurfer manually.
 * Visit the GitHub page for an introduction to the github workflow.
 * Visit the GitAnnex page for detailed instructions on using git annex.
Line 7: Line 9:
[[TableOfContents]] == Adding a New C Program ==
Line 9: Line 11:
=== Medical Image Format FAQ ===
[http://www.dclunie.com/medical-image-faq/html Medical Image Format FAQ]
If you'd like to add a new program to the tree, you should create a new subdirectory with the title of your tool. As an example, let's create a new c++ program called `mri_process`. First, we'll create a top-level subdirectory that contains our new c++ file and an empty `CMakeLists.txt` file:
Line 12: Line 13:
=== CVS Checkout === {{{
freesurfer/
    mri_process/
        CMakeLists.txt
        mri_process.cpp
}}}
Line 14: Line 20:
You can checkout the FreeSurfer source code from the NMR center using local CVS access or remotely by using SSH as the CVS remote connection method. In order to configure our new code, we should add the following to the empty `CMakeLists.txt` file.
Line 16: Line 22:
==== Local CVS Access ==== {{{
project(mri_process)
Line 18: Line 25:
The CVS repository is /space/repo/1/dev. Use this as your CVSROOT. You can either set it as an environment variable: include_directories(${FS_INCLUDE_DIRS})
Line 20: Line 27:
{{{setenv CVSROOT /space/repo/1/dev}}} add_executable(mri_process mri_process.cpp)
target_link_libraries(mri_process utils)
Line 22: Line 30:
or specify it in the checkout command with the -d option. Note that the CVS root is cached in a CVS checkout directory, so if you choose to use the -d method, you will only have to do it once during your first checkout. install(TARGETS mri_process DESTINATION bin)
}}}
Line 24: Line 33:
Check out the code with the CVS checkout command. The archive name is dev.

{{{cvs checkout dev}}}

or

{{{cvs -d /space/repo/1/dev checkout dev}}}

This will copy the entire archive to your directory, creating a
directory called dev/. Now set up your environment to use this dev
directory by running the script in dev/:

{{{cd dev
source set_dev_env_to_here.csh}}}

==== Remote CVS Access ====

Tell CVS to use SSH to access the archive by setting the following environment variable:

{{{setenv CVS_RSH ssh}}}

Use the following string as your CVS root:

{{{:ext:USER@MACHINE.nmr.mgh.harvard.edu:/space/repo/1/dev}}}

Where USER is your username and MACHINE is one of the NMR machines visible to the outside, i.e. gate, entry, or door. Then use the CVS commands normally.

Note that using this method makes an SSH connection for every CVS command, and you will be required to enter your password every time. You may want to look into a utility to automatically authenticate SSH connections, such as SSH agent.

=== Building ===

==== autoconf Troubleshooting ====

[AutoconfTroubleshooting]

This will compile `mri_process.cpp`, link it against the `utils` freesurfer library, and copy the executable to the `$FREESURFER_HOME/bin` directory during install. To include this subdirectory in the main freesurfer build, make sure to modify the top-level `CMakeLists.txt` by adding `mri_process` to the long list of included directories at the bottom of the file. Now, after reconfiguring your build, you can run `make` in the `mri_process` directory of your build tree to successfully compile the new program. If you're having trouble configuring and building freesurfer, be sure to visit the BuildGuide for step-by-step instructions.

FreeSurfer Dev Guide

  • Visit the BuildGuide for instructions on building and installing freesurfer manually.

  • Visit the GitHub page for an introduction to the github workflow.

  • Visit the GitAnnex page for detailed instructions on using git annex.

Adding a New C Program

If you'd like to add a new program to the tree, you should create a new subdirectory with the title of your tool. As an example, let's create a new c++ program called mri_process. First, we'll create a top-level subdirectory that contains our new c++ file and an empty CMakeLists.txt file:

freesurfer/
    mri_process/
        CMakeLists.txt
        mri_process.cpp

In order to configure our new code, we should add the following to the empty CMakeLists.txt file.

project(mri_process)

include_directories(${FS_INCLUDE_DIRS})

add_executable(mri_process mri_process.cpp)
target_link_libraries(mri_process utils)

install(TARGETS mri_process DESTINATION bin)

This will compile mri_process.cpp, link it against the utils freesurfer library, and copy the executable to the $FREESURFER_HOME/bin directory during install. To include this subdirectory in the main freesurfer build, make sure to modify the top-level CMakeLists.txt by adding mri_process to the long list of included directories at the bottom of the file. Now, after reconfiguring your build, you can run make in the mri_process directory of your build tree to successfully compile the new program. If you're having trouble configuring and building freesurfer, be sure to visit the BuildGuide for step-by-step instructions.

DevelopersGuide (last edited 2023-09-13 15:46:41 by JacksonNolan)