@Test
    void test() throws ImagingException, IOException {
        // These TIFF sample data includes files that contain known
        // floating-point values in various formats. We know the range
        // of values from inspection using separate utilies. This
        // test verifies that the data can be fetched successfully.
        // Note that when evaluating the range of values in a TIFF file,
        // the photometric interpreter does not include the special no-data
        // code in the tabulation. If you have a file that does not
        // define a no-data value, just use Float.NaN for testing purposes.
        //
        // Test the satellite-derived cloud imagery file
        // We know from inspection that this sample file contains values
        // in the range 0 to 1 and uses 9999 as a "no-data" value.
        File target = getTiffFile("Sample64BitFloatingPointPix451x337.tiff");
        PhotometricInterpreterFloat pInterp = readAndInterpretTIFF(target, 0f, 1f, 9999f);
        if (pInterp == null) {
            fail("Failed to read image " + target.getAbsolutePath());
        }
        float minVal = pInterp.getMinFound();
        float maxVal = pInterp.getMaxFound();
        boolean testCondition = 0.0 <= minVal && minVal <= 1.0 && 0.0 <= maxVal && maxVal <= 1.0;
        assertTrue(testCondition, "Min,Max values not in range 0 to 1: " + minVal + ", " + maxVal);
        assertTrue(minVal <= maxVal, "Min Value not <= maxVal: " + minVal + ", " + maxVal);

        // To test the sub-image logic, read the full raster and then
        // the sub-raster. Compare the results. We know from inspection
        // that the source file is organized using strips of 2 rows each.
        // The source file is of dimensions 451x337.
        // The dimensions of the sub-image are arbitrary
        AbstractTiffRasterData fullRaster = readRasterFromTIFF(target, new TiffImagingParameters());
        int height = fullRaster.getHeight();
        int width = fullRaster.getWidth();
        // checks based on the 2-rows per strip model
        checkSubImage(target, fullRaster, 17, 17, 200, 200);
        checkSubImage(target, fullRaster, 1, 3, width - 2, 1);
        checkSubImage(target, fullRaster, 1, 3, width - 2, 3);
        checkSubImage(target, fullRaster, 1, 4, width - 2, 1);
        checkSubImage(target, fullRaster, 1, 4, width - 2, 3);
        // check the 4 edges
        checkSubImage(target, fullRaster, 0, 0, width, 1); // bottom row
        checkSubImage(target, fullRaster, 0, 0, 1, height); // left column
        checkSubImage(target, fullRaster, 0, height - 1, width, 1); // top row
        checkSubImage(target, fullRaster, width - 1, 0, 1, height); // right column

        // test along the main diagonal and a parallel that reaches the top-right corner
        final int s = width - height;
        for (int i = 0; i < height - 8; i++) {
            checkSubImage(target, fullRaster, i, i, 8, 8);
            checkSubImage(target, fullRaster, i + 1, i, 8, 8);
        }

        // now read the entire image
        checkSubImage(target, fullRaster, 0, 0, width, height);

        // Test the USGS overview file
        // We know from inspection that this sample file contains values
        // in the range -2 to 62 and uses -99999 as a "no-data" value.
        // The file is organized using tiles of size 128-by-128.
        // and that the overall image size is 338-by-338.
        target = getTiffFile("USGS_13_n38w077_dir5.tiff");
        pInterp = readAndInterpretTIFF(target, -2f, 62f, -99999f);
        if (pInterp == null) {
            fail("Failed to read image " + target.getAbsolutePath());
        }
        minVal = pInterp.getMinFound();
        maxVal = pInterp.getMaxFound();
        testCondition = -2 <= minVal && minVal <= 62 && -2 <= maxVal && maxVal <= 62;
        assertTrue(testCondition, "Min,Max values not in range -2 to 62: " + minVal + ", " + maxVal);
        assertTrue(minVal <= maxVal, "Min Value not <= maxVal: " + minVal + ", " + maxVal);

        fullRaster = readRasterFromTIFF(target, new TiffImagingParameters());
        // The tile size for this file is 128-by-128. The following tests
        // read subsections starting right before the tile transition and right after it.
        height = fullRaster.getHeight();
        width = fullRaster.getWidth();
        // checks based on the 128-by-128 tile model
        checkSubImage(target, fullRaster, 126, 126, 132, 132);
        checkSubImage(target, fullRaster, 128, 128, 128, 128);
        checkSubImage(target, fullRaster, 1, 1, width - 2, height - 2);
        // check the 4 edges
        checkSubImage(target, fullRaster, 0, 0, width, 1); // bottom row
        checkSubImage(target, fullRaster, 0, 0, 1, height); // left column
        checkSubImage(target, fullRaster, 0, height - 1, width, 1); // top row
        checkSubImage(target, fullRaster, width - 1, 0, 1, height); // right column

        // now test along the main diagonal
        for (int i = 0; i < height - 8; i++) {
            checkSubImage(target, fullRaster, i, i, 8, 8);
        }

        // now read the entire image
        checkSubImage(target, fullRaster, 0, 0, width, height);
    }
Reads the floating-point content from a TIFF file.

@param target the specified TIFF file
@param params an optional map of parameters for reading.
@return if successful, a valid raster data instance
@throws ImagingException in the event of an unsupported or malformed file data element.
@throws IOException      in the event of an I/O error
src/test/java/org/apache/commons/imaging/formats/tiff/TiffFloatingPointReadTest.java