# INFO3600 Group Report 1
## Cover Page
**Project Title**: Automated Processing for Microscopic Images
**Group Members**:
* Tiange Xiang
* Shunqi Mao
* Zimo Huang
* Weiqing Cao
* Ziyu Liu
**Tutor**: Diviyalagsiny Kathirgamanaarthan
**Date Submitted**: 13/Sept/2019
## **Table of Contents**
1. [Introduction](#markdown-header-introduction)
1. [Background and Problem Statement](#markdown-header-background-and-problem-statement)
2. [Goals and Objectives](#markdown-header-goals-and-objectives)
2. [System Overview](#markdown-header-system-overview)
1. [User: researchers in Charles Perkins Centre Cancer Institute](#markdown-header-user:-researchers-in-charles-perkins-centre-cancer-institute)
2. [Administrator: the lead/manager (Dr. Kristina Cook) of the research team](#markdown-header-administrator:-the-lead/manager-(dr.-kristina-cook)-of-the-research-team)
3. [Evaluation](#markdown-header-evaluation)
1. [Overview](#markdown-header-overview)
2. [Details of Tests](#markdown-header-)
3. [Conclusion](#markdown-header-details-of-Tests)
4. [System Structure](#markdown-header-system-structure)
5. [Tool Usage](#markdown-header-tool-usage)
6. [Information Search](#markdown-header-information-search)
7. [Group Reflection and Conclusion](#markdown-header-group-reflection-and-conclusion)
8. [Individual Contribution](#markdown-header-individual-contribution)
9. [Appendix](#markdown-header-appendix)
1. [User Stories](#markdown-header-user-stories)
1. [Functional Requirements](#markdown-header-functional-requirements)
2. [Non-Functional Requirements](#markdown-header-non-functional-requirements)
2. [Research and Studies of Similar Systems](#markdown-header-research-and-studies-of-similar-systems)
3. [Summary of Unit Tests](#markdown-header-summary-of-unit-tests)
4. [Summary of Acceptance Tests](#markdown-header-summary-of-acceptance-tests)
5. [Summary of Usability Tests](#markdown-header-summary-of-usability-tests)
6. [Documentation for Main Modules](#markdown-header-documentation-for-main-modules)
1. [Download](#markdown-header-download)
2. [Installation and Setup](#markdown-header-installation-and-setup)
7. [Reference](#markdown-header-reference)
## **Introduction**
### Background and Problem Statement
A group of researchers led by Dr Kristina Cook at the Charles Perkins Centre at the University of Sydney needs to process a large amount of microscopic images as part of their daily research routine. Often, however, the tasks they need to perform on these images are fairly simple and repetitive, which means the time spent on these tasks is often under-utilized. For example, the following figure illustrates the effect of adding a scale bar to the lower right corner of an image - one of the tasks that need to be performed very frequently and normally on dozens of images at once. In this case, the work involved is simple, but it requires sizable human effort that could otherwise be directed to other more productive work. Naturally, it would be of great interest to the research team if these simple image processing workflows can be automated to improve productivity, as well as batched to adapt a variable number of input images.

Figure 1. Adding a scale bar to a cell image. Left: input image. Right: output image.
Currently, the research team relies on ImageJ/Fiji, an open sourced scientific image processing software running on the Java Virtual Machine (JVM), to perform their image analysis workflows. Given that the team is already familiar with ImageJ/Fiji and uses it extensively on a daily basis, it would be suitable if the final software solution is to be based on ImageJ/Fiji. The main goal of this project, therefore, is to systematically develop extensions/plugins for the ImageJ/Fiji image processing software in order to automate specific image analysis workflows as specified by the research team, as well as to batch-process a large number of images at once using these automated workflows.
### Goals and Objectives
The main goal of the project is to develop a software package, which is referred to as the ImageJ/Fiji Automation System, in order to automate a collection of repetitive work involved when performing microscopic image analysis, and in turn, the System would increase the productivity of the research team.
Due to the nature of the client requirements, it should be noted that the intended outcome of this project is rather special to some extent, in that the final deliverable **is not a single product such as an iOS app or a website, but a collection of moderately complex, relatively independent image processing tools which can be accessed through a centralized interface and will be delivered as a software package**. Because of the increased granularity of the work, the project also allows for better task splitting among the development team as well as smoother product delivery.
The objectives of the project are as follows:
* To implement a corresponding extension to ImageJ/Fiji for each of the image analysis workflow to be automated that, when used, can automatically perform the involved image processing operations using the ImageJ/Fiji platform and specifically its Macro language.
* To verify that the corresponding ImageJ/Fiji extension for each of the image analysis workflow is self-contained and can be combined into larger workflows as well as used for other downstream tasks by running rigorous testing on a weekly basis.
* To improve client productivity when performing image analysis workflows by at least 100% as measured by the time efficiency through the delivery of the ImageJ/Fiji Automation System.
* To deliver the completed ImageJ/Fiji Automation System by the client deployment deadline in Week 9.
## **System Overview**
Researchers in Charles Perkins Centre Cancer Institute are busy with various experimental affairs regularly. There are uncountable tasks that the researchers are subject to tackle in order to accomplish the ultimate achievement: conquering cancer. One of the minor ones, obviously, are spending a large amount of "unnecessary" time manipulating tumor images.
Before early August 2019, for correctly processing a batch of similar microscopy images, the only thing they can do is to manually open all the images and apply the same clicks to every single of them individually. The tedious process usually takes researchers days or weeks before the work is finally done.
Hence, it is better for the researchers to have a kind of system that can automatically apply any specified operation to any selected batch of microscopy images. So that days of tedious work can be done within the time of few mouse clicks.
#### User: researchers in Charles Perkins Centre Cancer Institute
As a user of the software/system, I want the program to be able to perform any predefined work flow to every image within a source folder, and save or demonstrate the results to the place(folders or screen) I want, so that I can use the results for later research.
The work flows may vary significantly, thus it is great to have an activation button for each of the work flows. And the entire interactive process becomes:
1. Open Fiji/ImageJ.
2. Find a list of available work flow buttons in the tool bar (Plugins->Macros).
3. By clicking one of the buttons, the user is able to select a source folder, so that all the images inside the source folder will get processed and the results will be saved/demonstrated according to different requirements.
Via users' scenario, the screen shots below show how to interact with the developed system.

Figure 2. A walkthrough of performing work flow: add scalebar. Left: Find the activation button. Right: Select desired folder.
After the above steps, the results can be found at the desired location. All the images in the source folder have been processed together.

Figure 3. Results can be found in the folder specified.
#### Administrator: the lead/manager (Dr. Kristina Cook) of the research team
As the administrator of the software/system, I wish the program can be easily set up, maintained and updated. So that the system/scripts can be easily distributed to research crews.
The one-time set up of the system/scripts doesn't require any OS or coding skills. A walkthrough of setting up the system/scripts:
1. Find the directory where Fiji application is currently installed.
2. Find the sub directory: "Plugins/Macros/".
3. Copy all individual script files into the "Macros/" folder.
4. After restarting Fiji, the administrator is able to find the work flow activation buttons in the place as \ref{user} describes.
Even though the one-time set up process is convenient, the administrator will be more glad if a list of non-task specified util functions(macros) can be available as well, so that the administrator can combine different util functions(macros) to design more flexible work flows.

Figure 4. One of the available util functions(macros): close all windows. The function(macro) simply closes all opened images.
In the short future, an UI may be required to allow users to access the util functions(macros) and combine them in a way the administrator wants.
## **Evaluation**
### Overview
The evaluation of the project will be focusing on the detailed user stories and the acceptance tests that our group have applied on every requirements, as mentioned in the overview of the project, our project is about to implement some plugins that provide external functionalities for the ImageJ system. The functionalities that we have to create are most likely similar to automatic some processes that may be costly in time if the users have to manually finish them. Currently our group have developed 9 user stories base on the information that we got on client meetings, the details of the user stories will be provided with in the following table.


Another table for each user story and the corresponding tests' results was created as in second table for better understandings, it's clear to be seen that if every requirements have successfully passed all the tests. All the tests that we have applied on the requirements that we have finished are successful, the last requirement that is in the table was the latest task and we haven't start yet. However, as a current result, our project is working well and users are happy with the product that we have.
### Details of Tests
Basically we applied 4 types of tests: Unit test, integration test, acceptance test and usability test. For the unit test and the integration test, the programmer that was responsible for the program should also be the first person to test it. All the detailed information about the unit test results are in the link within Appendix C, the integration test logs are also in that file. In the following part we are more focused on the acceptance test and the usability tests.

As mentioned in the above table, we have 4 acceptance tests to be applied on each tasks. The first is alpha and beta testing, it is for the developers like our group to test before letting the users to test the system. To be more specific, our teammates all test their work before they push the code on Bitbucket.
The second test that we have is contract acceptance Testing, after we found that the products that we implemented works fine, we have to check if it satisfied the requirements on the contract that was agreed by the clients and us (the scope statement and user stories), if it satisfy all the requirements, we would say that it passed the test.
The third test is operational acceptance test, this test ensure that there are workflows in place to allow the system to be used, since our group are only making brand new plugins to extend the functionalities for an existing system, the system itself is always usable and able to provide high quality processes.
The fourth test that we chose to be considered is the black box test, it is widely used for acceptance test, it is a method which analyse certain functionalities without letting testers see the internal code structure, we let clients test the functionalities and we received the feed-backs, they are all positive except the first requirement, it can compile and provide the correct result, but there was an error and need to be fixed.
The last test is the usability test aiming at whether the system is easy to use or not. We let our teammates and the client to use the system with our extensions, and since they are familiar with the system already, it is really easy to use our new functionalities since they only need to install the new macros and then click run. All the tasks were passed and we have received feedback from the clients.
We didn't apply regulation test, it is to check if the system complies with the regulations including governmental and legal regulations. Since this project is about adding functionalities to an existing system and the system itself is a legal product and widely used all over the world, we believe that adding our external plugins won't change the nature of ImageJ so we didn't apply the regulation test. System test is also not avaliable for us. As mentioned before, we are not creating a new system, applying the system test is only testing Imagej itself, which is not within our scope.
All our tests are normal tests, they test the normal data that is expected and should be accepted. Since our project is to provide extensions of an existing system, we don't have abnormal inputs, the inputs will be consisted of multiple .czi files with in the same folder, the system will not be able to read other files that is not readable for ImageJ so we don't have to care about that. Applying the same reason above, we also don't have boundary tests.
[here](#markdown-header-d.-summary-of-acceptance-tests)
### Conclusion
As for a conclusion, all of our tests that have applied on every requirements were passed except of some minor errors that may caused by the different version of ImageJ. Our test choice were limited by the nature of this project, a plugin macro won't be considered as a mature system so some of the tests are not suitable for this project. It is hard to identify whether the output that we get from the compiling code is the same as the expected output images that were given by the clients, because some of the process need manually adjust and based on that person's opinion.
The product itself is useless without the Fiji system, it works as a plugin and provide further functionalities for ImageJ. The language that we used for developing macros is a special language that is unique and only works for macros, so the limitation of this product is that it can only be used for a unique system.
## **System Structure**
As mentioned in overview, our image processing macros are built on the basis of ImageJ/Fiji image processing system, and our system aim to complete the automation of complex series of manipulation of the system. Therefore, our ImageJ Automation System can be considered as a subsystem of the ImageJ system. It encapsulates numbers of built in functionalities in ImageJ and wrap them into a single macro which also support batch image processing. Theses macros can be installed as plugins to the original system and users can easily perform the analysis for large numbers of images by single click as shown in the figure below.

Figure 5: The comparison of the original system vs the proposed subsystem. The original system of ImageJis shown on the left and the new system with our subsystem installed is shown on the right.
To support scalable analysis of both single images and batches of images, we designed our ImageJ Automation System to be made up by two main components:
* Functional macros which encapsulate several built-in functions into a executable shortcut.
* Batch macros which accept a folder of images and analyse them by invoking the functional macros.
Our team would design these components based on the requirement of clients as discussed in \ref{goals}, by combining the various basic image processing and analysing techniques provided by ImageJ. In order to achieve decoupling between the functional and batch macros, the structure of the system will always be construct follow the design pattern presented in Figure 6.

Figure 6: Structure of the components in our subsystem
## **Tool Usage**
The tools used in the project include ImageJ/Fiji, Mercurial, Bitbucket, Dropbox, Google Doc, Google Drive, Overlea, Slack, and WeChat.
ImageJ/Fiji is the main tool that we aim to improve upon. As we aim to achieve batch processing of the steps, we first would try reproduce the normal flow with a single image and test if we can reproduce result, before implementing batch methods. The batch methods would run on the ImageJ application and would call ImageJ's Built-in Macro Functions.
Mecurial is a version control software that track changes of the source code. Mecurial allow us to compare the change with early versions of the code, and go back to previous version of the code if a mistake is made.
Bitbucket is a tool that provide version control hosting service for Mecurial or Git. Bitbucket allow us to look at source code and its different versions anywhere online. Bitbucket also allow us to store issues and wiki about the project.
Dropbox is a file hosting service that allow to share and store files. Clients would upload the task they wish to perform in batched manner on Dropbox, with example input and resulting images. We would read the task they wish use to implement, use the example input file shared with us on Dropbox and compare our result with the resulting image shared with us on Dropbox.
Slack is a communication software for team collaboration. Slack allow us to communicate online, share important information, such as task to do and client requirement, before the information is formally documented in other places such as meeting minutes or Bitbucket issues.
WeChat is a messaging app for instant team communication. Since all team members are already used to WeChat for communication in daily life, we continue using WeChat as a communication means to update new findings instantly and receive immediate feedback from other team members.
## **Information Search**
Since the goal of the project is to develop extensions for the ImageJ/Fiji image processing software, we performed extensive research on the the software that we are extending upon. We use the research result to decide the main approach for adding extensions for ImageJ/Fiji.
ImageJ is an open source image processing software that can perform a wide range of image processing and scientific analysis operations [ImageJ 2019]. Example operations includes particle analysis, area calculation, Fast Fourier Transform, etc. ImageJ also support basic image editing operations such as smoothing, sharpening, enhancing contrast, etc. [ImageJ User Guide 2019]. There are multiple distributions of ImageJ. Among them, Fiji is the recommended distribution that is actively maintained with many scientific image analysis plugins useful in the field of life science [ImageJ Flavors 2019], which is highly related to our client's research field of cancer research.
The two main ways to add extra functionalities on ImageJ is via macros and scripting [ImageJ Developer Resources 2019]. Compared to ImageJ macros that are platform independent and do not require extra dependencies [ImageJ Forum 2019], scripting in ImageJ supported languages requires dependency installation [ImageJ Developer Resources on JavaScript 2019, ImageJ BeanShell Interpreter 2019, ImageJ Python Interpreter 2019] which might require extra work to provide support when clients install our extension on their individual computers. Due to this consideration, we decide to implement client requirement via ImageJ macros. The latest documentation on ImageJ macros can be access in [ImageJ Macro Language - Programmer’s Reference Guide 2019].
## **Group Reflection and Conclusion**
### Challenge and Risk Analysis
1. The programming language we are using: macro, is not a commonly used language. Therefore, there are not many documentation/tutorials we can easily find and hence guide us through directly. The challenge is that each of our team members has to look up API and forums where relevant with great effort and a large amount of time.
2. It is not guaranteed that the developed macros will stay stable as the ImageJ keeps updating and some API might be changing in the future. As a result, our macros might be broken without maintenance.
3. Due to the different operating system that the clients have, and the different versions of the certain software, it might be some slight inconsistencies of how to use or install a macro.
### Limitations in terms of Functionality
1. Imperfect encapsulation. Each of the scripts we developed can only be installed by manually dragging the source code files to the corresponding directory. For ImageJ/Fiji, It is impossible (so far) to install custom macros with the software/platform itself.
2. The macro language only supports combinations of in-built functionalities. When it comes to the part where we need to extend some functionalities. Macro language has some limitations, and we might have to switch to script language for more functionality.
### Limitations in terms of structure, design, implementation
1. As described above, ImageJ/Fiji macros don’t have sufficient and flexible built-in functions to use. Hence, a few ideas/proposals cannot be fully implemented.
2. As our automation system acts as a subsystem of ImageJ software, one of the main limitations we have is that we are not able to perform system design as the way we want. As clients only want to stick with ImageJ but not other software, we have to cooperate with the provided API.
### Primary strengths
1. As the tasks are independent of each other, they can be completed at a relatively fast speed. Therefore we would have enough time to test our code, as well as inviting for user feedback. In this way, we can make sure our product closely matches the user stories.
2. Developed macros can be easily interacted, as there is a separate section contains all the shortcuts. Successfully installed macros can be easily accessed from the corresponding shortcut.
### Programming practices
#### Reflections on Extreme Programming
- So far, we are following XP well, where we paired programmed and run things in sprints
- However, with small functionalities, pair programming can be a burden since the changes are small
- Therefore, we plan to develop some mechanism to decide when to apply XP or not
#### Ways of applying version control, issue tracking, coding styles
- One improvement to our issue tracking is to include more relevant details in the issues
- Currently, we create a lot of issues, which is great, but the details within each issue can be substantiated a bit more
- these can include the requirements from the clients or tutors
- One improvement to making code changes is to link the commits to the issues
- Currently, some, not all of our commits have a link to the corresponding issue
- and often, the link is added in the comment section in the commits
- it would make sense to require issue tags when making changes locally, so it would appear as part of the commit message when overviewing all of the commits
- One improvement to code styles, as well as writing maintainable software in general, is that we would first discuss the general structure of the code before implementing.
- This way, when team members work on it later, it would be easier to find the right places to insert code and not break existing coding styles
- Currently, team members are developing functionalities as individual contributors, making it hard to maintain good coding styles across all source code
#### Group aspects as well as product and processes
In terms of Extreme Programming, we work out the new requirement form users each week as an iteration. The work that had been assigned to us in the first working week was the top priority. In each week, we demo the finished tasks from this week's backlog to the user as the end of one iteration, and we ask the users if they see anything that could have been improved, or any new features could be added to the project as tasks to be completed in the next week. In this way, we ensure that we would at least complete several tasks of top priority by finishing them up in the early stage of the project. Meanwhile, we can always have the chance to enhance our product, by inviting feedback from users each week or even more frequently. At the current stage, we have finished the main tasks that users required, thus we can be assured that we will not suffer from the risk of an incomplete project.
## **Individual Contribution**
The following contents present the detailed work split each week. Since non of the team members are expert of ImageJ Macro programming language, we split the work evenly and make sure each of the team members have paying efforts into the project.


## ** XP Roles **
The following table demonstrate the XP roles for the first few weeks, it can be seen that minor differences exists between the following table and the group contract. The reason for that is that we cannot decide in advance the most proper XP roles for team members when we were writing the group contract. Therefore, in the later stages, some role rotation applies and the table below present a more accurate descriptions of the roles, which matches the contributions of the team members .


## ** Group Contract **
[Contract From Week 2 to Week 5](https://bitbucket.org/ChriXiang/imagej_batch_repo/wiki/Week2/Group%20Contract)
[Contract From Week 6 on](https://bitbucket.org/ChriXiang/imagej_batch_repo/wiki/Week6/Group%20Contract)
The list of individual reports are here:
[Weiqing Cao](https://bitbucket.org/ChriXiang/imagej_batch_repo/wiki/Individual%20Reports/Weiqing%20Cao)
[Shunqi Mao](https://bitbucket.org/ChriXiang/imagej_batch_repo/wiki/edit/Individual%20Reports/Shunqi%20Mao)
[Zimo Huang](https://bitbucket.org/ChriXiang/imagej_batch_repo/wiki/Individual%20Reports/Zimo%20Huang)
[Tiange Xiang](https://bitbucket.org/ChriXiang/imagej_batch_repo/wiki/Individual%20Reports/Tiange%20Xiang)
[Ziyu Liu](https://bitbucket.org/ChriXiang/imagej_batch_repo/wiki/Individual%20Reports/Ken%20Liu)
## **Appendix**
### A. User Stories
The following user stories are described in the order from higher priority to lower priority. We wrote more code than present in the following lists, the links here are linked to the main body of the code for specific user stories. Thus some code like shared functions are not present here.
* Functional Requirements
* As a user of the ImageJ program, I want the program to be able to add a scalebar to every image within the same folder, so that I can use the result for later research. [code](https://bitbucket.org/ChriXiang/imagej_batch_repo/src/default/src/batch-macros/Batch_Add_Scale_Bar.ijm) | [issue](https://bitbucket.org/ChriXiang/imagej_batch_repo/issues/25/carry-on-the-task-of-adaptive-scale-bar) | [meeting records](https://bytebucket.org/ChriXiang/imagej_batch_repo/wiki/ContributionEvidence/TiangeXiang/week2_clientmeeting.png?token=7f101b4cde9a22a5ffaba90bbc6f24713b90cdb4&rev=541dcc7fc1ab5578c21bcb19c54502019925d02e)
* As a medical researcher, I want to be able to measure the area of cells in all images in a selected folder, so that I can use the result for later research.[code](https://bitbucket.org/ChriXiang/imagej_batch_repo/src/default/src/batch-macros/Calculate_Cell_Area_(Batch).ijm) | [issue](https://bitbucket.org/ChriXiang/imagej_batch_repo/issues/25/carry-on-the-task-of-adaptive-scale-bar) | [meeting records](https://bytebucket.org/ChriXiang/imagej_batch_repo/wiki/ContributionEvidence/KenLiu/week3-client-meeting-notes.png?token=9f99acd3e8be1353b25595e698b146eb40b3b8be&rev=541dcc7fc1ab5578c21bcb19c54502019925d02e)
* As a medical researcher, I want to be able to save all resulting images as .tiff file in a target directory I selected, so that I can utilize the result images for later work.[code](https://bitbucket.org/ChriXiang/imagej_batch_repo/src/default/src/batch-macros/Batch_Export_to_TIFF_(Opened%20Images).ijm) | [issue](https://bitbucket.org/ChriXiang/imagej_batch_repo/issues/42/design-a-system-for-opened-images-based-on) | [meeting records](https://bytebucket.org/ChriXiang/imagej_batch_repo/wiki/ContributionEvidence/KenLiu/week5-client-meeting-notes.png?token=0d9c873e2ed94171ea24994766770bee0c95cb6a&rev=541dcc7fc1ab5578c21bcb19c54502019925d02e)
* As a user of the ImageJ program, I want to be able to open a collection of images in the same directory with ImageJ, so that I can perform the work quicker.[code](https://bitbucket.org/ChriXiang/imagej_batch_repo/src/default/src/batch-macros/Batch_Open_Images.ijm) | [issue](https://bitbucket.org/ChriXiang/imagej_batch_repo/issues/41/refactor-task-1-add-scale-bar-to-allow-it) | [meeting records](https://bytebucket.org/ChriXiang/imagej_batch_repo/wiki/ContributionEvidence/KenLiu/week5-client-meeting-notes.png?token=0d9c873e2ed94171ea24994766770bee0c95cb6a&rev=541dcc7fc1ab5578c21bcb19c54502019925d02e)
* As a medical researcher, I want to be able to overlay fluorescence and DIC of multiple images, so that I can use the resulting image for later work.[code](https://bitbucket.org/ChriXiang/imagej_batch_repo/src/default/src/batch-macros/Overlaying_Fluorescence_and_DIC_(Batch).ijm) | [issue](https://bitbucket.org/ChriXiang/imagej_batch_repo/issues/10/finalise-task-3-as-client-has-suggested) | [meeting records](https://bytebucket.org/ChriXiang/imagej_batch_repo/wiki/ContributionEvidence/KenLiu/week3-client-meeting-notes.png?token=9f99acd3e8be1353b25595e698b146eb40b3b8be&rev=541dcc7fc1ab5578c21bcb19c54502019925d02e)
* As a medical researcher, I want to be able to remove background from a list of images, so that I can use the image without background for later work.[code](https://bitbucket.org/ChriXiang/imagej_batch_repo/src/default/src/batch-macros/Batch_Subtract_Background.ijm) | [issue](https://bitbucket.org/ChriXiang/imagej_batch_repo/issues/53/rework-subtract-background-using-shared) | [meeting records](https://bitbucket.org/ChriXiang/imagej_batch_repo/wiki/ContributionEvidence/KenLiu/week3-client-meeting-notes.png)
* As a scientist, I want to be able to count the number of cells in a microscopic image automatically, so that I don’t have to waste time on this error-prone process.[code](https://bitbucket.org/ChriXiang/imagej_batch_repo/src/default/src/batch-macros/Batch_Cell_Counting.ijm) | [issue](https://bitbucket.org/ChriXiang/imagej_batch_repo/issues/21/complete-the-cell-counting-part-for-task-5) | [meeting records](https://bitbucket.org/ChriXiang/imagej_batch_repo/wiki/ContributionEvidence/KenLiu/week3-client-meeting-notes.png)
* As a user of the ImageJ program, I want to be able to apply some functions to all the images that I have opened flexibly, without having to process them one by one, so that I can save time in perform the image processing tasks.[code](https://bitbucket.org/ChriXiang/imagej_batch_repo/src/default/src/batch-macros/Batch_Add_Scale_Bar_(Opened%20Images).ijm) | [issue](https://bitbucket.org/ChriXiang/imagej_batch_repo/issues/42/design-a-system-for-opened-images-based-on) | [meeting records](https://bytebucket.org/ChriXiang/imagej_batch_repo/wiki/ContributionEvidence/KenLiu/week5-client-meeting-notes.png?token=0d9c873e2ed94171ea24994766770bee0c95cb6a&rev=541dcc7fc1ab5578c21bcb19c54502019925d02e)
* As a user of the ImageJ program, I want the program to be able to figure out the functions to be applied from the name of the files to be processed, so that I do not have to manually input any command. [code](https://bitbucket.org/ChriXiang/imagej_batch_repo/src/default/src/batch-macros/Auto_Processing_from_Filenames.ijm) | [issue](https://bitbucket.org/ChriXiang/imagej_batch_repo/issues/62/write-a-parser-to-parse-filenames-for) | [meeting records](https://bytebucket.org/ChriXiang/imagej_batch_repo/wiki/ContributionEvidence/KenLiu/week5-client-meeting-notes.png?token=0d9c873e2ed94171ea24994766770bee0c95cb6a&rev=541dcc7fc1ab5578c21bcb19c54502019925d02e)
* As a user of the Automation System, I want a friendly UI informing me what to do, so that I can perform the task in the way I want and in a flexible manner. [code](https://bitbucket.org/ChriXiang/imagej_batch_repo/commits/4840d0cb13b33e8ec19cc4e94d2b5b96dc2df869#chg-src/batch-macros/GUI.ijm) | [issue](https://bitbucket.org/ChriXiang/imagej_batch_repo/issues/58/maybe-try-a-ui-based-system-so-that) | [meeting records](https://bytebucket.org/ChriXiang/imagej_batch_repo/wiki/ContributionEvidence/KenLiu/week5-client-meeting-notes.png?token=0d9c873e2ed94171ea24994766770bee0c95cb6a&rev=541dcc7fc1ab5578c21bcb19c54502019925d02e)
* Non-functional Requirements
Since the None functional requirement might be abstract to be present in code, the following link to code might just link to some piece of code which meets the non-functional requirement. And code/issue of requirement with no code or issue to be shown are not presented here.
* As a medical researcher, I want all automatable tasks on ImageJ to be performed in few clicks, so that I can spend less time performing the task. No corresponding evidence with this non-functioanl requirement.
* As a medical researcher, I want all selected tasks on ImageJ to be performed in a batched manner, so that I can perform image analysis in an efficient way.[code](https://bitbucket.org/ChriXiang/imagej_batch_repo/src/default/src/batch-macros/Batch_Cell_Counting.ijm) | [record](https://bytebucket.org/ChriXiang/imagej_batch_repo/wiki/ContributionEvidence/TiangeXiang/week2_clientmeeting.png?token=7f101b4cde9a22a5ffaba90bbc6f24713b90cdb4&rev=541dcc7fc1ab5578c21bcb19c54502019925d02e)
* As a medical researcher, I want all selected tasks on ImageJ to be performed in a user-friendly manner, so that I save my mental effort on research.
### B. Research and Studies of Similar Systems
The research carried out for this project are mostly centered around the ImageJ/Fiji software platform and the additional software tools involved in this project with which we are previous unfamiliar, such as Mercurial for code version control, Bitbucket for code hosting, and Bitbucket Wiki for documentation.
For the ImageJ/Fiji software platform, while other similar systems exist, such as open source image processing libraries like OpenCV, the client has a specific requirement that all final functionalities should be within ImageJ/Fiji, which limits the systems to use for this project to only ImageJ/Fiji. Therefore, most of our research focuses on learning the usage and the existing APIs of ImageJ/Fiji, and our research record such as notes can be found in each team members contribution evidence folder.
For other software systems, including Mercurial, Bitbucket, and Bitbucket wiki, we conducted research into these tools as needed for carrying out our project smoothly. Most research about these tools are done in first 2 weeks, and similarly the notes taken during research, if any, can be found in each team member's contribution evidence folder on our wiki. In particular, for all of these software tools, no other options were available, so research into similar systems for these tools were not carried out.
### C. Summary of Unit Tests
We had 18 unit tests so far, only 1 test failed. The summary of the test are as in the table below.

The only failed unit test is on task 3 which is to merge images of different colour channels. Other test all went well and help us ensure the quality of work done. The 'N/A' tasks are for the tasks that we haven't assign names such as "Batch Open Images". Normally the person who was responsible for the product is also the tester of that task, since he/she knows the program better than others. The detailed test log can be found on [Bitbucket](https://bitbucket.org/ChriXiang/imagej_batch_repo/src/default/test/Test%20Log.md).
### D. Summary of Acceptance Tests
Our major acceptance tests are base on the reflection of the clients after we demonstrate the current progress weekly. We summarise all the test and corresponding result, we applied 7 acceptance tests with the users consists of the clients and ourselves, all the acceptance tests were passed and clients were happy with our progress and the delivered products. The original google document link is [here](https://docs.google.com/document/d/18RER3f1HhPgWnuu-9-nJgXmacHNvOOTXwFUfqnZ1tLk/edit?usp=sharing).
### E. Summary of Usability Tests
We applied 12 usability tests, basically two in a pair because we want to compare the time consumption of using the batch method or not. All the tasks that uses batch methods are way faster than the tasks using the normal clicking option. However, since we are only implementing plugins for ImageJ, we are not responsible for ImageJ's usability, if we let some other person that never used ImageJ before, he/she will be unable to finish the tasks. So the default setting is that the user is an ImageJ expert. The detailed test record can be found [here](https://bitbucket.org/ChriXiang/imagej_batch_repo/wiki/Usability%20tests).
### F. Documentation for Main Modules
The ImageJ Automation System contains a list of macros that can be utilized to support fast processing for a large batch of Bio-format images.
#### Download
The ImageJ/Fiji is an open source image processing software, it serves as the base where our subsystem can be installed in this project, the resources can be found on [FIJI](https://fiji.sc/)
The ImageJ Automation System we implemented can be found on our Bitbucket repository: [Our Source](https://bitbucket.org/ChriXiang/imagej_batch_repo/src)
#### Installation and Setup
After downloading all the required resources, first installing ImageJ following the provided instructions. After that the automation system can be set up by complete the steps below:
* Navigate to the installation diretory of your ImageJ software. For MacOS, this would likely be at '/Applications/Fiji.app/'.
* For Windows, this would be '/Users/<username>/fiji-win64/Fiji.app/' (When installing, Fiji for Windows will allows you to choose installation directory but this is the recommended installation directory)
* Go to our repository and copy the shared macros at /src/shared-macros (files that ending with .ijm)
* Go to /Fiji.app/macros and paste the copied macros
* Go to our repository and copy the batch macros at /src/batch-macros (.ijm files)
* Go to /Fiji.app/plugins/Macros and paste the copied macros
The macros should be installed to your software after completing the above instructions
#### Macro Usage
Once set up, you should be able to execute the macros in the following way:
* Launch Fiji.
* In the menus, go to "Plugins > Macros ..."
* You should see the batch macros that has been added during the setup, where the last menu iterm should match the filenames.
* Click on a menu item and follow the prompts printed in the "Log" window.
### G. Reference
[ImageJ 2019] ImageJ Welcome page, https://imagej.net/Welcome, visited Sep 2019
[ImageJ User Guide 2019] ImageJ User Guide, https://imagej.nih.gov/ij/docs/guide/user-guide.pdf, visited Sep 2019
[ImageJ Flavors 2019] ImageJ Flavors, https://imagej.net/ImageJ#Flavors, visited Sep 2019
[ImageJ Developer Resources 2019] ImageJ Developer Resources , https://imagej.nih.gov/ij/developer/index.html, visited Sep 2019
[ImageJ Forum 2019] ImageJ Forum - Can a macro written for mac be used on windows as well?, https://forum.image.sc/t/can-a-macro-written-for-mac-be-used-on-windows-as-well/3220/2, visited Sep 2019
[ImageJ Developer Resources on JavaScript 2019] ImageJ Developer Resources on JavaScript, https://imagej.nih.gov/ij/developer/javascript.html, visited Sep 2019
[ImageJ BeanShell Interpreter 2019] ImageJ BeanShell Interpreter, https://imagej.nih.gov/ij/plugins/bsh/index.html, visited Sep 2019
[ImageJ Python Interpreter 2019] ImageJ Python (Jython) Interpreter, https://imagej.nih.gov/ij/plugins/jython/index.html, visited Sep 2019
[ImageJ Macro Language 2019] ImageJ Macro Language, https://imagej.nih.gov/ij/developer/macro/macros.html, visited Sep 2019
[ImageJ Macro Language - Programmer’s Reference Guide 2019] ImageJ Macro Language - Programmer’s Reference Guide, https://imagej.nih.gov/ij/docs/macro_reference_guide.pdf, visited Sep 2019