NV5 GEOSPATIAL SOFTWARE
Products
ENVI
ENVI Connect
ENVI Discover
ENVI Inform
ENVI Edge
ENVI Deep Learning
ENVI SAR
Helios
IDL
Solutions
ENVI Ecosystem
Defense & Intelligence
SAR Solutions
Custom Solutions
Academic
Industries
Climate Science
Disaster Management
Fed/Civil
Precision Agriculture
Transportation
Utilities
Learn
Case Studies
Videos
Blogs
Brochures
Whitepapers
Learning Tools
ENVI Quick Guides
ENVI Pocket Guides
E-Learning Program
Tutorials
Support
Self Help Tools
Documentation Center
Help Articles
Tutorials
Forums
Company
About NV5 Geospatial
Careers
News
Events
Contact Us
|
X
Products
ENVI
ENVI Connect
ENVI Discover
ENVI Inform
ENVI Edge
ENVI Deep Learning
ENVI SAR
Helios
IDL
Solutions
ENVI Ecosystem
Defense & Intelligence
SAR Solutions
Custom Solutions
Academic
Industries
Climate Science
Disaster Management
Fed/Civil
Precision Agriculture
Transportation
Utilities
Learn
Case Studies
Videos
Blogs
Brochures
Whitepapers
Learning Tools
ENVI Quick Guides
ENVI Pocket Guides
E-Learning Program
Tutorials
Support
Self Help Tools
Documentation Center
Help Articles
Tutorials
Forums
Company
About NV5 Geospatial
Careers
News
Events
Contact Us
Forums
Search Forum
Search
Advanced Search
Topics
Posts
Unanswered
Active Topics
Prev
Go to previous topic
Next
Go to next topic
Last Post 05 Mar 2018 10:59 AM by
MariM
Maintain background pixels through raster stretch
4 Replies
Sort:
Oldest First
Most Recent First
You are not authorized to post a reply.
Author
Messages
Solar Smith
New Member
Posts:5
23 Feb 2018 10:56 AM
I'm trying to write automated processing routines to stretch and reformat my binary file data.
I have floating point raster data in which the background pixels are zero and all valid values are greater than zero.
I need to stretch the data to byte values and keep the background pixels distinct from the data pixels.
I'm trying to use ENVILogStretchRaster to stretch the data. Unfortunately, pixel values near the MIN value are being mapped to zero which then look like background values. I'd like to be able to specify the valid output range for valid data but I don't see the ability to do that in the ...StretchRaster documentation.
Lacking an alternative, I'm resorting to using 'WHERE' to first identify the non-background pixels before the stretch, then another 'WHERE' to change all of the non-backgournd stretched values that are zero to '1'. However, this requires a couple of extra 'GetData' processes which are very inefficient with large datasets. Is there a faster, more efficient way to stretch the data and preserve background pixels as background?
MariM
Veteran Member
Posts:2396
26 Feb 2018 11:35 AM
Have you tried one of the Stretch options after applying a mask to the 0 values using the Data ignore value?
http://www.harrisgeospatial.com/docs/Masks.html
Solar Smith
New Member
Posts:5
26 Feb 2018 10:35 PM
Yes, I did try setting the Data_Ignore_Value but I still saw no zero for both the output background pixels and the lowest data pixels.
Solar Smith
New Member
Posts:5
26 Feb 2018 10:51 PM
It's possible I didn't understand how to properly create and apply a mask using the 'Data_Ignore_Value' with the ENVI??StretchRaster routine. It might be helpful if I saw a script sample of how to correctly do that with say 'ENVILogStretchRaster'.
Thanks
MariM
Veteran Member
Posts:2396
05 Mar 2018 10:59 AM
I could stretch the data using the following code. This includes setting the data ignore value, calculating the statistical min/max and then stretching the remaining values to bytes:
pro stretchFloats
compile_opt idl2
e=envi()
file='c:\temp\Quac_scaled.dat'
raster=e.openraster(file)
;start task
task1 = ENVITask('EditRasterMetadata')
task1.input_raster=raster
task1.data_ignore_value = 0.0
task1.output_raster_uri = e.GetTemporaryFilename()
task1.execute
DataColl = e.Data
DataColl.Add, Task1.Output_Raster
Task2=ENVITask('RasterStatistics')
task2.input_raster=task1.output_raster
Task2.Execute
Print, Task2.MAX
Print, Task2.MIN
Task3=ENVITask('LogStretchRaster')
task3.input_raster=task1.output_raster
Task3.MIN = task2.min
Task3.MAX = task2.max
Task3.OUTPUT_RASTER_URI = e.GetTemporaryFilename()
task3.Execute
DataColl = e.Data
DataColl.Add, Task3.Output_Raster
view = e.GetView()
layer = view.CreateLayer(task3.output_raster)
end
You are not authorized to post a reply.
Forum Groups & Categories
--NV5 Geospatial Software
----Licensing & Installation
----General Questions
Products
--ENVI
----ENVI
----ENVI LiDAR
----ENVI SARscape
--IDL
--Enterprise
----ENVI Server
Forums
Products
ENVI