First, I should note that I could not find the correct library to access the data I was trying to use in Java, so I am using random data.
When presented with this prompt, my first thought was my capstone, which is largely data visualization. However, it uses software I could not recreate in less than a couple years, so I decided to process data similar to my capstone in a visually interesting way. In other words, I wanted to take a large set of floats mapped to 2d space, and group them into maxima. This is a very simple way to describe how stars are found in a digital image, which is roughly what I seek to recreate. I did this, but it was a bit boring, so I also set it up to make a more dynamic image that follows similar logic. These are the two modes in my program, mode 0 is more interesting but mode 1 is more intuitive.
float[][] visualization; float[][] tempVisualization; float max=0; float min=255; float range=255; float growthfactor=255; int mode= 0; //loat[] data; ImageHDU imageHdu; void setup(){ size(100,100); frameRate(15); //data = getImageHDUDataInFloatArray(imageHdu); visualization= new float[width][height]; tempVisualization= new float[width][height]; for(int x= 0; x< width; x++){ for(int y= 0; y< height; y++){ visualization[x][y]= random(25); //println(visualization[x][y]); } } } void draw(){ min=255; max=0; for(int x= 1; x< width-1; x++){ for(int y= 1; y< height-1; y++){ if(mode==0){ if(visualization[x][y]>visualization[x][y+1]&& visualization[x][y]>visualization[x][y-1]&& visualization[x][y]>visualization[x+1][y+1]&& visualization[x][y]>visualization[x-1][y+1]&& visualization[x][y]>visualization[x+1][y-1]&& visualization[x][y]>visualization[x-1][y-1]&& visualization[x][y]>visualization[x-1][y]&& visualization[x][y]>visualization[x+1][y]){ tempVisualization[x][y]=visualization[x][y]+ (visualization[x-1][y]+ visualization[x-1][y-1]+ visualization[x][y-1]+ visualization[x+1][y-1]+ visualization[x-1][y+1]+ visualization[x][y+1]+ visualization[x+1][y+1]+ visualization[x+1][y])/2; } else{ tempVisualization[x][y]=visualization[x][y]- (visualization[x-1][y]+ visualization[x-1][y-1]+ visualization[x][y-1]+ visualization[x+1][y-1]+ visualization[x-1][y+1]+ visualization[x][y+1]+ visualization[x+1][y+1]+ visualization[x+1][y])/9; } } if(mode==1){ for(int x2=-1; x2<2; x2++){ for(int y2=-1; y2<2; y2++){ if(x2!=0||y2!=0){ process(x,y,x+x2,y+y2); } } } } max=max(max,tempVisualization[x][y]); min=min(min,tempVisualization[x][y]); stroke(tempVisualization[x][y]); point(x,y); } } range=max-min; range=min(range,254); if(mode==1){ growthfactor=range*0.7; } if(mode==0){ for(int x= 0; x< width; x++){ for(int y= 0; y< height; y++){ visualization[x][y]= visualization[x][y]*growthfactor/range; } } } println("looped"); visualization=tempVisualization; } public void process(int largeX, int largeY, int smallX, int smallY){ if(visualization[largeX][largeY]>visualization[smallX][smallY]){ tempVisualization[largeX][largeY]+=visualization[smallX][smallY]; } else{ tempVisualization[largeX][largeY]=tempVisualization[largeX][largeY]*growthfactor/range; } }
The file type I was attempting to use if fits, which I know the library for in python but not java.