ImageJ-Dropbox Client : GSOC 2014 Proposal

ImageJ:Dropbox Client Project

Saurabh Patel

Organization: International Neuroinformatics Coordinating Facility

Short description: A ImageJ Plugin would be created with the help of which scientists and other users can share their files with other people and scientists on Dropbox for better collaboration.

Proposal

INCF

Dropbox upload and download client for ImageJ

Name: Saurabh Patel

Email:saurabhpatel7717@gmail.com

Location: Ahmedabad,India,UTC+5:30

College: DAIICT,Gandhinagar

Proposal Title: Dropbox upload and download client for ImageJ

Mentor: Dimiter Prodanov

1. Executive Summary

Dropbox Client for ImageJ will provide support to ImageJ so that files can be uploaded and downloaded from Dropbox. Dropbox provides its REST API in Java[1] which I will use to accomplish this task. When the user clicks on this plugin a browser will open asking for user credentials and permission for ImageJ to upload and download files. After which files can be selected to upload or download from corresponding widgets of upload and download.

2. The Project

In present times cloud services are getting so popular that every company and person wants to use it for storing and sharing data. So ImageJ which is a public domain Java image processing program needs to have a tool for users to share their work with other users and friends in community.The plugin will become a very useful application for scientists working in different labs where they want to share data and collaborate.

2.1 How are you going to implement it?

ImageJ is designed with an architecture that provides extensibility via Java plugins. So I would  be creating a Java plugin for Dropbox. Dropbox provides an api in Java with the help of which I would be creating plugin.

 Workflow summary of plugin:

1. There would be options in Plugins section namely Upload to Dropbox and Download from Dropbox.

2. When user clicks one of them, the user authentication will start by opening the browser(browser will be opened only once) and asking user to login. After login user will be asked to give permission for the app.

3. After getting permission from user I will retrieve details of the user and names of all files and folders of user uploaded to Dropbox. Once user gives permission to ImageJ app browser will not be opened in future for any purpose by plugin.

4. In upload widget I will list all folders so that user can decide which folder to upload.

5. In download widget I will list all files of user on dropbox so that user can decide which file to download.

6. In upload I will give a browse button from which user can select which files to upload from his local machine.

7. After hitting on upload and download button corresponding action of upload and download would be taken.

2.2 Detail Description

Detail workflow is as follow:

 1. Like all other ImageJ plugins it would be very easy to add to ImageJ and run. Once installed there will be options for ‘Upload to Dropbox’ and ‘Download from Dropbox’ in plugins section of ImageJ

 2. User authentication

 User authentication for Upload and Download would be similar:

After registering our app on Dropbox console we will get APP_KEY and APP_SECRET_KEY. This will be used for creating a url with the help of Java api of Dropbox. This url will be then opened in user’s default browser. This url will ask for login credentials as shown below:

Dropbox login

After user has entered correct login credentials user will be asked to authorize our app as shown below:

permission page

Note: We require browser to be opened only once by user since user has to give permission to ImageJ app so that it can access user’s Dropbox contents and it can’t be done directly and user has to give permission explicitly. But once user gives the permission Dropbox will give access token and refresh token with the help of which user will not need to open browser every time to give permission and we would be able to access Dropbox contents of user in future without authenticating user and asking for permission. Thus browser would be opened only once for each user account.

3. User information

After getting user permission we will get all of user information from Dropbox. In our case we do not need much information about user but only user’s name would suffice so after getting response from Dropbox in json format about user information we will parse using gson to get username to display it on our plugin widget so that user knows which user has logged in since one user can have multiple Dropbox accounts.

4. Upload widget

Simple GUI of upload widget is as below:

Upload mockup

 1. It will show username of logged in user. (4.1)

2. It will have a dropdown box containing list of all folders so that user can decide to which folder he needs to upload. (4.2)

3. It will show list of all files selected. (4.3)

4. It will contain a ‘Browse’ button which will open a window of file manager to select files using JFileChooser. (4.4)

5. It will contain ‘Upload’ button to upload images. (4.5)

