[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pre-written Modules and DWF's drawline (in particular)



Rose (rmlongfield@my-dejanews.com) writes:

> 	Anyway, I have been implementing DWF's excellent DRAWLINE.pro into an image
> processing tool.  One drawback, I found was that there was no way to get the
> information returned from the program for analysis done somewhere else.  I
> thought that if a KEYWORD was added, such as
> 
> 	drawline, image,DESTINATION_WIDGET_ID = tlb_of_another_widget
> 
> Then this tlb variable could be present in the info structure, then a pseudo
> event can be sent to this tlb_of_another_widget.  This pseudo event would
> contain the coordinates of an ROI, for instance.  (I haven't connected this to
> CW_ZOOM yet, as someone on this group was trying, but I will be doing it soon)
> 
> I like using pre-written programs since they take care of a lot of messy
> stuff like colors and sizing.  But I like even better to leave them intact,
> i.e. not have to change them to suit particular needs.

Most of the programs found on my web page *should* be modified,
for a variety of reasons. :-) But mostly because I write them
as simply as I can so they can be understood.

This DrawLine program is one I wrote too simply, I think,
and I have been meaning to change it. In particular, I
have a pointer to the collected ROI points that gets updated for
each point. This is not a very efficient method. If I were
to write this program today, I would pre-allocated a
number of points (say, 100) and keep a counter of how
many I had. When I reached the limit, I would get 
another chunk of 100 points, etc. This would be *much* 
faster and would use memory better.

But the truth is, I haven't found a very satisfactory
way of incorporating something like ROIs into programs
in a completely generic way. I find I almost always
incorporate this functionality directly into each
program I am writing, and that each program is just
slightly different from the one before. In any case,
a DESTINATION_ID is not a bad way to go, I think.

Cheers,

David

-- 
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Progamming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155