1

I want to use python libraries to do image processing for very large files (over 2GB), but the current python libraries can not read 16 or 32 bit image correctly. At least, I tried Python Image library, GDAL etc. which gave me 8 bit images or 2/3 correct images.

I want to try ArcGIS as the platform through ModelBuilder for image input. Does anyone know how to integrate ArcGIS raster input with external image processing programs? My basic idea is to convert ArcGIS raster input as an array for python libraries, but I do not know how to do. Any hint or suggestion to let me continue?

The primary works I did are just install python libraries within python 2.6 for ArcGIS and some codes as following.

import arcpy
import os, sys  
import numpy as num
from scipy import ndimage
from skimage.morphology import watershed, is_local_maximum

def setupParameters():

    #local variables for input and output
    input_rater=str(arcpy.GetParameterAsText(0))
    output_raster=arcpy.GetParameterAsText(1)
    local_array=int(arcpy.GetParameterAsText(2))

    #Image segmentation using scikit-image
    distance = ndimage.distance_transform_edt(Input_Raster)
    local_maxi = is_local_maximum(distance, Input_Raster, num.ones((3, 3)))
    markers = ndimage.label(local_maxi)[0]
    labels = watershed(-distance, markers, mask=Input_Raster)

if __name__ == '__main__':
    setupParameters()
2

There is a function to convert Raster to NumPy array:

arcpy.RasterToNumPyArray (in_raster, {lower_left_corner}, {ncols}, {nrows}, {nodata_to_value})
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.