By inferring the threshold based on SampleDimension[] minimums, I really
just meant to use the minimum value as the threshold if its available, not
to compute it.

I did notice CoverageUtilities has a getMosaicThreshold() that seems to
attempt to ignore the threshold by setting it to data type minimums:
https://github.com/geotools/geotools/blob/master/modules/library/coverage/src/main/java/org/geotools/resources/coverage/CoverageUtilities.java#L633

Unfortunately I'm even finding that the JAI Mosaic operation seems to have
a bug where the source extender only sets the values on the first band.  So
really I just can't wait for all of your good work on JAI-EXT and correct
no data handling to replace existing JAI utilities.  I have a JAI-EXT Stats
operation in as a org.opengis.coverage.processing.Operation very similar to
how JAI-tools' Zonal stats was integrated as a geotools operation which I
can contribute if that will help.


On Fri, Feb 6, 2015 at 12:37 PM, Nicola Lagomarsini <
nicola.lagomars...@geo-solutions.it> wrote:

> Hi Rich,
>
> I think that inferring the threshold on the coverage could be slow (for
> example for BigTiff data). In JAI-EXT we introduced the concept of NoData,
> which will be used by the Mosaic operation instead of the old
> threshold value.
>
> Regards,
> Nicola Lagomarsini.
>
> 2015-02-03 22:22 GMT+01:00 Rich Fecher <rfec...@gmail.com>:
>
>> We've been using the geotools' resample operation to generally resize
>> rasters and have run into an issue.  We have multiple bands with the double
>> data type and in the situation where the transform resolves to an identity
>> transform the resulting mosaic operation ends up masking some values.  The
>> Resampler2D code sets null for sourceROI and sourceThreshold for the
>> MosaicDescriptor parameters which results in the default sourceThreshold of
>> 1.0 being used. The resulting MosaicOpImage then sets all values that are
>> less than 1.0 to the background value.
>>
>> Here's where the resampler uses the default parameters:
>>
>> https://github.com/geotools/geotools/blob/master/modules/library/coverage/src/main/java/org/geotools/coverage/processing/operation/Resampler2D.java#L631
>>
>> Here's then where jai uses the background values if the value doesn't
>> exceed sourceThreshold:
>>
>> https://github.com/mauricio/jai-core/blob/master/src/share/classes/com/sun/media/jai/opimage/MosaicOpImage.java#L2059
>>
>> In our case, we have valid values less than 1.0 and the background value
>> is NaN so we are effectively arbitrarily masking some of our values.  I get
>> how we could just determine if the resample operation is going to result in
>> a Mosaic operation and then make sure the parameters are set to something
>> valid. But this is just one case and its nice that the resample operation
>> is generalized for us so we don't have to determine the underlying
>> operation.
>>
>> I'd think that the Resampler2D code could at least try to infer the
>> threshold as the minimum values from the GridSampleDimension[] of the
>> coverage.  Does that make sense?
>>
>> I actually don't entirely get when this sourceThreshold is useful - as
>> long as the background and no data values for the source and destination
>> are the same it seems unnecessary. So perhaps in the spirit of eventually
>> using jai-ext this should be something that defaults as just not being used?
>>
>> Please let me know what path I should try to go down.  Thanks,
>> Rich
>>
>>
>> ------------------------------------------------------------------------------
>> Dive into the World of Parallel Programming. The Go Parallel Website,
>> sponsored by Intel and developed in partnership with Slashdot Media, is
>> your
>> hub for all things parallel software development, from weekly thought
>> leadership blogs to news, videos, case studies, tutorials and more. Take a
>> look and join the conversation now. http://goparallel.sourceforge.net/
>> _______________________________________________
>> GeoTools-Devel mailing list
>> GeoTools-Devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>>
>>
>
>
> --
> ==
> GeoServer Professional Services from the experts! Visit
> http://goo.gl/NWWaa2 for more information.
> ==
>
> Ing. Nicola Lagomarsini
> Junior Software Engineer
>
> GeoSolutions S.A.S.
> Via Poggio alle Viti 1187
> 55054  Massarosa (LU)
> Italy
> phone: +39 0584 962313
> fax:   +39 0584 1660272
>
> http://www.geo-solutions.it
> http://twitter.com/geosolutions_it
>
> -------------------------------------------------------
>
> *AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*
>
> Le informazioni contenute in questo messaggio di posta elettronica e/o
> nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
> loro utilizzo è consentito esclusivamente al destinatario del messaggio,
> per le finalità indicate nel messaggio stesso. Qualora riceviate questo
> messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
> darcene notizia via e-mail e di procedere alla distruzione del messaggio
> stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
> divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
> utilizzarlo per finalità diverse, costituisce comportamento contrario ai
> principi dettati dal D.Lgs. 196/2003.
>
>
>
> The information in this message and/or attachments, is intended solely for
> the attention and use of the named addressee(s) and may be confidential or
> proprietary in nature or covered by the provisions of privacy act
> (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
> Code).Any use not in accord with its purpose, any disclosure, reproduction,
> copying, distribution, or either dissemination, either whole or partial, is
> strictly forbidden except previous formal approval of the named
> addressee(s). If you are not the intended recipient, please contact
> immediately the sender by telephone, fax or e-mail and delete the
> information in this message that has been received in error. The sender
> does not give any warranty or accept liability as the content, accuracy or
> completeness of sent messages and accepts no responsibility  for changes
> made after they were sent or for other risks which arise as a result of
> e-mail transmission, viruses, etc.
>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to