Opened 12 years ago

Closed 5 years ago

#4539 closed defect (wontfix)

gdal_fillnodata.py doesn't fill raster when -si flag specified

Reported by: dickeya Owned by: warmerdam
Priority: normal Milestone: closed_because_of_github_migration
Component: default Version: 1.9.0
Severity: normal Keywords: gdal, fillnodata
Cc: Kyle Shannon

Description (last modified by dickeya)

When I run the gdal_fillnodata.py script with no arguments, it works as expected - the nodata areas get filled. If I specify the -si flag the script fills a 1px buffer and leaves the rest unfilled. In the case of Int16 data, the remainder of the hole is filled with zeros.

I'm running as:

gdal_fillnodata.py -si 1 test_F32.tif test_F32.fill.si.tif

Attachments (4)

test_F32.tif (157.3 KB ) - added by dickeya 12 years ago.
test_F32.fill.si.tif (156.8 KB ) - added by dickeya 12 years ago.
test_F32.fill.si.new.tif (157.3 KB ) - added by Kyle Shannon 12 years ago.
output after patch
4539.diff (541 bytes ) - added by Kyle Shannon 12 years ago.
patch for setting nodata value and dst mask band

Download all attachments as: .zip

Change History (10)

by dickeya, 12 years ago

Attachment: test_F32.tif added

by dickeya, 12 years ago

Attachment: test_F32.fill.si.tif added

comment:1 by dickeya, 12 years ago

Description: modified (diff)

by Kyle Shannon, 12 years ago

Attachment: test_F32.fill.si.new.tif added

output after patch

comment:2 by Kyle Shannon, 12 years ago

Cc: Kyle Shannon added
Milestone: 1.9.2
Summary: gdal_fillnodata.py doesn't fill raster when -si flag specified[patch] gdal_fillnodata.py doesn't fill raster when -si flag specified

Use -nomask:

gdal_fillnodata.py -si 1 test_F32.tif test_F32.fill.si.tif

The attached patch broke the autotests, because of setting the nodata, I will check on that and post another patch.

kss

by Kyle Shannon, 12 years ago

Attachment: 4539.diff added

patch for setting nodata value and dst mask band

comment:3 by Kyle Shannon, 12 years ago

Use -nomask:

gdal_fillnodata.py -si 1 test_F32.tif test_F32.fill.si.tif

The mask band is set to the srcband.GetMaskBand() if the script is called with out it and it doesn't get moved over to dstband.GetMaskBand()

Attached patch and output. I don't have test data for datasets with internal masks or external masks, so a quick test would be prudent if anyone has samples of those. I am running autotests right now. I am not totally certain this is completely correct, I ran into the assertion and replicated it with the c api, and stumbled upon the fix.

The patch also assigns the src nodata value to the dst nodata value, possibly fixing #4625.

kss

comment:4 by Even Rouault, 12 years ago

I have some doubt this is the correct fix (for #4011), but unfortunately I don't master this algorithm to be able to be affirmative. It looks more like something unrelated that hides the bug, and changes the behaviour of FillNoData(). Passing the mask band of the source dataset and the mask band of the target dataset is not the same thing, as the mask band of the target dataset will evolve when FillNodata runs, whereas the mask band of the source dataset is static. Anyway, Fillnodata() should work well with any passed mask band that has the right dimension. Otherwise something should be fixed in it, or its contract.

comment:5 by Kyle Shannon, 11 years ago

Summary: [patch] gdal_fillnodata.py doesn't fill raster when -si flag specifiedgdal_fillnodata.py doesn't fill raster when -si flag specified

I agree with your statement and diagnosis of my poor patch. Looking at the GDALFilterLine() function in rasterfill.cpp, I am not totally sure if the assertion is correct. The comment for the function gives no indication that it should evaluate true, nor does it make sense to me when stepping through. Same as you though, I do not have enough knowledge of the algorithm. Removing the [patch] tag from the summary.

comment:6 by Even Rouault, 5 years ago

Milestone: closed_because_of_github_migration
Resolution: wontfix
Status: newclosed

This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.

Note: See TracTickets for help on using tickets.