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

digiKam KDE proposal-2013

Project:Cloud Integration Export Plugin

Name:Saurabh M Patel

Email Address: saurabhpatel7717@gmail.com

FreeNode IRC Nick: saurabh_p

IM Service and Username: xmpp:gmail.com/Home, Username: saurabhpatel7717

Location(City,Country,Timezone): Ahmedabad,India,UTC+5:30

Proposal Title: To develop a export plugin for cloud services DropBox and Google-Drive

Motivation for Proposal / Goal:

Motivation:In present world where cloud services are getting so popular among people and companies that everyone wants to use cloud services for their data storage so digiKam which is used for photos management should have a tool to export photos to cloud services.The major one being Dropbox and Google Drive so there has to be a export plugin for these cloud services.

Goals:To provide option to export photos to Dropbox and Google-Drive by providing options for it in ‘export’ tab of digiKam

Implementation Details:

Google-Drive:
I am going to code for Google-drive export plugin without using any API’s.I would be using KIPI-Plugins for help in interface and getting image for uploading in uploading widget. I would create a login widget similar to Picasa export plugin.
FlowChart for Google-Drive implementation:
I would start coding Google-Drive part by starting to code the login widget for Google-Drive.
Then I would work on uploading widget part.For that I would be using following classes:
1. KIPIPlugins::KPImagesList
2. KIPI::UploadWidget
3. KIPIPlugins::KPProgressWidget
from KIPI-Plugins
Then I would code part to collect all images in images list using KPImagesList in a queue to provide images for uploading one after another.
After that I would code transfer part by creating methods for the same.This methods would update the progress-widget and hide/unhide it.Then it would upload the images to Google-Drive by using methods to upload images to Google-drive.

DropBox:

There are many API’s available for Dropbox provided by Dropbox developers in many languages but not in Qt/C++ and since it would be difficult to integrate them with Qt so I after consulting with Smit Mehta decided to use Qt-Dropbox API provided by lycis i.e:lycis-qtdropbox. I was able to build the qtdropbox project on my local machine and then tried hand on exploring it.It’s a very active project with good response from their developers so I decided to use it in the project for Dropbox.

FlowChart of DropBox implementaion:

Since the API for dropbox is in Qt/C++ it would not be very difficult to integrate in the project and would be implemented in a similar way to that of other export plugins like facebook,picasa etc.

API provides method for login but it would have to be modified to meet digiKam’s needs since it opens a new tab in browser altogether for login so I would create a widget which would ask for login from within digiKam.

It’s interface would use foll. classes

1. KIPIPlugins::KPImagesList

2. KIPI::UploadWidget

3. KIPIPlugins::KPProgressWidget
from KIPI-Plugins

After creating a interface I would create methods so that all images which are to be uploaded are saved in a queue and transferred one after another to upload method which would upload it to Dropbox

API provide methods to access Dropbox files so using it I would upload images to dropbox.

GUI MOCKUPS:

1. Uploading Widget

final

2. Login Widget

snapshot2

Above 2 pictures show most likely dialogs for login and uploading-widget which I discussed with Smit Mehta.

There are 5 buttons in navigation area in uploading widget image:

1.Move image up

2.Move image down

3. Add image

4. Remove image

5. Clear image-list

Tentative Timeline (in weekly intervals until 2 weeks after the end of GsoC):

Upto June17(pre-project research):Going through codes of various export plugins (I have gone through few already) which I have not went through till now. Also going thoroughly through lycis-QtDropbox API so as to use it more efficiently.Laying out the basic structure for plugins and making a stand-alone program for the project showing a demo of how the project would be implemented.

June17-June27(google drive widgets):First of all I will start coding with Google-drive part.I will start by making login-widget as shown in GUI mockup 2above for Google-Drive.Then I would use KIPI-Plugins classes to make an interface for uploading widget as shown in GUI mockup 1 and complete the uploading widget.

June28-9July(setting up images for upload):Start coding classes like Google_drive_image_item and Google_drive_image_list which would be helpful in setting images for uploading in proper manner.I would keep all images for uploading in a image-list(sort of queue) which would provide images to final stage-uploading.Also few other classes for providing help to image_item and image_list classes would be created as provided in other widgets like facebook, picasa, flickr etc.

July10-July21(coding uploading part):Start coding for uploading images.I would make a class google_drive_upload for handling all matters related to uploading.It would make use of image_item and image_list class to upload images to Google-drive using various classes of Qt to access Web since there is no API which provides direct method for uploading.

July22-July25(integrating plugin into digiKam):After testing the code I would start coding to create a option in export bar for uploading image to Google-Drive.

July26-July28:Reviewing the code and progress for upcoming midterm evaluation

July29:Midterm evaluation

July30-August10(Dropbox widgets):Start with implementaion of Dropbox plugin by laying out the basic structure. I will first start coding for login widget as shown in figure so that login can be done from within digikam instead of a new tab opening every time.Then I would use KIPI-Plugins classes to make an interface for uploading widget as shown in GUI mockup and complete the uploading widget.

