Simple python call to get original filename?

I am writing a module that carries out some manipulation of numpy arrays, and then writes out the results as python pickle datafiles. I would appreciate it if someone could help me with a call to get the original image filename from the current workspace and an object. I have been having trouble accessing the github documentation (not sure yet if it is a problem with our proxy), and exporttospreadsheet.py is a bit too complex for me to see a simple method. I know it can be more complex, but all objects and images in my pipeline are descended from a single image (ie the pipeline operates on a per image basis). My module can output the data, interfacing with the GUI was no trouble at all, but I can’t find the filename! Any help would be appreciated.

Thanks,
James H.

Hi James,

I’m not the lead software engineer, but I have written CP code for pulling image name information out of the workspace. Take a look at MeasureImageQuality, in the images_to_process defintion (line 1117): accepted_image_list = ] if pipeline is None: pipeline = workspace.pipeline for module in pipeline.modules(): if module.is_load_module(): # LoadSingleImage is not a load module columns = module.get_measurement_columns(pipeline) for column in columns: object_name, feature, coltype = column image_name = feature(len(C_FILE_NAME)+1):] if object_name == cpmeas.IMAGE and feature.startswith(C_FILE_NAME): accepted_image_list.append(image_name)
(C_FILE_NAME is imported from LoadImages, and corresponds to “FileName”)

Basically, it comes down to calling get_measurement_columns for the Load modules, and finding the measurement with the correct prefix. A similar approach can be done for objects.

Hope this helps!
-Mark