From: Gehua Y. <yan...@gm...> - 2011-08-30 01:00:46
|
Hi folks, VXL cannot read in a couple TIFF images that I recently received. After some digging, it turned out these TIFF images had an uncommon value of 4 for tag TIFFTAG_SAMPLEFORMAT. I also did some search online and ran across this page: http://www.awaresystems.be/imaging/tiff/tifftags/sampleformat.html So at least one practice chose to make the image more tolerant to this uncommon value. I made the following change and am going to make a commit. I do not see any harm this patch may cause, but thought it is best to run it through the community. Best regards, Gehua Yang DualAlign LLC ========================= patch ============================== $ svn diff Index: file_formats/vil_tiff_header.cxx =================================================================== --- file_formats/vil_tiff_header.cxx (revision 32890) +++ file_formats/vil_tiff_header.cxx (working copy) @@ -361,27 +361,6 @@ //handle sample formats (unsigned, signed, float, double) switch (sample_format.val) { - case 1: //unsigned values - if (b==1){ - pix_fmt = VIL_PIXEL_FORMAT_BOOL; - return true;} - else - switch (bbs) - { - case 1: - pix_fmt = VIL_PIXEL_FORMAT_BYTE; - return true; - case 2: - pix_fmt = VIL_PIXEL_FORMAT_UINT_16; - return true; - case 3: - case 4: - pix_fmt = VIL_PIXEL_FORMAT_UINT_32; - return true; - default: - pix_fmt = VIL_PIXEL_FORMAT_UNKNOWN; - return true; - } case 2: //2s complement signed switch (b) { @@ -412,9 +391,28 @@ return false; } case 4: //undefined format + case 1: //unsigned values default: - pix_fmt = VIL_PIXEL_FORMAT_UNKNOWN; - return false; + if (b==1){ + pix_fmt = VIL_PIXEL_FORMAT_BOOL; + return true;} + else + switch (bbs) + { + case 1: + pix_fmt = VIL_PIXEL_FORMAT_BYTE; + return true; + case 2: + pix_fmt = VIL_PIXEL_FORMAT_UINT_16; + return true; + case 3: + case 4: + pix_fmt = VIL_PIXEL_FORMAT_UINT_32; + return true; + default: + pix_fmt = VIL_PIXEL_FORMAT_UNKNOWN; + return true; + } } } |