Re: Problems with tying ROI's to image [message #66878] |
Thu, 18 June 2009 23:12 |
jeffnettles4870
Messages: 111 Registered: October 2006
|
Senior Member |
|
|
Lauren,
You can use ENVI_GET_ROI_DIMS_PTR to get the dims pointer that should
replace the -1 in your dims array.
And as for the class_ptr keyword, this is the list of class numbers
you're going to get stats for, so if you only have one ROI, just set
it to 0 (ie, do the first class). If you have multiple ROIs, and you
want to get stats for all of them, you just need the number of classes
- so use something like class_ptr = indgen(num_classes).
Jeff
|
|
|
Re: Problems with tying ROI's to image [message #66908 is a reply to message #66878] |
Thu, 18 June 2009 11:26  |
Lauren Hunkins
Messages: 4 Registered: June 2009
|
Junior Member |
|
|
On Jun 17, 6:06 pm, "Jeff N." <jeffnettles4...@gmail.com> wrote:
> Looks to me like you didn't set class_ptr to anything before you used
> it in the call to class_stats_doit.
>
> David's right about the keywords - ENVI batch programming is all about
> the keywords.
Thank you for the help, although I'm still having some problems, I
think I might have narrowed down the causes.
I'm fairly certain that the "Array dimensions must be greater than 0"
error message is talking about the dims, which begins with a -1. I
have found out that this is because there is not pointer to the ROI I
have opened. I'm hoping that someone can give me guidance as to how I
can ensure that this pointer is created.
Jeff's suggestion that I didn't set class_ptr to anything makes sense
to me, but I can't find where to set it, any help would be greatly
appreciated.
Thanks,
Lauren
|
|
|
|
Re: Problems with tying ROI's to image [message #66920 is a reply to message #66916] |
Wed, 17 June 2009 15:01  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Lauren Hunkins writes:
> I'm currently trying to create a program that prints out statistics
> from ROI's created by a geologist. I keep having an error message
> come up.
>
> ************************************************************ *************
> class_stats_doit: An error has occurred during processing
>
> Error: "Array dimensions must be greater than 0." The result may be
> invalid.
> ************************************************************ *************
>
> I have read most of the posts that contain this error message and
> haven't been able to find anything that will help me solve my
> problem.
>
> My mentor and I came to the conclusion that the ROI was not being tied
> to the image. We tried using some sample code from ENVI help that
> simply created and defined an ROI, but when we opened the image the
> ROI was not present. It seemed like there were some discrepancies in
> the ENVI about exactly how the image and the ROI are tied together. I
> have included the code for the program I wrote, as well as the code
> from the book that didn't seem to do anything.
Oddly enough, I've spent more than a few hours myself this week
with the very same error message from ENVI. I don't know anything
at all about your problem, but I have developed a new rule of thumb
for ENVI which at least got me past the error. (Alas, my program
still doesn't run correctly for God only knows what reason. I was
just about to write a post about it.)
My rule of thumb is this. ENVI uses a *lot* of required keywords in
its code. This goes against everything I know and believe about
keywords, but there you are. You have to be *extremely* careful
to supply these keywords or you more often than not get exactly
this kind of error. Maybe that is a good place to start looking.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|