Historical Map  1.0
Plugin for automatic extraction of old forest from historical map
 All Classes Namespaces Files Functions Variables
Functions
HistoricalMap.function_dataraster Namespace Reference

Manage data (opening/saving raster, get ROI...) More...

Functions

def open_data_band
 The function open and load the image given its name. More...
 
def create_empty_tiff
 Write an empty image on the hard drive. More...
 
def get_samples_from_roi
 Get the set of pixels given the thematic map. More...
 
def predict_image
 Classify the whole raster image, using per block image analysis The classifier is given in classifier and options in kwargs. More...
 
def smooth_image
 Apply a smoothing filter on all the pixels of the input image. More...
 

Detailed Description

Manage data (opening/saving raster, get ROI...)

Function Documentation

def HistoricalMap.function_dataraster.create_empty_tiff (   outname,
  im,
  d,
  GeoTransform,
  Projection 
)

Write an empty image on the hard drive.

Input: outname: the name of the file to be written im: the image cube GeoTransform: the geotransform information Projection: the projection information Output: Nothing –

Definition at line 64 of file function_dataraster.py.

def HistoricalMap.function_dataraster.get_samples_from_roi (   raster_name,
  roi_name 
)

Get the set of pixels given the thematic map.

Get the set of pixels given the thematic map. Both map should be of same size. Data is read per block. Input: raster_name: the name of the raster file, could be any file that GDAL can open roi_name: the name of the thematic image: each pixel whose values is greater than 0 is returned Output: X: the sample matrix. A nXd matrix, where n is the number of referenced pixels and d is the number of variables. Each line of the matrix is a pixel. Y: the label of the pixel Written by Mathieu Fauvel.

Definition at line 121 of file function_dataraster.py.

def HistoricalMap.function_dataraster.open_data_band (   filename)

The function open and load the image given its name.

The function open and load the image given its name. The type of the data is checked from the file and the scipy array is initialized accordingly. Input: filename: the name of the file Output: data : the opened data with gdal.Open() method im : empty table with right dimension (array)

Definition at line 7 of file function_dataraster.py.

def HistoricalMap.function_dataraster.predict_image (   raster_name,
  classif_name,
  classifier,
  mask_name = None 
)

Classify the whole raster image, using per block image analysis The classifier is given in classifier and options in kwargs.

Input: raster_name (str) classif_name (str) classifier (str) mask_name(str)

Return: Nothing but raster written on disk Written by Mathieu Fauvel.

Definition at line 203 of file function_dataraster.py.

def HistoricalMap.function_dataraster.smooth_image (   raster_name,
  mask_name,
  output_name,
  l,
  t 
)

Apply a smoothing filter on all the pixels of the input image.

Input: raster_name: the name of the originale SITS mask_name: the name of the mask. In that file, every pixel with value greater than 0 is masked. output_name: the name of the smoothed image

TO DO:

  • check the input file format (uint16 or float)
  • parallelization

Written by Mathieu Fauvel

Definition at line 320 of file function_dataraster.py.