SWC Reader¶
- class dendrotweaks.morphology.io.reader.SWCReader[source]¶
Bases:
objectReads an SWC file and returns a DataFrame.
- read_file(path_to_swc_file: str) DataFrame[source]¶
Read the SWC file and return a DataFrame enriched with domain & color metadata.
- static rename_domain(df, type_idx: int, new_domain_name: str, new_color: str)[source]¶
Rename a domain in the DataFrame by changing the domain name and color for a given type index.
- static replace_domain(df, old_type_idx: int, new_type_idx: int)[source]¶
Replace a domain in the DataFrame by changing the type index, domain name, and color.
- Parameters:
df (pd.DataFrame) – The DataFrame containing the SWC data (generated by read_file).
old_type_idx (int) – The type index of the domain to be replaced.
new_type_idx (int) – The type index of the new domain.