I am a Java beginner. I want to use a code to count the number of particles in an image, and build an app on android phone. I search the internet and find that imageJ can not be imported into android so far. So I want to extract the useful part of code in particleAnalyzer.java of imageJ, and try to use it in an android app. But I get confused with so much code in the file, due to lack of experience. Can anyone tell me which part of code is useful to me? Any help will be deeply appreciated.
Welcome to the forum, @ygsaber!
What you want to do is not a project for a beginning programmer alone—even with occasional help and advice from developers here on the forum. You will need a dedicated, experienced mentor who can invest substantial time, guiding you and helping you overcome obstacles.
The reason I say this is because the
ij.plugins.filter.ParticleAnalyzer class has many lower level class dependencies. You would need to extract/rework a substantial portion of ImageJ1 to be Android-based. And ImageJ 1.x is fundamentally built on Java AWT, which is not part of Android’s version of Java, so adapting it to Android would be an uphill battle. If all you need is relatively simple/basic particle detection, it would be much easier to write something from scratch.
In the future, I hope motivated and experienced Android developer(s) can look into adapting ImageJ2 to the Android API. We tried to build ImageJ2 such that this work will be possible—it likely has a good enough separation of concerns. However, Android was not an initial use case for either ImageJ1 or ImageJ2, and I’m sure there are many obstacles which would need to be overcome.
It is surprising and amazing that I can receive a reply from an expert like you. I really appreciate it. I can understand the difficulty of my idea from your explanation, although I can not truly know some of the terminologies. And it seems we can not download ImageJ2 now. So I know I cannot do that in this way as a beginner. I will look for another way to solve my problem. I search scratch and it is interesting. I will see if it is useful to me.
It’s a pity that we can not use ImageJ for android, although they both use java. One day when I am stronger enough in using Java, maybe I can contribute to adapting ImageJ2 to the Android API. I think it will be interesing. But now it’s really beyond my ability.
Anyway, thank you again.
Aah, I’m sorry, I did not mean the Scratch project from MIT! That is a programming environment for kids, and unrelated to ImageJ. To “make from scratch” is an American idiom, which in this context means to program your particle analyzer yourself, without building on top of an existing image processing library.
I certainly agree. It is important to realize, however, that “Java” here is a vague term. The Java of Android is very different from the Java SE of desktop computers. Many things are missing, and many Android-specific APIs are present.
I think I have to learn some concepts and thanks for your links. It will be helpful. (I searched imageJ2, but I cannot find a download link named imageJ2. So a little confused. Well, I think I can figure it out later.)
Oops! I really misunderstand. Haha. Yeah, I am trying to learn an algorithm I need, then maybe I can write it in android by myself. Thanks for your explanation.