External Voronoi library "Mesh": What is Sketch and Processing? - java

Question
This might be a too specific quesion but I figured I'd give it a shot. If it doesn't belong here, I apologize.
I've been looking for an external library that generates a Voronoi Diagram with edges and Regions.
I've had a look at simplevoronoi but it doesn't calculate regions so I figuered I'd continue looking.
I found Mesh made by Lee Bryon and I've tried to use it just like any other external library but it does produce an exception at compile time
Exception in thread "main" java.lang.NoClassDefFoundError: processing/core/PApplet
at megamu.mesh.IntArray.add(IntArray.java:21)
at megamu.mesh.Voronoi.<init>(Voronoi.java:88)
On the website the install guide reads
Install
Download Mesh
Unzip into Processing's libraries folder
Sketch → Import Library → mesh
Now my questions are: What is Processing? What is Sketch? And will I be able to use this library in my project somehow or can someone recommend a different one?
Solution (kind of)
In the end I tried to use a library called Java Power Voronoi Diagram made by Arlind Nocaj.

Processing is an environment/language which is based on Java. You can find more information about it here: http://processing.org/
As far as getting that library working, it might be fairly simple to port it. Processing's syntax is nearly identical to Java's. You'll have to make proper Java classes for everything if that hasn't already been done.

you can quickly generate a voronoi diagram in Processing (Development Environment) using a library called toxi. Here is an example, https://github.com/hamzeen/voronoi_image
P.S. Processing is a tiny development environment specially for artists (yet not restricted to them) to quickly prototype their ideas with minimal code (java) & it's based on java applets.

Related

Java: ImageJ alternative

