M for Mite

JAI imageio casting problem

Wednesday Jan 13, 2010

I reacently had problems using Java Advanced Imaging (JAI).

Here is the simplified version of the problem:

 SomeClass c = (SomeClass) obj.getSomeClassParent()

not always but it happens sometimes to trigger exception

 org.somepackage.SomeClass can't be cast to org.somepackage.SomeClass 

Original code

        ImageInputStream iis = ImageIO.createImageInputStream(src);
       
Iterator<ImageReader> iter = ImageIO.getImageReadersByFormatName("DICOM");
       
ImageReader reader = iter.next();
       
DicomImageReadParam param = (DicomImageReadParam) reader.getDefaultReadParam();

And the original exception

 org.dcm4che2.imageio.plugins.dcm.DicomImageReadParam
 can't be cast to  org.dcm4che2.imageio.plugins.dcm.DicomImageReadPara


The problem was that I was missing that sometime the class is loaded by different class loader

and it can happen that the casted class is not the same whit the one form the default class loader.

The question on StackOverflow

Visualizing Data: Exploring and Explaining Data with the Processing Environment

Monday May 18, 2009


We generate big amount of data every day form sensors, cameras, web analytics etc. This data goes unused or at least underused because of various reasons like lack of interest, government policy, low funding but also because we simply can’t understand what this data means to us. Visualization is a concept that can make us see the hidden relationships with also enabling easier understanding and usage. Visualization is more than just cookie and a few graphs and the author of this book show’s that trough java based programming language “Processing” where the Ben Fry is one of the original architects. Processing is used by many researchers and companies to convey specific data in a clear and understandable manner. With this tool and Visualizing Data as a starting point it is very simple to learn Processing as well as learn basic visualization principles, how to provide interactive features that will bring users to your application. In the first chapter the author talks about the seven stages of data visualization - acquire, parse, filter, mine, represent, refine, and interact. The next chapters give an explanation about Processing language its syntax, usage, IDE and simplicity as well as present data visualization on various practical examples. The last chapter is about integrating processing with JAVA witch I think that is the most interesting part about Processing together with its intuitive syntax and simplicity. Overall this book is an easy read and step by step examples that can be found on http://benfry.com/writing/archives/3 Processing has its own IDE but it also can be run under NetBeans and Eclipse. Also there are many very interesting spin-off projects that expanded from processing like code swarm here is the video I have made from Subversion log data about project that I was part of .

SvnGenrep from Mite Mitreski on Vimeo.

Also there are many more projects like mobile processing and processing implementations for hardware devices or processing just in javascript with all that on www.processing.org :)
JavaLogo
JugMKLogo
Support Wikipedia

« May 2012
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  
       
Today

Feeds

Search this blog

Links

Weblog menu

Today's referrers