Skip to content, Skip to search

Changes

Downloading and Building Fiji From Source

2,002 bytes added, 09:15, 9 July 2019
Add step about installing OpenJDK 8
== Downloading {{FijiMenu}}The complete Fiji distribution of ImageJ consists of over a hundred individual components. Most of these components are ImageJ [[plugins]]; the Source Code with Git ==rest are core libraries, [[scripts]] and several other resources (such as the [[:File:Fiji-icon.png|Fiji logo]] and the README).
''Warning: In the past, Fiji used to be built from one monolithic source code for repository, which became unmanageable over time. These days, therefore, developers start from a fully-populated ''Fiji is rather large; make sure that you have two gigabytes of disk space free before beginning this.app/''directory and build only the parts they would like to change.
To fetch the = Download Fiji source code you should use [http://git.or.cz/ git]. If you are not familiar with Git, you might want to read [[Git mini howto|this page]] or [[:Category:Git|these pages]] instead.=
Your The first step should be to "clone" is the fiji repository with same for developers as it is for users: [[Downloads|Download]] Fiji, and unpack it. The Desktop is the following command:recommended location.
git clone git://pacific.mpi-cbg.de/fiji.git= Install Java =
This should start downloading the base fiji repository and unpack it into The next step is to install [https://adoptopenjdk.net/ OpenJDK 8]. You will need a directory called "fiji" JDK in your current directory. Once this has successfully completed, change into the newly created "fiji" directoryorder to develop Java code.
=== Submodules ==Check out and build individual plugins/libraries =
Some plugins are managed as submodules. If you want to work on themTo develop a plugin, you will have the developer first needs to initialize and update themfind out in which file it is contained. To do that, simply call the ''Command Finder'' (For more on submodulesshortcut {{key press|Ctrl|L}}), see type (part of) the [[Git submodule tutorial]].) These submodules must be initialized label of the menu entry in whose function you are interested, and updated with look at the following commands:''File'' column.
git submodule init ImageJA TrakEM2 VIB micromanager1Each individual component is maintained in its own repository in the [https://github.com/fiji/ ''fiji'' org on GitHub]. The name of the repository corresponding to a given ''.jar'' file is essentially identical with the file name, except that trailing underscores are stripped. Example: ''Stitching_.jar'' is maintained in the repository at https://github.com/fiji/Stitching, ''Time_Lapse.jar'' in the repository at https://github.com/fiji/Time_Lapse.1 mpicbg git submodule update
The build system will attempt to use If in doubt about the location of the system Java installation if it is available. Howeverrepository, on some platforms this may not work (or you may not have a recent enough Java installation) so we recommend that you also initialize just call {{bc | Plugins | Debug | System Information}} and update find the section corresponding to the appropriate Java submodule for your systemfile in question. To do this, run one of these commands:
git submodule init java/linux # For 32-bit Linux systems git submodule init java/linux-amd64 # For 64-bit Linux systems git submodule init java/macosx-java3d # For MacOS X systems git submodule init java/win32 # For 32-bit Windows systems git submodule init java/win64 # For 64-bit Windows systemsOnce the developer has identified which plugin or library she wants to modify or develop further, it is very easy to build and contribute by following [[How to contribute to an existing plugin or library|this tutorial]].
Then update the submodules again with:== Example ==
git submodule update javaLet's assume that we want to develop the Skeletonize3D plugin. Its source code is maintained at https://github.com/fiji/<Skeletonize3D. The first step is to clone the-name-for-your-OS>source code:
<source lang="bash">
$ git clone https://github.com/fiji/Skeletonize3D
Cloning into 'Skeletonize3D'...
remote: Counting objects: 115, done.
remote: Compressing objects: 100% (58/58), done.
remote: Total 115 (delta 46), reused 115 (delta 46)
Receiving objects: 100% (115/115), 22.81 KiB | 0 bytes/s, done.
Resolving deltas: 100% (46/46), done.
Checking connectivity... done.
</source>
Note: using You only need to type the part after the ''$'' prompt, i.e you would type <bcode>git submodule update<clone https:/b> without specifying which submodule, will update <b>all</b> submodulesgithub. What <i>update<com/i> means: "put all submodules, if checked out, to the last commit that was committed in the fiji repos". Which is most likely not what you want--will put any submodule that you have been working on into a <b>(no branch)/Skeletonize3D</bcode> situation. To fix itThe rest is shown only for reference, just cd to so that submodule <i>git checkout master</i> or whatever branch you were working onknow what to expect.
=== Getting a snapshot without Git ===Then let's use the command-line Maven to build the project:
If you insist on not using Git, you can download a snapshot <source lang="bash">$ cd Skeletonize3D/$ mvn[INFO] Scanning for projects...[... lots and lots of Fiji interesting and useful information ...][INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESS[httpINFO] ------------------------------------------------------------------------[INFO] Total time: 52.574s[INFO] Finished at: Tue Dec 02 10:27:00 CET 2014[INFO] Final Memory:20M//pacific.mpi81M[INFO] -----------------------------------------------------------------------cbg.de/cgi-bin</gitweb.cgi?p=fiji.git;a=snapshot;h=master;sf=tgz here], but you need to make sure that you have a new enough Java version installed.source>
== Building And finally, let's build the project and install it into the ''Fiji from Source==.app/'' directory:
You should now be able <source lang="bash">$ mvn -Dimagej.app.directory=$HOME/Desktop/Fiji.app/ -Ddelete.other.versions=true[INFO] Scanning for projects...[... lots and lots of interesting and useful information ...][INFO][INFO] --- imagej-maven-plugin:0.5.4:copy-jars (copy-jars) @ Skeletonize3D_ ---[INFO] Copying Skeletonize3D_-1.0.2-SNAPSHOT.jar to build $HOME/Desktop/Fiji with.app/plugins[INFO] Deleted overridden Skeletonize3D_-1.0.1.jar[INFO] Copying ij-1.49j.jar to $HOME/Desktop/Fiji.app/jars[INFO] Deleted overridden ij-1.49m.jar[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESS[INFO] ------------------------------------------------------------------------[INFO] Total time: 21.331s[INFO] Finished at: Tue Dec 02 10:30:02 CET 2014[INFO] Final Memory:14M/81M[INFO] ------------------------------------------------------------------------</source>
sh FakeOf course, this assumes that you followed the suggestion and unpacked your Fiji onto the Desktop. If you unpacked it somewhere else, you ''have'' to adjust the command-line accordingly.sh run
Note that the exact dependency versions, as specified by the project in the ''pom.xml'' file, are copied into the ''Fiji.app/'' directory, possibly replacing other versions. which You will invoke Fiji's multiwant to make sure to use not-too-platform build systemdifferent versions from the current versions. If all goes well, after some time you should see the main Fiji window:
[[ImageCategory:Development]][[Category:Fiji-main-window.png|Fiji's main window]]
Bureaucrat, emailconfirmed, incoming, administrator, uploaders
12,110
edits