I'm looking for some kind of alternative to ImageJ (http://imagej.nih.gov/ij/). For those who don't know, ImageJ is great for analyzing and creating these tif files from scripts that the user writes. However I noticed that using it in a java project (using its jar) is pretty resource intensive. I was wondering if there was some alternative to it that was perhaps better written for developers (doesn't need a GUI but is more efficient with memory).
The ImgLib2 project is an N-dimensional processing library which was invented to overcome many of the fundamental limitations of ImageJ 1.x. Among other uses, it provides the underlying data model for ImageJ2, a new version of ImageJ for the next generation of image data. ImageJ2 also provides an "ImageJ Legacy" component that provides backwards compatibility with ImageJ1, including runtime patching so that the ImageJ1 API can run headless.
As for performance, ImageJ 1.x and ImgLib2 are both—in general—very resource efficient. If you have specific circumstances where you believe resources are being wasted, a separate question with further details (here or on the ImageJ mailing list) would be a good course of action.
Another programmer-friendly library is the Insight Toolkit (ITK), written in C++. It is also mature, N-dimensional and resource efficient.
Take a look at Marvin Image Processing Framework. Main aspects:
Pure Java framework.
Extensible via plug-ins SDK. Current plug-ins here.
Multithreaded image processing (multiple threads in the same image, in different regions).
Unit testing for image processing.
Camera and video file processing through Java CV.
Process video frames as easy as processing images.
Components for integrating with Swing (MarvinImagePanel and plug-ins parameters)
Suitable for server side processing in J2EE application.
Stable. Already used by companies and universities. Some publications here.
Some answers using Marvin on Stackoverflow:
A: How to detect a Christmas Tree?
A: how to merge Images and impose on each other
A: Coffee beans separation algorithm
A: Detecting multiple images in a single image
A: 2D Shape recognition algorithm - looking for guidance
A: How to find corner co-ordinates in this image?

Convert compiled VB program to Java to use in Android app.

I have several VB programs that I wrote a few years ago in school. Is there any way possible to convert those programs to Java? Or would that it be easier to just rewrite it from scratch? My goal is to create an Android app that combines at least two of the programs into one functional app. This is purely a nonprofit endeavor; I'm a full time firefighter and am looking to put a free tool in the hands of my guys and other firemen who might want to use it.
I've been unable to locate the source code for the programs and have searched for an answer but haven't been able to find a definitive answer as most answers cover the source, not the compiled result. I've downloaded a couple supposed VB decompilers to see the results, but, in order to see the 'full' results, all the ones I've used require purchasing a 'pro' version. I have no problem paying for such a version, but I'd like to know if it's going to work properly before I do.
It would definitely be faster to rewrite them than it would be to devise a way of converting a VB program into Java code. Not only are the languages quite dissimilar, but VB's UI model is nothing like Android's, so it would likely be impossible (or at least impractical) to translate the UI code automatically.

How to understand Open Source projects/libraries?

There are few open source projects/APIs/libraries that we use in our project (Spring, Struts, iBatis etc.) and I want to understand their design and how they work internally.
What is the best way to understand these projects? Note that I am already using these libraries in my project. And I know the input-output interaction/configurations for these libraries. What I don't understand is how these APIs/libraries work internally.
The problems I face is:
Finding the entry class of the library. Is there any way I can know the entry class for the library - something which is kicking the whole API?
Tools/Plugins to use in Eclipse to get an overview of the design of the library. Going through each and every class of the library, can be a very daunting task. Is there any tool you would like to recommend which can generate the class diagrams of the API in Eclipse.
Thanks in advance!!
UPDATE: I need some inputs on eclipse plugins which can help me in getting an overview/class diagram of the library
I always use the same strategy for this: I never try to "understand" the code base as a whole, and I usually try to follow the request flow. I read enough of the documentation to determine what is necessary to use the application, and I read that code (Keep all source code loaded in your IDE).
For example, in struts you'll be installing a servlet filter in web.xml. Start reading the filter and follow the path a single request takes through your stack.
Likewise for spring, there are two main entry points, the filter and "getBean", both of which are mentioned real early in the documentation. Read those two.
For both of these cases you'll find one or two classes that represent the "core" of the framework real quickly. Read those really well and let actual use cases & needs drive your further exploration.
Approaching "understanding" of an open source library (or any other code base for that matter) by trying to find all the pieces is usually not a very good way of approaching these things, it will usually just lead nowhere because a lot of these things contain too much code. When following the request flow I find making diagrams can also be quite distracting, it tends to draw attention/focus away from understanding (and since my understanding increases rapidly most of them are out-of-date even before they reach the printer).
Nice question!!!, what I've done, specially in the case of Spring, apart from consulting the Documentation and their API's is to attach the sources of the project to my project on Eclipse, that way I'm able to navigate through the source code, not just the API. Its been quite helpful specially in the case of the Spring-Security project, there were some concepts that I just couldn't understand until I inspected the source code.
That's one of the advantages of using Open Source libraries.
Regards.
Tools like Structure101 (http://www.headwaysoftware.com/products/structure101/index.php), and Lattix (http://www.lattix.com/) let you analyze code and produce architecture diagrams / dependency matrices.
This is not exactly class diagram - the main focus is on layering. So the entry point is usually the topmost layer.
But then again, as I specified above, you will notice that some libs are just a mess, and these tools will not be helpful enough.
See the S101 online demo: http://www.structure101.com/java/
This for example is the Sonar project architecture: http://www.structure101.com/java/tracker/sonar/1.11.1/arch.html
Your best bet for those three would be to consult the official documentation (make sure you are looking at the version you are using) or to get a book on the technology.
Most APIs don't have a class with a main method; they're running in the webserver called by the server itself. Unless they're running as their own server, they won't have a main method.

Embedding dendrogram in Java

I'm looking for a library capable of drawing dendrograms of data in Java (not calculating them, I can do it by myself).. do you have any clues? Already tried to search it over Google but haven't found anything that is not stand-alone (while I need to embed the generation inside my program).
Thanks!
Check out the JUNG graph library. It won't perform the actual clustering for you but is a really good library for visualising your results.
Take a look at Archaeopteryx. It has fairly many features; it's open source, and it is available in a pre-packaged jar file.
BTW, I use JUNG and really like it. It can perform various clusterings, but AFAIK, it has no inherent dendrogram capabilities. Because it has graphing capabilities, you could roll your own dendrogram, but it would take some work.

Generating Class Diagram

HI All I am at the end of the release of my project.So in order to keep working our manager asked us to generate Class Diagrams for the code we had written.Its medium project with 3500 java files .So I think we need to generate class diagrams.First I need to know how reverse engineering works here. Also I looked for some tools in Google(Green, Violet) but not sure
whether they are of any help.Please suggest me how to proceed.Also a good beginning tutorial is appreciated.
I strongly recommend BOUML. Its Java reverse support is absolutely ROCK SOLID.
BOUML has many other advanteges:
it is extremely fast (fastest UML tool ever created, check out benchmarks),
has rock solid C++, Java, PHP and others import support,
it is multiplatform (Linux, Windows, other OSes),
has a great SVG export support, which is important, because viewing large graphs in vector format, which scales fast in e.g. Firefox, is very convenient (you can quickly switch between "birds eye" view and class detail view),
it is full featured, impressively intensively developed (look at development history, it's hard to believe that such fast progress is possible).
supports plugins, has modular architecture (this allows user contributions, looks like BOUML community is forming up)
The tool you want to use is Doxygen. It's similar to Javadoc, but works across multiple languages. If figures out the dependencies, and can call graphviz to render the class diagrams. Here's an example of a few Java classes run through Doxygen.
This is more a toolchain than a tool and I haven't tried it out myself. But it maybe a starting point. Using UMLGraph, ant and GraphViz. Explained step by step: in this article.
I ve used Visual Paradigm for UML for what you want to do and it was quite good.
See here for details.
Just go Tools -> Instant reverse and select your packages.
You may be able to reverse engineer class diagrams with the open source modelleing tool ArgoUML http://argouml.tigris.org/
ObjectAid is pretty nice. You can drag classes into a diagram and arrange them the way you want.
Visual Paradigm for UML Standard Edition (or Better) will reverse engineer Java files in to Class Diagrams.
I guess if your boss just wants to keep you busy until the next project starts then there's no harm in it, but you will find pretty quickly that creating a class diagram with 3500 classes will tell you exactly NOTHING about your system. In fact, you don't really want a diagram with more than about 10 classes on it. So once you have reversed all the code into your modelling tool, you will want to start organizing and arranging to find the meaning. Create a new diagram, drop a single important class onto it and bring in all the classes that are directly related to that class. Repeat for maybe the 300 most significant classes. Don't worry, it isn't as horrible as it sounds, maybe a week's work.
For the record, my modelling tool of choice is Enterprise Architect by Sparx Systems. It will reverse java sources or .jar files. There is a free 30 day trial edition.
There are some tools available that will help you generate these diagrams. These cost money.
Otherwise you could to try to parse your Java files. This could be as simple to create a simple parser that reads the Java files and writes the name of the class and all the import statements to a file and generates a class diagram from there, graphviz can help you there.
I've been using Enterprise Architect for a number of years. A JBoss developer suggested it to me. It works very well for all types of UML modeling including the reverse engineering of class models (Java, C# and others). The basic version is currently $120 per seat, but it has most of the capabilities of much more expensive tools and it is much easier to learn. I particularly like its ability to generate HTML and RTF documentation.
It is very easy to synchronize code between the tool and your source code. Even bi-directional if you want.
Your PM may also like the activity and sequence diagrams that it can create. I also frequently use the deployment diagrams. It's very helpful to have all of this in one tool.

Categories

Resources