Commit c9fd97f041e77b49500e6ef9fa666afca86eb470
1 parent
4b37859f
edits for classification
Showing
1 changed file
with
20 additions
and
2 deletions
Show diff stats
envi/envi.h
... | ... | @@ -603,11 +603,29 @@ public: |
603 | 603 | { |
604 | 604 | //save pixels in X as floating numbers: float * p |
605 | 605 | float * p = (float*)malloc(header.bands * sizeof(float)); //save pixel information |
606 | - unsigned bandnum = header.samples * header.lines; //calculate pixel numbers in a band | |
606 | + unsigned pixels = header.samples * header.lines; //calculate pixel numbers in a band | |
607 | 607 | unsigned count = 0; //for counting use |
608 | 608 | unsigned j = 0; //memory the pointer location in X |
609 | 609 | |
610 | - for(unsigned i = start; i < bandnum; i++){ | |
610 | + //create two indices into the mask (mask index and pixel index) | |
611 | + unsigned mi = 0; //valid pixel index | |
612 | + unsigned pi = 0; //actual pixel in the mask | |
613 | + | |
614 | + //find the actual pixel index for the mask index "start" | |
615 | + while(mi < start){ | |
616 | + if(mask[pi]) | |
617 | + mi++; | |
618 | + | |
619 | + pi++; | |
620 | + } | |
621 | + //at this point, pi is an index to the mi'th valid pixel | |
622 | + | |
623 | + //load the next N valid pixels | |
624 | + //for(unsigned i = 0; i < N; i++){ | |
625 | + | |
626 | + //} | |
627 | + | |
628 | + for(unsigned i = pi; i < pixels; i++){ | |
611 | 629 | if(mask[i] != 0){ |
612 | 630 | pixel(p, i); |
613 | 631 | //copy p to X | ... | ... |