Commit 081f2c9ffd1bbbd8fc50efef8576f6df8fc1176f
1 parent
0df38ff3
made bip bil files workable in function band & band_index in envi class
Showing
1 changed file
with
54 additions
and
4 deletions
Show diff stats
envi/envi.h
@@ -574,16 +574,66 @@ public: | @@ -574,16 +574,66 @@ public: | ||
574 | if(header.interleave == envi_header::BSQ){ //if the infile is bsq file | 574 | if(header.interleave == envi_header::BSQ){ //if the infile is bsq file |
575 | if(header.data_type ==envi_header::float32) | 575 | if(header.data_type ==envi_header::float32) |
576 | return ((bsq<float>*)file)->band((float*)ptr, wavelength); | 576 | return ((bsq<float>*)file)->band((float*)ptr, wavelength); |
577 | - | 577 | + else if (header.data_type == envi_header::float64) |
578 | + return ((bsq<double>*)file)->band((double*)ptr, wavelength); | ||
579 | + else{ | ||
580 | + std::cout << "ERROR: unidentified data type" << std::endl; | ||
581 | + exit(1); | ||
582 | + } | ||
583 | + } | ||
584 | + else if (header.interleave == envi_header::BIL){ | ||
585 | + if (header.data_type == envi_header::float32) | ||
586 | + return ((bil<float>*)file)->band((float*)ptr, wavelength); | ||
587 | + else if (header.data_type == envi_header::float64) | ||
588 | + return ((bil<double>*)file)->band((double*)ptr, wavelength); | ||
589 | + else{ | ||
590 | + std::cout << "ERROR: unidentified data type" << std::endl; | ||
591 | + exit(1); | ||
592 | + } | ||
593 | + } | ||
594 | + else if (header.interleave == envi_header::BIP){ | ||
595 | + if (header.data_type == envi_header::float32) | ||
596 | + return ((bip<float>*)file)->band((float*)ptr, wavelength); | ||
597 | + else if (header.data_type == envi_header::float64) | ||
598 | + return ((bip<double>*)file)->band((double*)ptr, wavelength); | ||
599 | + else{ | ||
600 | + std::cout << "ERROR: unidentified data type" << std::endl; | ||
601 | + exit(1); | ||
602 | + } | ||
578 | } | 603 | } |
579 | return false; | 604 | return false; |
580 | } | 605 | } |
581 | 606 | ||
582 | bool band_index(void* ptr, unsigned int b){ | 607 | bool band_index(void* ptr, unsigned int b){ |
583 | - if(header.interleave == envi_header::BSQ){ //if the infile is bsq file | ||
584 | - if(header.data_type ==envi_header::float32) | 608 | + if (header.interleave == envi_header::BSQ){ //if the infile is bsq file |
609 | + if (header.data_type == envi_header::float32) | ||
585 | return ((bsq<float>*)file)->band_index((float*)ptr, b); | 610 | return ((bsq<float>*)file)->band_index((float*)ptr, b); |
586 | - | 611 | + else if (header.data_type == envi_header::float64) |
612 | + return ((bsq<double>*)file)->band_index((double*)ptr, b); | ||
613 | + else{ | ||
614 | + std::cout << "ERROR: unidentified data type" << std::endl; | ||
615 | + exit(1); | ||
616 | + } | ||
617 | + } | ||
618 | + else if (header.interleave == envi_header::BIL){ | ||
619 | + if (header.data_type == envi_header::float32) | ||
620 | + return ((bil<float>*)file)->band_index((float*)ptr, b); | ||
621 | + else if (header.data_type == envi_header::float64) | ||
622 | + return ((bil<double>*)file)->band_index((double*)ptr, b); | ||
623 | + else{ | ||
624 | + std::cout << "ERROR: unidentified data type" << std::endl; | ||
625 | + exit(1); | ||
626 | + } | ||
627 | + } | ||
628 | + else if (header.interleave == envi_header::BIP){ | ||
629 | + if (header.data_type == envi_header::float32) | ||
630 | + return ((bip<float>*)file)->band_index((float*)ptr, b); | ||
631 | + else if (header.data_type == envi_header::float64) | ||
632 | + return ((bip<double>*)file)->band_index((double*)ptr, b); | ||
633 | + else{ | ||
634 | + std::cout << "ERROR: unidentified data type" << std::endl; | ||
635 | + exit(1); | ||
636 | + } | ||
587 | } | 637 | } |
588 | return false; | 638 | return false; |
589 | } | 639 | } |