------------------------------------------------------------------------------
| 668 | |
| 669 | //------------------------------------------------------------------------------ |
| 670 | unsigned int vtkTIFFReader::GetFormat() |
| 671 | { |
| 672 | if (this->ImageFormat != vtkTIFFReader::NOFORMAT) |
| 673 | { |
| 674 | return this->ImageFormat; |
| 675 | } |
| 676 | |
| 677 | switch (this->InternalImage->Photometrics) |
| 678 | { |
| 679 | case PHOTOMETRIC_RGB: |
| 680 | case PHOTOMETRIC_YCBCR: |
| 681 | this->ImageFormat = vtkTIFFReader::RGB; |
| 682 | return this->ImageFormat; |
| 683 | case PHOTOMETRIC_MINISWHITE: |
| 684 | case PHOTOMETRIC_MINISBLACK: |
| 685 | this->ImageFormat = vtkTIFFReader::GRAYSCALE; |
| 686 | return this->ImageFormat; |
| 687 | case PHOTOMETRIC_PALETTE: |
| 688 | if (this->IgnoreColorMap) |
| 689 | { |
| 690 | // ignore color map; setting vtkTIFFReader::PALETTE_GRAYSCALE ensures |
| 691 | // we'll pick correct number of components. |
| 692 | this->ImageFormat = vtkTIFFReader::PALETTE_GRAYSCALE; |
| 693 | return this->ImageFormat; |
| 694 | } |
| 695 | for (unsigned int cc = 0; cc < 256; ++cc) |
| 696 | { |
| 697 | unsigned short red, green, blue; |
| 698 | this->GetColor(cc, &red, &green, &blue); |
| 699 | if (red != green || red != blue) |
| 700 | { |
| 701 | this->ImageFormat = vtkTIFFReader::PALETTE_RGB; |
| 702 | return this->ImageFormat; |
| 703 | } |
| 704 | } |
| 705 | this->ImageFormat = vtkTIFFReader::PALETTE_GRAYSCALE; |
| 706 | return this->ImageFormat; |
| 707 | } |
| 708 | this->ImageFormat = vtkTIFFReader::OTHER; |
| 709 | return this->ImageFormat; |
| 710 | } |
| 711 | |
| 712 | //------------------------------------------------------------------------------ |
| 713 | void vtkTIFFReader::GetColor( |
no test coverage detected