August11-Aug22(setting up images for uploading):I will start to code for classes like dropbox_image_item and dropbox_image_list so that images are provided to uploading widget.Also other side-classes which would help the image_item and image_list class.Than I would do similar to Google-drive implementation and provide image_list to upload method which would then upload it.

August23-Aug27(exams in college):Only time during whole period I won’t be able to devote as much time as required.But I would compensate for that during regular period.

August28-September5(coding uploading part):Start coding for uploading class. Dropbox API provides a way to upload images to Dropbox so I would use that methods in a class dropbox_upload for uploading.Images would be provided from image_list class so that they can be uploaded to dropbox.

September6-Sept8(integrating plugin into digiKam):After testing the code I would start coding to create a option in export bar for uploading image to Dropbox.

September8-Sept10(test and review):Reviewing code by mentor and making changes suggested by mentor to plugins made.Also testing both the plugins.

Sept11-Sept16(testing and adding more features):Keep up doing testing and adding some more functionality like resizing images,feature of sharing with others on cloud services if time permits.

Sept16-Sept23(pencils down):Cleaning up the code,fixing bugs and write documentation.

September23:Firm ‘pencils down’ date

Sept23-Oct7(After GSOC):Effort to make export plugins for DropBox and Google-Drive feature available in next release of digiKam.

Do you have other obligations from late May to early August (school, work, vacation, etc.)? Please note that we expect the Summer of Code to be a full-time, 40-hr a week occupation. It is important to be clear and upfront about other commitments that you may have during that time.:

I will be free during entire summer period and would be able to devote full 40-hr a week.My college starts from July22, from then I will be able to work 5 hours a day everyday.Only I would not be able to devote much time from Aug23-Aug27 during which I have my exams in college but I would compensate for that during remaining period.

About Me (let us know who you are!):

I am Saurabh Patel living in Ahmedabad,Gujarat,India, sophomore studying Information and Communication Technology at Dhirubhai Ambani Institute Of Information and Communication Technology(DAIICT) at Gandhinagar,India.

I am working with linux for 2 years since joining college and am very much interested in programming.I have worked on creating a mini-shell[8] and explicit-allocators in projects during college.

Also this year I contributed some patches for game based on Django(python web framework) while working with organization ‘mysociety’[9].

I have worked with version control system-git.

I have been using Qt since starting to this year and was inclined to work with KDE after attending KDE meetup-India which was held in my college.

Since then I have started working on digiKam and helped close them many bugs.I have discussed regarding implementation of my project with Smit Mehta and have been in contact with him regarding this project for over a month.

I plan to add export plugins for Dropbox and Google-Drive in next stable versions of digiKam as soon as possible.I plan to be active with digiKam community and do bug-fixing and maintaining my project even after GSOC.

Junior job link (provide a link to a small task in KDE that you have done. It is not mandatory but will increase your chances of getting accepted considerably. If you don’t know what to work on have a look at http://kde.org/jj or ask a mentor):

Following is the list of bugs I have worked on and closed mostly with the help of Gilles Caullier and Smit Mehta:

1. Bug[305407][1] : Flickr-Added a button with which list of sets on flickr get reset by clicking button instead of terminating digiKam.

2. Bug[272521][2]: Updated albumlist so that it shows albums in alphabetical order.

3. Bug[288463][3]: Submitted a patch which could be applied to git master but need to sort out HUNK errors.

4. Review request[108382][4]: Was assigned a task in category:Small projects to introduce students.It was basically for testing the patch and with digiKam2.9.0 it worked well but on trying with digiKam3.2.0 beta it fails so it is pending on that list.Also I have told Markus Leuthold(one who submitted patch) of the problem.Recently got modified patch from Markus which would close this bug.

5. Bug[179209][5]: Submitted a patch for batch-resize album to any directory but with help of Smit Mehta,Gilles Caulier found that the bug doesn’t exist any more and thus got it resolved.

6. Bug[313981][6]: Tested for the bug and helped it resolved.

7. Bug[255722][7]: Tested for the bug and helped it resolved.

8. TODO: In Picasa plugin’s Picasawebwindow class I informed Gilles about a TODO and he was fine with that solution and thus could be removed but Jens Muller-person who coded that part is not active in community anymore so TODO is not yet resolved.But this TODO could be resolved any-time as Gilles was fine with my views on TODO.

References:

1. https://bugs.kde.org/show_bug.cgi?id=305407

2. https://bugs.kde.org/show_bug.cgi?id=272521

3. https://bugs.kde.org/show_bug.cgi?id=288463

4. https://git.reviewboard.kde.org/r/108382/

5. https://bugs.kde.org/show_bug.cgi?id=179209

6. https://bugs.kde.org/show_bug.cgi?id=313981

7. https://bugs.kde.org/show_bug.cgi?id=255722#c6

8. https://github.com/saurabh7717/shell

9. https://github.com/saurabh7717/fmsgame/branches