Petri Dish Walk Through

Petri Dish Walk Through


Now you can grow your own Diffusion Limited Aggregation.

The sentence above is the completed sentence fragment shown when you first start the program. Fear not! There are no biohazards associated with this program!

It was named "Petri Dish" because the growing Diffusion Limited Aggregation (DLA) reminded me of an organic culture growing in a laboratory petri dish. It also reminded me of a sea coral growing larger via time-lapse video. It's just easier, to make the splash screen look like a petri dish, than trying to draw a complete underwater scene.


How is a Diffusion Limited Aggregation made?

A DLA is created by starting with a seed location, in Petri's case, at the center of the graphic screen. Random walkers are set at locations surrounding the seed, and randomly 'walk' (see Brownian Motion) until a walker bumps into the seed. It then 'sticks' to the seed to become part of the seed and a new random walker is spawned. This process continues, growing the 'seed', until a pre-defined maximum size is achieved.

A good article explaning what a DLA is can be found here.

You can also do a search engine look up for "Diffusion Limited Aggregation". One of the more interesting links is Coding Challenge #34 on "The Coding Train" a Youtube video showing how one can program the DLA using "Processing" (a Java like language).



Four basic steps to generate a DLA


DLA Size Radio Buttons
1) Choose one of the three DLA radius sizes. Stick with a size of '128' until you know how long it will take on you machine to generate each of the different sizes.

Backgound Colors Group
2) Select a background color. The background color you select will show in the large box immediately to the right.

Foreground Colors Group
3) Select a foreground color. The foreground color you select will show in the large box immediately to the right.

New DLA Button

4) Click the "New DLA" button. A DLA will now begin to draw on the screen. When completed, the elapsed time in seconds and the number of DLA dots drawn will be seen at the top of the DLA screen.



Options available after the DLA has been generated

Once a DLA has been generated, a 'map' array of the DLA is stored in memory. The 'map' array is created every time you generate a new DLA, or load a 'map' array from disk. From the generated or loaded 'map' array you can now "Re-Color" a DLA or, "Save DLA map array to disk" or, "Load DLA map array from disk". You can also "Save DLA to BMP" once a DLA has been generated.


ReColor DLA Button

After a DLA has been generated, you can choose different background and foreground colors (see steps 2 & 3 above in generating a DLA). Change colors until you reach a color combination that you like. Once the colors have been chosen, press the "Re-Color DLA button. There will be a brief pause while the DLA screen is updated.

Voila! A new combination of DLA colors is shown. You can do this as many times as you feel is necessary to get just the right looking DLA.


Save DLA Map Button

If you save a DLA map array to disk, a file name is automatically generated in the following format: DLA_[size]_YYYYMMDD_HH_MM_SS.txt.

The size is the same as the the DLA size used to generate the DLA. The date and time are formatted for sorting, and valid filename characters.

This method was chosen to keep all of your saved DLA map arrays in chronological order when displaying a file listing.


Load DLA Map Button

You can load previously generated and saved map arrays from disk. Let's say you wanted to see one of your save map arrays in different colors or just want to see what it is exactly that you saved.

The main reason for these map arrays saved to disk is to use the map array in a different program to display and colorize the DLA map array in unique and/or creative ways.


Save DLA BMP Button

This will save a snapshot of the most recently generated DLA to disk the the same file as a DLA map array, except it will have a '.BMP' extension.


Petri Dish Walk Through Button

Clicking the "Petri Walk Though" button brings up this help file.



How long does it take to generate a DLA?

A 128x128 DLA takes about 0.25 seconds

A 256x256 DLA takes about 0.50 seconds

A 512x512 DLA takes about 3.00 seconds

(These are reference times, actual times will depend on the speed of your computer.)

There is no way to predict exact times because of the Brownian motion used to generate a DLA. Some random walks will take a lot of steps, while other random walks take relatively few steps.


Why are the smaller DLA's the same size as the largest DLA?

The two smaller sizes have been scaled up to the size of the largest DLA size when displayed on screen. The DLA map arrays for all sizes are stored on disk in it's actual size.

The image below shows the actual size of each of the three DLA sizes.

Actual Radius Sizes