A small Java utility that will convert a small image file into the Flow Cytometer Standard Data Format (FCS).
The output FCS file is designed to be loaded by any software that can read FCS version 3.1 (specification here).
The application requires Java 1.8 or later. When run without command line input, 2 file open dialogs will be presented. The first dialog selects the source image. The second dialog selects the destination FCS file (the FCS file does not need to already exist).
Command line usage :
java FcsGraphics -image [imagefile] -fcs [fcsOutput.fcs]
Multiple images :
java FcsGraphics -image [image01] [image02] [image03] -fcs [fcsOutput.fcs]
- Writing the FCS file can take up to a minute or so if the source image(s) are large or complex.
- Using an image(s) that are too large will cause the program to exit with an error.
- To view an FCS file try using :
- FCS Express (Working)
- MATLAB (not tested)
- FlowJo (not tested)
Shockingly, FCS is not an efficient means of storing image data. Most FCS files contain a few hundred thousand events, which are sufficient for most lab experiments. Using larger images results in files with more than ~1.6 million events, which is approximately the limit for an FCS file with 14 parameters.
By default, the program will attempt to scale the source image to fit within the bounds of the data range (currently 2^24 or 16,777,216). As a result, for images greater than about 400x400 pixels, the utility will generate more event data than can be handled by the FCS format, and crash with an exception declaring that the event capacity has been reached.
The screenshot below was taken from the FCS file generated from the "smurfIceCream.png" file in the /resources folder.
FCS files record events generated by a Flow Cytometer, which records each event using 4-12 detectors, which are saved as Parameters. When viewing an FCS file, the data is displayed on a variety of graphs, which show 1 (histogram) or 2 (dot, density, etc) Parameters at one time. The intensity recorded by the Cytometer for each event by a given detector determines how far along the given chart axis the event is displayed.
The FcsGraphics program generates artificial events, which can be given exact values corresponding to the X and Y values we wish the events to appear at when graphed on a given pair of Parameters. The earliest version of the program converted any non-white pixel into 1 event. This 1-to-1 conversion resulted in "flat" images that where in silhouette, which worked well for plain text but not more images with shading or color.
To achieve shading/coloring, the program converts all pixels into 16-level grayscale using perceptual averaging. It then adds between 1 and 16 events at the same location, resulting in a specific density at that location. When read by an FCS viewer such as FCS Express, this results in different levels of density for different shades of gray on the image, which the viewer then assigns any arbitrary color.