Message Boards Message Boards

Use manipulate on variables in other equations?


The end goal of this endeavor is to make an interactive site where users import pictures then slide some manipulate bars to set parameters which selects things from the image. We start with binarizing the whole thing, filltransform the image to fill in the blobs, then selecting blobs of a set number of pixles. The sliders theoretically set the binarize threshhold, and the max & min pixel counts.

The problem I'm encountering is the manipulate command (or the sliders) will be used on a different line than the output line. The command that sets the max/min is not the output command that is used to display the picture. I tried making my program all on one line, but that was too long and too confusing and it didn't run properly with the manipulate command anyway (maybe I didn't write it right, but it doesn't seem like a feasible solution for me).

I'm thinking maybe I have to play with the dynamic command, to manipulate variables from previous lines? But that means I have to learn everything about dynamic, DynamicModule, and the rest of that can of worms...

isolate = FillingTransform@Binarize[im, {0, 0.36}]
selectsizes = Manipulate[Colorize[SelectComponents[WatershedComponents[GradientFilter[isolate, 2], isolate], "Area", minimum < # < maximum &]], {minimum, 0, 500}, {maximum, 500, 5000}]
circles =ComponentMeasurements[selectsizes, {"Centroid", "EquivalentDiskRadius", "Label"}];
Show[im, Graphics[{Red, Thick, Circle @@ # & /@ circles[[All, 2]]}]]

I want to put the 0.36 from my isolate command on a slider. I want to put minimum and maximum from my selectsizes command on a manipulate slider. I want to put all the sliders in a catch-all command at the end if that would work.... Basically all I want is have sliders for my variables that update the picture as needed. My brain has melted for today, and I have no idea how to make that work yet. If anyone has any helpful suggestions I would love to hear them, I'll be back at this tomorrow.

POSTED BY: Bill Norman
6 days ago


I think you want something like this. As you move the slider, m changes globally and the picture updates. Just wrap the function that makes your graphic in Dynamic and wrap the slider value in Dynamic and it works.


enter image description here

POSTED BY: Neil Singer
5 days ago

Group Abstract Group Abstract