function mark_features, image, threshold
img_size=size(image) & nx=img_size(1) & ny=img_size(2)
img_copy=image
marks=replicate(fix(0),nx,ny)
current_feature=0
stack_max = long(10000)
stack = replicate({px, x:-1, y:-1},stack_max) ;array implementation of stack
for i=0, nx-1 do begin
for j=0, ny-1 do begin ;loop through all pixels
if img_copy[i,j] gt threshold then begin
current_feature=current_feature+1
img_copy[i,j]=0
marks[i,j]=current_feature
stack[0] = {px,x:i,y:j} ;push onto stack
stack_size = long(1)
;begin neighbor loop
while stack_size gt 0 do begin
;pop px from stack
current = stack[stack_size-1]
stack_size = stack_size-1
;process px's neighbors
for i_sub1= 0 > (current.x-1) , (nx-1) < (current.x+1) do begin
for j_sub1= 0 > (current.y-1) , (ny-1) < (current.y+1) do begin ;loop through neighbors
if img_copy[i_sub1,j_sub1] gt threshold then begin ;mark and push {x:i_sub1,y:j_sub1}
img_copy[i_sub1,j_sub1]=0
marks[i_sub1,j_sub1]=current_feature
if stack_size eq stack_max then begin
stack = [stack, replicate({px, x:-1, y:-1},stack_max)]
stack_max = stack_max*2
endif
stack_size = stack_size+1
stack[stack_size-1] = {px,x:i_sub1,y:j_sub1}
endif
endfor
endfor
endwhile
endif
endfor
endfor
return, marks
end
Here's the point of this post: Seriously, Customize Your Blog Template.
I'm one of those self-taught Web developers. I started when I was about 12 years old. One thing I've discovered over and over again is that the best way I learn new techniques in XHTML, CSS and JavaScript (what I call "The Three") is to customize templates built by others.
Today I worked on the template for the VLP blog. CSS is my weakest strength among The Three, and editing the "Almost Spring" template helped me get some practice with CSS inheritance.
There's a lot to learn if you're a beginner, but poking around something that starts out working is possibly the most helpful way to get practice. I highly suggest picking a template that's marked as XHTML and CSS compliant, clicking that "Customize" button and having at the template files.
Save often to see what your little changes do, so that you can reverse changes that produce the unexpected. You can't really break it if you keep track of such changes. And keep the W3Schools handy to search for any particular details.
A good understanding of XHTML and CSS is all you need to template a beautiful Web site. Jesse's blog contains more detailed technical instructions.
Can you tell that the VLP blog's template was originally "Almost Spring"? Probably not, at least not at first glance. Even if you don't want to become an expert in XHTML and CSS, being able to edit it just enough to customize a template will help your image as an individual. Blogs are everywhere, and readers will quickly recognize the default templates, and the implication is that you aren't an interesting individual if you just pick one. It only takes a few small changes to make a template that's more you.
Good luck. And don't be afraid to email me with questions.