Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Retrieves the contents of a specific cell from a tablelike-object (HxLabelAnalysis, HxSpreadSheet, etc.) in Amira/Avizo.
# Copy/paste into the Avizo/Amira Python console.
# Alternatively, save to a file, add that file to your path, and import.
# See docstring for usage.
def get_cell_contents(tablelike_object,row,column,table=0):
"""
Retrieves contents of cell i,j in a table through
HxSpreadSheetInterface.
You must use the object handle, not just the name of the object! For example,
to get the contents of row 4 from column 5 of a HxLabelAnalysis data object
named "chocolate-bar.Label-Analysis" with only one tab:
>>> spreadsheet_data = hx_project.get('chocolate-bar.Label-Analysis')
>>> cell_value = get_cell_contents(spreadsheet_data,4,5)
Parameters
----------
tablelike_object : HxLabelAnalysis, HxSpreadSheet, HxImageAnalysis
The handle to the table-like object.
row : Int
Row number from which to retrieve value (starting at 0).
column : Int
Column number from which to retrieve value (starting at 0).
table : Int
Table (i.e. tab) from which to retrieve value (starting at 0).
Defaults to the first (or only) tab. Useful for results of
spatial graphs, where there are 3+ tabs.
Returns
-------
out : See note
Contents of the specified cell.
Note: returned valued has same type of column the item is
received from.
"""
ssi = tablelike_object.all_interfaces.HxSpreadSheetInterface
return ssi.tables[table].items[row,column]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment