Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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()
share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

There is a function to convert Raster to NumPy array:

arcpy.RasterToNumPyArray (in_raster, {lower_left_corner}, {ncols}, {nrows}, {nodata_to_value})
share|improve this answer
    
Thanks! Keep trying~ –  Vicky Jul 30 '12 at 17:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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