6. It will contain progress bar showing how many files have been uploaded after user clicks upload. (4.6) (Hidden from mockup since it will be visible only after clicking Upload Button)

4.1 Username

After parsing information of user sent by Dropbox using gson, username will be extracted and displayed on widget.

4.2. List all folders

When user wants to upload a file to Dropbox we need to give him option of uploading it to folder of his desire instead of only uploading it to root of Dropbox. So we need to send a request to Dropbox asking for list of all folders of user. Dropbox will send list of all folders along with lot of metadata to us in json which then needs to be parsed to get list of all folders.

4.3. List Files

After clicking on ‘Browse’ button we will open file manager using JFileChooser with multiple selection enabled to select multiple files for uploading. Once user selects files, an array will be returned containing list of all files selected which will be displayed in a proper way on Upload widget.

4.4 Browse Button

On clicking browse button a JFileChooser would be used to open a file manager to select files to be uploaded. It will have multiple selections enabled.

4.5 Upload Button

There will be a upload button which on being clicked event will be triggered to start uploading files to Dropbox.

4.6 Progress Bar

When user clicks upload button a progress bar will be shown using JProgressBar which will show how many files are uploaded and how many are left.

5. Download widget

Simple GUI of download widget is shown below:

Download

     [ * ] shows a checkbox with file selected

1. It will display username of logged in user. (5.1)

2. It will show list of all files on dropbox with checkbox in front of file to select image for downloading. A tree like structure may be used so that files corresponding to only selected folder will be shown and not all files since there can hundreds of files on user’s dropbox account. (5.2)

3. A ‘Download’ button will be provided which when clicked, all selected images will be downloaded. There will also be automatic mime-type handling so that different types of files are downloaded in different folders. I will provide option to user for selecting folder to download particular type of images or all files to be downloaded in one folder.(5.3)

4. A progress bar how many of total images are downloaded. (5.4) (Hidden from mockup since it will be visible only after clicking Upload Button)

5.1 Username

After parsing information of user sent by Dropbox using gson, username will be extracted and displayed on widget.

5.2 List files

On sending a request to Dropbox to ask about all user files on Dropbox, it returns a json containing information about all files and their metadata which need to parse using gson to get filenames. Then all of these files will be displayed with checkbox in front of them so that user can select which file to download.

5.3 Download button

A download button will be provided which on being clicked will download all files selected by user. There will be automatic mime-type handling so that different types of files get downloaded to different folders according to their types. Also there will be option for user to download all files at a given location. There will also be a feature to import results from file to a result table for better use but it requires txt or any other format file to be in format that can be imported directly to result table.

5.4 Progress Bar

When user clicks Download button a progress bar will appear showing how many images are downloaded and how many are left to download.

 6. Upload Result Table

Similar to other contents being uploaded there would be option in File menu of Result table to upload it to Dropbox. For this I would need to save the result table temporarily in a file. After saving it I would upload it to Dropbox similar to other files and thus result tables could directly be exported to Dropbox

Note: I have not provided logout option since last time I used it, that didn’t work properly and had to implement a workaround for it. But if that feature is corrected from Dropbox side we would add an option for change account so that if a user has 2 accounts then he can access both the accounts.

3. Implementation

3.1 Minimal set of deliverables

At end of this project a plugin should be ready which can be added to ImageJ like other ImageJ plugins. This plugin should be able to upload and download files to Dropbox. Also some documentation should be provided describing code and how to use plugin within ImageJ. I would be using a Test Driven Approach so Test cases would be added by me for each part of code so that each of my work can be tested easily and in a better way.

3.2 Timeline

Estimated Date Range

Work

Uptil 19 May(Community Bonding)

Understanding requirements more clearly and creating a small demo to show basic functionalities and understanding codebase of ImageJ and some plugins to get familiar with coding style of ImageJ

19 May – 23 May

Start with upload part first. Create GUI of upload widget

24 May – 25 May

Review GUI from mentor and make necessary changes

26 May – 1 June

Coding of user authentication part and getting all user information and file names from Dropbox

2 June – 8 June

Getting list of all files selected by user and presenting it on widget in a nice way

9 June – 11 June

Reviewing code and verifying if all features implemented till now are working or not from mentor and changing things accordingly

12 June – 22 June

Uploading images to dropbox and showing progress bar accordingly

23 June – 26 June

Reviewing code and see if upload part of dropbox works properly or not by mentor

27 June

Midterm evaluation

28 June – 4 July

Create GUI of download widget and reviewing it by mentor

5 July – 15 July

Get list of all files from dropbox and display it nicely on widget in a tree like structure.

16 July – 20 July

Reviewing GUI from mentor and see if tree like structure suffices proposed for files is well displayed

20 July – 30 July

Completing download part of Dropbox by downloading files and showing progress bar

31 July – 7 August

Testing both dropbox upload and download client and writing test case if required

8 August – 11 August

Reviewing whole application from mentor and make any changes if required

11 August – 18 August (Suggested Pencil down)

Cleaning code, writing documentation and making any last minute change if required

18 August (Firm Pencil Down)

Getting final review from mentor and start preparing to submit code on google-melange

22 August

GSOC completion

3.3 How will you communicate with the mentoring organization?

I have been communicating through emails till now and will continue communicating through email. If required I can communicate through IRC. Since I check email frequently it will not create any problems.

3.4 Are you interested to further support the project after the fellowship?

Yes I will keep on working with these plugin until it gets in condition so that it could be released and would love to work with organization further if some other good projects become available.

4. The Candidate

4.1 What is your motivation for the project?

I had worked with Dropbox api last year and loved using it and here I get a chance to work with it again. Also I love contributing to open-source project and ImageJ is a very nice application of which I would like to be part of. It is also in Java which I had learnt in first year of my college so it would be nice to work with it again.

4.2 Is this the only project you are interested in?

Yes I am applying to this project only this GSOC.

4.3 What makes you a good candidate for this project?

I am applying for GSOC second time this year. Last year I also applied and got selected for Gsoc under digiKam-KDE[2] where my project was to create export(upload) plugins to Dropbox and Google Drive for digiKam. I successfully completed the project and my code[3] merged in digiKam 4.0 release. So I have a experience in working with Dropbox api and large project.

Also last year during Gsoc I made project in Qt whose api was not made available by Dropbox developers but I was still able to complete it by making a sort of API for Dropbox in Qt and integrating it in digiKam while Dropbox developers provide API in Java.

Also I have worked with Java in my first year of college so I know a fair bit of Java and if needed to learn something new I’m quite a fast learner. I am also working on a similar project in Java where I am using REST API of Google Task so that I could manage my tasks from desktop itself[7].

I also have worked with version control system git during last gsoc and my other projects[4][5] as well.

I also have discussed my approach with mentor Dimiter Prodanov by discussing with him how I am going to approach problem statement.

Besides I love coding and keep working on various coding tasks. I have submitted some codes on spoj[6],codeforces etc also.

4.4 Experience

a. Do you have experience in Java?

 Yes I have experience in Java since it was taught in my college itself in the first year. I am working on a project in Java to sync my google tasks to desktop using REST API of google task[7].

b. Do you have experience in ImageJ?

I have cloned the code from git and have setup ImageJ environment on my laptop. I am able to understand the code but I have not contributed any code to ImageJ yet.

4.5 Will you be working full time?

Yes I will be working full time since I have summer vacations for most of the time period of Gsoc. During whole of my summer vacation I would be able to contribute 40 hrs a week easily. My college starts from 28 July after which I would work 4-5 hours daily on weekdays and do remaining work on weekends so it should not create a problem for the project.

Links:

1. https://www.dropbox.com/developers/core/start/java

2. http://community.kde.org/GSoC/2013/StatusReports#Saurabh_Patel

3. https://projects.kde.org/projects/extragear/graphics/kipi-plugins/repository

(Dropbox and Google drive folder on this link were written by me)

4. https://github.com/saurabh7717

5. https://github.com/mrfinch

(I have 2 github accounts [4] [5])

6. http://www.spoj.com/users/saurabh7717/

7. https://github.com/mrfinch/google_task_java

Advertisements