From 2e30e207bbbaa71ae42861ee1ec7cf9de62a16ef Mon Sep 17 00:00:00 2001 From: jpmetzca Date: Wed, 1 Feb 2023 20:35:04 -0500 Subject: [PATCH] Updated python viz readme and python viz files. --- python_imaging/README.md | 15 ++++++-- python_imaging/cell_march_movie_script.py | 26 ++----------- python_imaging/cell_march_stills_script.py | 7 +--- .../cell_plus_environment_movie_maker.py | 25 ------------- .../cell_plus_environment_plotter.py | 37 ------------------- python_imaging/finished-combined-plot.py | 25 +------------ python_imaging/full_history_movie_script.py | 24 ++---------- python_imaging/full_history_still_script.py | 8 +--- python_imaging/generic_movie_maker.py | 2 +- .../image_processing_for_physicell.py | 26 +++---------- python_imaging/image_processing_script.py | 18 +++------ .../partial_history_2_level_contour_movie.py | 32 +--------------- .../partial_history_2_level_contour_still.py | 25 +------------ ...artial_history_multilevel_contour_movie.py | 27 +------------- ...artial_history_multilevel_contour_still.py | 24 +----------- 15 files changed, 42 insertions(+), 279 deletions(-) diff --git a/python_imaging/README.md b/python_imaging/README.md index bbba388..3df60b0 100644 --- a/python_imaging/README.md +++ b/python_imaging/README.md @@ -5,10 +5,16 @@ ## Scripts - - -Advanced scripts - using the PhysiCellPlotter class in `image_processing_for_physicell.py`. Place scripts in `output` or other directory at same level or alter path assignment. -* +Advanced scripts - using the PhysiCellPlotter class in `image_processing_for_physicell.py`. Place scripts in `output` or other directory at same level or alter path assignment. Examples used to produce stills and movies for [this preprint](https://www.biorxiv.org/content/10.1101/2022.11.21.514608) are given below. Using the various options available in the PhysiCellPlotter class, other visualizations can be created. +* `full_history_movie_script.py`: Generates movie using all available outputs and plots the full cell positional histories as well as current cell positions and ECM fiber element orientations. +* `generic_movie_maker.py`: Generates a movie with default vizualization values. +sys.path.append(r'../python_imaging') +* `full_history_still_script.py`: Generates still, ploting the full cell positional histories up to the point of the still as well as current cell positions and ECM fiber element orientations +* `image_processing_script.py`: Generic example plotter. Outputs and shows a plot of the diffusing substrate and overlays cell positions. Loads frame 100. +* `partial_history_2_level_contour_movie.py`: Generates of movie with each frame a recent portion of cell positional histories and anisotropy with 2 contour color levels (used for cases of instant ECM remodeling) as well as current cell positions and ECM fiber element orientations. +* `partial_history_2_level_contour_still.py`: Plots a recent portion of cell positional histories and anisotropy with 2 contour color levels (used for cases of instant ECM remodeling) as well as current cell positions and ECM fiber element orientations. +* `partial_history_multilevel_contour_movie.py`: Plots a recent portion of cell positional histories and anisotropy with multiple contour color levels as well as current cell positions and ECM fiber element orientations. +* `partial_history_multilevel_contour_still.py`: Generates of movie with each frame a recent portion of cell positional histories and anisotropy with multiple contour color levels as well as current cell positions and ECM fiber element orientations. Basic scripts. Original basis for integrated plotter in `image_processing_for_physicell.py`. Included as basic original examples. Place scripts in `output` or other directory at same level or alter path assignment. @@ -17,3 +23,4 @@ Basic scripts. Original basis for integrated plotter in `image_processing_for_ph * `cell_plus_environment_plotter.py`: Generates a still of the ECM anisotorpy and orientations with cell overlay. Alter as needed for need. * `cell_track_plotter.py`: Plots still of cells and cell positional histories. * `cell_tracker_movie.py`: Generates a movie of cells and cell positional histories. +* `finished-combined-plot.py`: Generates a layered plot combining cell positions and multiple aspcts of the microenvironment. diff --git a/python_imaging/cell_march_movie_script.py b/python_imaging/cell_march_movie_script.py index 5663398..f4d91ca 100644 --- a/python_imaging/cell_march_movie_script.py +++ b/python_imaging/cell_march_movie_script.py @@ -1,6 +1,6 @@ import sys import matplotlib.pyplot as plt -sys.path.append(r'/Users/JohnMetzcar/Documents/GitHub/AMIGOS-invasion/python_imaging') +sys.path.append(r'../python_imaging') from image_processing_for_physicell import * @@ -17,7 +17,7 @@ "load_SVG_data": False, 'plot_cells_from_physicell_data': True, "produce_for_movie" : True, - "contour_options" : {'lowest_contour': 0.90, ### I woud like this to be cleaner - but it does work!!! + "contour_options" : {'lowest_contour': 0.90, 'upper_contour': 0.92, 'number_of_levels': 25, 'color_map_name': 'Reds', @@ -33,32 +33,12 @@ 'INCLUDE_FULL_HISTORY': False } -#### Right now, if you don't have None or the full contour and quiver options, it will break in the plotting ... I wonder if there -#### is a better/more robust way to do it (kwargs???, lots of "trapping"??) but this will be handled later +#### Right now, if you don't have None or the full contour and quiver options, it will break in the plotting. mf = PhysiCellPlotter() mf.produce_movie(save_name='figure_2a_march', movie_options=movie_options_for_figure_2a, image_options=options_for_figure2a) -# m2 = PhysiCellPlotter() -# m3 = PhysiCellPlotter() - -# image_list_for_figure2a = [] - -# image_list_for_figure2a = [90, 500, 1200] - -# file_name = 'march_' + str(90) - -# for number in image_list_for_figure2a: -# mf.generic_plotter(starting_index=number, number_of_samples=1, options=options_for_figure2a, file_name='march_' + str(number)) - -# mf.generic_plotter(starting_index=90, number_of_samples=1, options=options_for_figure2a) -# m2.generic_plotter(starting_index=500, number_of_samples=1, options=options_for_figure2a) -# m3.generic_plotter(starting_index=1200, number_of_samples=1, options=options_for_figure2a) - -# mf.generic_plotter (number_of_samples=10, options=options_for_figure2a) -# mf.create_separate_colorbar(contour_options=options_for_figure2a['contour_options']) - # generic_plotter (start, intervnal, finish, save_filename, data_path, save_path, options) # # All based on options/logic- function diff --git a/python_imaging/cell_march_stills_script.py b/python_imaging/cell_march_stills_script.py index 5e076f9..5c09b4c 100644 --- a/python_imaging/cell_march_stills_script.py +++ b/python_imaging/cell_march_stills_script.py @@ -1,6 +1,6 @@ import sys import matplotlib.pyplot as plt -sys.path.append(r'/Users/JohnMetzcar/Documents/GitHub/AMIGOS-invasion/python_imaging') +sys.path.append(r'../python_imaging') from image_processing_for_physicell import * @@ -26,12 +26,9 @@ "mask_quiver": False} } -#### Right now, if you don't have None or the full contour and quiver options, it will break in the plotting ... I wonder if there -#### is a better/more robust way to do it (kwargs???, lots of "trapping"??) but this will be handled later ... +#### Right now, if you don't have None or the full contour and quiver options, it will break in the plotting ... mf = PhysiCellPlotter() -# m2 = PhysiCellPlotter() -# m3 = PhysiCellPlotter() image_list_for_figure2a = [] diff --git a/python_imaging/cell_plus_environment_movie_maker.py b/python_imaging/cell_plus_environment_movie_maker.py index f14f871..204ee52 100644 --- a/python_imaging/cell_plus_environment_movie_maker.py +++ b/python_imaging/cell_plus_environment_movie_maker.py @@ -92,21 +92,6 @@ def create_plot(snapshot, folder, output_folder='.', output_plot=True, show_plot # levels_ecm = np.linspace(1e-14, 1.0, num_levels) levels_ecm = np.linspace(0.90, 0.93, num_levels) # for the march environment - need to especially highlight small changes in anistoropy. - # Old function and scripting to scale and threshold anisotorpy values for later use in scaling lenght of ECM fibers - # for visualization purposes. - - # micro = plane_anisotropy - # micro_scaled = micro - # - # def curve(x): - # #return (V_max * x) / (K_M + x) - # return 0.5 if x > 0.5 else x - - # for i in range(len(micro)): - # for j in range(len(micro[i])): - # #micro_scaled[i][j] = 10 * math.log10(micro[i][j] + 1) / math.log10(2) - # micro_scaled[i][j] = curve(micro[i][j]) - ##### Process data for plotting - weight fibers by anisotropy, mask out 0 anisotropy ECM units, get cell radii and types # Anisotropy strictly runs between 0 and 1. Element by element mulitplication produces weighted lengths between 0 - 1 @@ -148,17 +133,10 @@ def create_plot(snapshot, folder, output_folder='.', output_plot=True, show_plot radius=plot_df.loc[j, 'radius'], alpha=0.7, edgecolor='black') ax.add_artist(circ) - # add quiver layer with scaled arrows ### - # q = ax.quiver(xx_ecm[mask], yy_ecm[mask], scaled_ECM_x[mask], scaled_ECM_y[mask], pivot='middle', angles='xy', scale_units='inches', scale=2.0, headwidth=0, - # width=0.0015) ## What is the deal with the line segment lengths shifting as the plots progress when I don't ue teh scaling?? - # add ECM orientation vectors unscaled by anistorpy ### plt.quiver(xx, yy, ECM_x, ECM_y, pivot='middle', angles='xy', scale_units='inches', scale=3.0, hheadwidth=0,headlength=0, headaxislength=0) - # ax.axis('scaled') #used to be 'equal' https://stackoverflow.com/questions/45057647/difference-between-axisequal-and-axisscaled-in-matplotlib - # This changes teh axis from -750,750 to ~-710,730. It looks better with scaled compared to axix, but either way it changes the plot limits - # Labels and title (will need removed for journal - they will be added manually) ax.set_xlabel('x [micron]') ax.set_ylabel('y [micron]') @@ -209,9 +187,6 @@ def create_movie(data_path: str, save_path: str, save_name: str): # make the movie - see ffmpeg documentation for more information - # consider saving as jpegs - https://blender.stackexchange.com/questions/148231/what-image-format-encodes-the-fastest-or-at-least-faster-png-is-too-slow - # consider compiling as movie instead of saving the files (all to increase processing speed) (then again, it was teh same speed) - # consider not loading the unneeded data - and be sure to get rid of the unneeded fields!!! os.system( diff --git a/python_imaging/cell_plus_environment_plotter.py b/python_imaging/cell_plus_environment_plotter.py index 9cd3282..c14b217 100644 --- a/python_imaging/cell_plus_environment_plotter.py +++ b/python_imaging/cell_plus_environment_plotter.py @@ -97,21 +97,6 @@ def create_plot(snapshot, folder, output_folder='.', output_plot=True, show_plot # levels_ecm = np.linspace(1e-14, 1.0, num_levels) levels_ecm = np.linspace(0.90, 0.93, num_levels) # for the march environment - need to especially highlight small changes in anistoropy. - # Old function and scripting to scale and threshold anisotorpy values for later use in scaling lenght of ECM fibers - # for visualization purposes. - - # micro = plane_anisotropy - # micro_scaled = micro - # - # def curve(x): - # #return (V_max * x) / (K_M + x) - # return 0.5 if x > 0.5 else x - - # for i in range(len(micro)): - # for j in range(len(micro[i])): - # #micro_scaled[i][j] = 10 * math.log10(micro[i][j] + 1) / math.log10(2) - # micro_scaled[i][j] = curve(micro[i][j]) - ##### Process data for plotting - weight fibers by anisotropy, mask out 0 anisotropy ECM units, get cell radii and types # Anisotropy strictly runs between 0 and 1. Element by element mulitplication produces weighted lengths between 0 - 1 @@ -158,17 +143,10 @@ def create_plot(snapshot, folder, output_folder='.', output_plot=True, show_plot # radius=plot_df.loc[j, 'radius'], alpha=0.7, edgecolor='black') ax.add_artist(circ) - # add quiver layer with scaled arrows ### - # q = ax.quiver(xx_ecm[mask], yy_ecm[mask], scaled_ECM_x[mask], scaled_ECM_y[mask], pivot='middle', angles='xy', scale_units='inches', scale=2.0, headwidth=0, - # width=0.0015) ## What is the deal with the line segment lengths shifting as the plots progress when I don't ue teh scaling?? - # add ECM orientation vectors unscaled by anistorpy ### plt.quiver(xx, yy, ECM_x, ECM_y, pivot='middle', angles='xy', scale_units='inches', scale=4.75, headwidth=0,headlength=0, headaxislength=0, alpha = 0.3) ### was at 3.0 before changing the mat size from 12 to 8 to match my otherr images AND get the font for the ticks large - # ax.axis('scaled') #used to be 'equal' https://stackoverflow.com/questions/45057647/difference-between-axisequal-and-axisscaled-in-matplotlib - # This changes teh axis from -750,750 to ~-710,730. It looks better with scaled compared to axix, but either way it changes the plot limits - # Labels and title (will need removed for journal - they will be added manually) plt.ylim(-500, 500) @@ -203,19 +181,4 @@ def create_plot(snapshot, folder, output_folder='.', output_plot=True, show_plot snapshot = sys.argv[1] output_plot = bool(distutils.util.strtobool(sys.argv[2])) show_plot = bool(distutils.util.strtobool(sys.argv[3])) - - # elif (len(sys.argv) == 4): - # usage_str = "Usage: %s <# of samples to include>" % ( - # sys.argv[0]) - # # print(usage_str) - # starting_index = int(sys.argv[1]) - # sample_step_interval = int(sys.argv[2]) - # number_of_samples = int(sys.argv[3]) - - # # print("e.g.,") - # # eg_str = "%s 0 1 10 indicates start at 0, go up by ones, and stop when you 10 samples" % (sys.argv[0]) - # # print(eg_str) - - # Sample call with meaningful variables: - # create_plot('output00000275', output_folder='21_03_leader_follower_model_3_test/',output_plot=False, show_plot=False) create_plot(snapshot, '.', '', output_plot=True, show_plot=False) \ No newline at end of file diff --git a/python_imaging/finished-combined-plot.py b/python_imaging/finished-combined-plot.py index f7c3d41..7090aa4 100644 --- a/python_imaging/finished-combined-plot.py +++ b/python_imaging/finished-combined-plot.py @@ -88,21 +88,6 @@ def create_plot(snapshot, folder, output_folder='.', output_plot=True, show_plot levels_o2 = np.linspace(1e-14, 38, num_levels) levels_ecm = np.linspace(1e-14, 1.0, num_levels) - # Old function and scripting to scale and threshold anisotorpy values for later use in scaling lenght of ECM fibers - # for visualization purposes. - - # micro = plane_anisotropy - # micro_scaled = micro - # - # def curve(x): - # #return (V_max * x) / (K_M + x) - # return 0.5 if x > 0.5 else x - - # for i in range(len(micro)): - # for j in range(len(micro[i])): - # #micro_scaled[i][j] = 10 * math.log10(micro[i][j] + 1) / math.log10(2) - # micro_scaled[i][j] = curve(micro[i][j]) - ##### Process data for plotting - weight fibers by anisotropy, mask out 0 anisotropy ECM units, get cell radii and types # Anisotropy strictly runs between 0 and 1. Element by element mulitplication produces weighted lengths between 0 - 1 @@ -145,15 +130,9 @@ def create_plot(snapshot, folder, output_folder='.', output_plot=True, show_plot ax.add_artist(circ) # add quiver layer with scaled arrows ### - q = ax.quiver(xx_ecm[mask], yy_ecm[mask], scaled_ECM_x[mask], scaled_ECM_y[mask], pivot='middle', angles='xy', scale_units='inches', scale=2.0, headwidth=0, - width=0.0015) ## What is the deal with the line segment lengths shifting as the plots progress when I don't ue teh scaling?? - - # add unscaled arrows ### - # plt.quiver(xx[mask], yy[mask], ECM_x[mask], ECM_y[mask], - # pivot='mid', angles='xy', headwidth=3) + q = ax.quiver(xx_ecm[mask], yy_ecm[mask], scaled_ECM_x[mask], scaled_ECM_y[mask], pivot='middle', angles='xy', scale_units='inches', scale=2.0, headwidth=0,headlength=0, headaxislength=0, + width=0.0015) - # ax.axis('scaled') #used to be 'equal' https://stackoverflow.com/questions/45057647/difference-between-axisequal-and-axisscaled-in-matplotlib - # This changes teh axis from -750,750 to ~-710,730. It looks better with scaled compared to axix, but either way it changes the plot limits # Labels and title ax.set_xlabel('x [micron]') diff --git a/python_imaging/full_history_movie_script.py b/python_imaging/full_history_movie_script.py index 33ca531..b1c4c9b 100644 --- a/python_imaging/full_history_movie_script.py +++ b/python_imaging/full_history_movie_script.py @@ -1,6 +1,6 @@ import sys import matplotlib.pyplot as plt -sys.path.append(r'/Users/JohnMetzcar/Documents/GitHub/AMIGOS-invasion/python_imaging') +sys.path.append(r'../python_imaging') from image_processing_for_physicell import * @@ -27,26 +27,8 @@ 'INCLUDE_FULL_HISTORY': True } -#### Right now, if you don't have None or the full contour and quiver options, it will break in the plotting ... I wonder if there -#### is a better/more robust way to do it (kwargs???, lots of "trapping"??) but this will be handled later ... and I can ask Randy etc -### What is up with scaling - hum ... - -# oof - I got different results on the two runs when I did and didn't scale by anistoropy ... yikes! How do I manage that!! +#### Right now, if you don't have None or the full contour and quiver options, it will break in the plotting ... mf = PhysiCellPlotter() -mf.produce_movie(save_name='figure_2d_circular_ecm_with_chemotaxsis', movie_options=movie_options_for_figure_2d, image_options=options_for_figure2d) - -# mf.generic_plotter(starting_index=0, number_of_samples=1, options=options_for_figure2d, file_name='circular_ECM_w_chemical_cue_0') - -# image_list_for_figure2d = [150, 417] - -# options_for_figure2d['plot_ECM_orientation'] = False -# options_for_figure2d['retrieve_ECM_data'] = False -# options_for_figure2d['load_full_physicell_data'] = False - - -# mf.produce_movie() - -# for number in image_list_for_figure2d: -# mf.generic_plotter(starting_index=0, number_of_samples=number, options=options_for_figure2d, file_name='circular_ECM_w_chemical_cue_' + str(number)) \ No newline at end of file +mf.produce_movie(save_name='figure_2d_circular_ecm_with_chemotaxsis', movie_options=movie_options_for_figure_2d, image_options=options_for_figure2d) \ No newline at end of file diff --git a/python_imaging/full_history_still_script.py b/python_imaging/full_history_still_script.py index 24dfbcf..b51ca28 100644 --- a/python_imaging/full_history_still_script.py +++ b/python_imaging/full_history_still_script.py @@ -1,6 +1,6 @@ import sys import matplotlib.pyplot as plt -sys.path.append(r'/Users/JohnMetzcar/Documents/GitHub/AMIGOS-invasion/python_imaging') +sys.path.append(r'../python_imaging') from image_processing_for_physicell import * @@ -20,11 +20,7 @@ "mask_quiver": False} } -#### Right now, if you don't have None or the full contour and quiver options, it will break in the plotting ... I wonder if there -#### is a better/more robust way to do it (kwargs???, lots of "trapping"??) but this will be handled later ... and I can ask Randy etc -### What is up with scaling - hum ... - -# oof - I got different results on the two runs when I did and didn't scale by anistoropy ... yikes! How do I manage that!! +#### Right now, if you don't have None or the full contour and quiver options, it will break in the plotting ... mf = PhysiCellPlotter() diff --git a/python_imaging/generic_movie_maker.py b/python_imaging/generic_movie_maker.py index f903284..fcc3636 100644 --- a/python_imaging/generic_movie_maker.py +++ b/python_imaging/generic_movie_maker.py @@ -1,6 +1,6 @@ import sys import matplotlib.pyplot as plt -sys.path.append(r'/Users/JohnMetzcar/Documents/GitHub/AMIGOS-invasion/python_imaging') +sys.path.append(r'../python_imaging') from image_processing_for_physicell import * diff --git a/python_imaging/image_processing_for_physicell.py b/python_imaging/image_processing_for_physicell.py index 72aea3f..de4e3b2 100644 --- a/python_imaging/image_processing_for_physicell.py +++ b/python_imaging/image_processing_for_physicell.py @@ -32,7 +32,7 @@ def memory_usage(): from pyMCDS import * # Features for PhysiImage module -# Plots cells, tracks (as vectors???), and at least one microenvironment feature (ECM or otherwise) +# Plots cells, cell positional history, and at least one microenvironment feature (ECM or otherwise) # Allows for fine grain control of rate of plotting of tracks - start, end and interval # Allows for fine grain control of outputs - quality, for insets, for videos # has scale bar (ideally) @@ -40,8 +40,8 @@ def memory_usage(): # preserves cell colors (only in SVGs!!!!!!!!) and also allows for that to be overridden if needed # Gets mat size and time/slide number from images # Allows you to specify a title and add time/slide number to it -# plots color bar that isn't stupidly large (can I get something that returns a figure and then lets me change it in a script????) Ormaybe I can just write a bunch of different ones or use flags. Something to make it easier than it currently is - which it is currently assine. -# Be able to specify an output directory (might want to check that it is exsists (or not - does Python give an error?)) +# plots color bar +# Be able to specify an output directory (might want to check that it is exsists) # Add in module catch that says - ECM functionality will fail - load pyMCDS_ECM to use with ECM, otherwise your are fine class PhysiCellPlotter(): @@ -305,7 +305,6 @@ def create_quiver_plot(self, scaling_values: dict, x_mesh: dict, y_mesh: dict, x pivot='middle', angles='xy', scale_units='inches', scale=12.0, units='width', width=0.0025, headwidth=0,headlength=0, headaxislength=0, alpha = 0.3) else: if quiver_options["scale_quiver"] is True: - # sfact = 0.45 # rwh 0.6 scaling_values = scaling_values ECM_x = np.multiply(x_orientation, scaling_values) ECM_y = np.multiply(y_orientation, scaling_values) @@ -313,9 +312,6 @@ def create_quiver_plot(self, scaling_values: dict, x_mesh: dict, y_mesh: dict, x ECM_x = x_orientation ECM_y = y_orientation - # q = ax.quiver(xx_ecm[mask], yy_ecm[mask], scaled_ECM_x[mask], scaled_ECM_y[mask], pivot='middle', angles='xy', scale_units='inches', scale=2.0, headwidth=0, - # width=0.0015) ## What is the deal with the line segment lengths shifting as the plots progress when I don't ue teh scaling?? - # mask out zero vectors mask = scaling_values > 0.0001 if quiver_options["mask_quiver"] is True: @@ -349,7 +345,7 @@ def retreive_ECM_data(self): return xx_ecm, yy_ecm, anisotropy_at_z_equals_zero, density_at_z_equals_zero, x_orientation_at_z_equals_zero, y_orientation_at_z_equals_zero - def plot_figure(self, title_str: str, plot_x_extend: float, plot_y_extend: float, file_name: str, output_directory: str='', options: dict=None): ###### This should probably have to have options??????? Why though??? + def plot_figure(self, title_str: str, plot_x_extend: float, plot_y_extend: float, file_name: str, output_directory: str='', options: dict=None): if options is None: options= {"output_plot": True, "show_plot": True, @@ -359,12 +355,10 @@ def plot_figure(self, title_str: str, plot_x_extend: float, plot_y_extend: float show_plot = options['show_plot'] produce_for_panel = options['produce_for_panel'] output_folder = '' - # print(output_folder.type) - # print(file_name.type) - # fig.figure(figsize=(7, 7)) self.ax.set_aspect("equal") # endpoint = starting_index + sample_step_interval*number_of_samples + #### Build plot frame, titles, and save data self.ax.set_ylim(-plot_y_extend/2, plot_y_extend/2) self.ax.set_xlim(-plot_x_extend/2, plot_x_extend/2) @@ -955,16 +949,6 @@ def plot_cells_and_uE_for_movie (starting_index: int, sample_step_interval: int, plot_cell_tracks_from_svg (starting_index, sample_step_interval, number_of_samples, file_name, options) # or a dictionary - and then I just modify the dictionary for the options or even have several of them - - # 0 - # 1 - # 417 - # True - # True - # True - - # test_of_args_and_kwargs(0, 0, 0, output_plot='False') - def plot_cell_tracks_from_svg(starting_index: int, sample_step_interval: int, number_of_samples: int, file_name: str=None, options=None ): """ Produces savable image of cell positional history, plotted as arrows (quiver plot) with final cell positions plotted as a cirle. diff --git a/python_imaging/image_processing_script.py b/python_imaging/image_processing_script.py index dde1ef5..3142a9a 100644 --- a/python_imaging/image_processing_script.py +++ b/python_imaging/image_processing_script.py @@ -5,7 +5,7 @@ # will also need either 'pyMCDS.py' or 'pyMCDS_ECM.py'. Otherwise, place 'imaging_processing_for_phyiscell.py' and either MCDS file # in the current working directory. -# sys.path.append(r'') +sys.path.append(r'../python_imaging') from image_processing_for_physicell import * @@ -30,21 +30,12 @@ "quiver_options" : None } -#### Right now, if you don't have None or the full contour and quiver options, it will break in the plotting ... I wonder if there -#### is a better/more robust way to do it (kwargs???, lots of "trapping"??) but this will be handled later ... and I can ask Randy etc -### What is up with scaling - hum ... - -# oof - I got different results on the two runs when I did and didn't scale by anistoropy ... yikes! How do I manage that!! +#### Right now, if you don't have None or the full contour and quiver options, it will break in the plotting ... mf = PhysiCellPlotter() -# options[''] - -# plot_cells_and_uE_for_movie (0, 1, 10, 1999) -# -# -# plot_cell_tracks_from_svg(0, 1, 10) -# general_image_plotter (filename: str, folder: str='.', output_folder='', cell_df: dict=None, cell_positions_from_SVG: dict=None, chemical_mesh: dict=None, ECM_mesh: dict=None, options=None): +# mf.plot_cell_tracks_from_svg(0, 1, 10) +# mf.general_image_plotter (filename: str, folder: str='.', output_folder='', cell_df: dict=None, cell_positions_from_SVG: dict=None, chemical_mesh: dict=None, ECM_mesh: dict=None, options=None): image_list_for_figure = [] @@ -52,6 +43,7 @@ for number in image_list_for_figure: mf.generic_plotter(starting_index=0, number_of_samples=number, options=options_for_figure) + # generic_plotter (start, intervnal, finish, save_filename, data_path, save_path, options) # # All based on options/logic- function diff --git a/python_imaging/partial_history_2_level_contour_movie.py b/python_imaging/partial_history_2_level_contour_movie.py index 9336f32..6eb44c1 100644 --- a/python_imaging/partial_history_2_level_contour_movie.py +++ b/python_imaging/partial_history_2_level_contour_movie.py @@ -1,6 +1,6 @@ import sys import matplotlib.pyplot as plt -sys.path.append(r'/Users/JohnMetzcar/Documents/GitHub/AMIGOS-invasion/python_imaging') +sys.path.append(r'../python_imaging') from image_processing_for_physicell import * @@ -31,40 +31,12 @@ 'INCLUDE_FULL_HISTORY': False } -#### Right now, if you don't have None or the full contour and quiver options, it will break in the plotting ... I wonder if there -#### is a better/more robust way to do it (kwargs???, lots of "trapping"??) but this will be handled later ... and I can ask Randy etc -### What is up with scaling - hum ... - -# oof - I got different results on the two runs when I did and didn't scale by anistoropy ... yikes! How do I manage that!! +#### Right now, if you don't have None or the full contour and quiver options, it will break in the plotting ... mf = PhysiCellPlotter() -# m2 = PhysiCellPlotter() -# m3 = PhysiCellPlotter() - -# image_list_for_figure2a = [] - -# image_list_for_figure2a = [90, 500, 1200] - -# file_name = 'march_' + str(90) - -# for number in image_list_for_figure2a: -# mf.generic_plotter(starting_index=number, number_of_samples=1, options=options_for_figure2a, file_name='march_' + str(number)) - -# starting_index: int = 0, sample_step_interval: int = 1, number_of_samples: int = 120, mf.produce_movie(save_name='adh_0_repulsion_0_speed_10_20_20_ECM_with_write_05', trail_length=15, movie_options=movie_options_for_figure_4, image_options=options_for_figure4_movie) -# next - adh_0_repulsion_0_speed_10_20_20_ECM_with_write_05_no_following(s=0) - -# mf.produce_movie(save_name='figure_4_parameter_set_21_80_80_ECM_with_chemotaxsis', trail_length=1, movie_options=movie_options_for_figure_4, image_options=options_for_figure4_movie) - -# mf.generic_plotter(starting_index=90, number_of_samples=1, options=options_for_figure2a) -# m2.generic_plotter(starting_index=500, number_of_samples=1, options=options_for_figure2a) -# m3.generic_plotter(starting_index=1200, number_of_samples=1, options=options_for_figure2a) - -# mf.generic_plotter (number_of_samples=10, options=options_for_figure2a) -# mf.create_separate_colorbar(contour_options=options_for_figure2a['contour_options']) - # generic_plotter (start, intervnal, finish, save_filename, data_path, save_path, options) # # All based on options/logic- function diff --git a/python_imaging/partial_history_2_level_contour_still.py b/python_imaging/partial_history_2_level_contour_still.py index 0ae6b74..4b586fe 100644 --- a/python_imaging/partial_history_2_level_contour_still.py +++ b/python_imaging/partial_history_2_level_contour_still.py @@ -1,6 +1,6 @@ import sys import matplotlib.pyplot as plt -sys.path.append(r'/Users/JohnMetzcar/Documents/GitHub/AMIGOS-invasion/python_imaging') +sys.path.append(r'../python_imaging') from image_processing_for_physicell import * @@ -24,38 +24,17 @@ }, } -#### Right now, if you don't have None or the full contour and quiver options, it will break in the plotting ... I wonder if there -#### is a better/more robust way to do it (kwargs???, lots of "trapping"??) but this will be handled later ... and I can ask Randy etc -### What is up with scaling - hum ... - -# oof - I got different results on the two runs when I did and didn't scale by anistoropy ... yikes! How do I manage that!! +#### Right now, if you don't have None or the full contour and quiver options, it will break in the plotting mf = PhysiCellPlotter() -# m2 = PhysiCellPlotter() -# m3 = PhysiCellPlotter() - -# image_list_for_figure2a = [] image_list_for_figure5a = [60, 160] -# file_name = 'march_' + str(90) - number_of_samples = 12 for number in image_list_for_figure5a: starting_index = number-number_of_samples + 1 mf.generic_plotter(starting_index=starting_index, number_of_samples=number_of_samples, options=options_for_figure5a, file_name='Figure_5a' + str(number)) -# starting_index: int = 0, sample_step_interval: int = 1, number_of_samples: int = 120, - -# mf.generic_plotter( number_of_samples = 481, file_name='parameter_set_21_80_80_ECM_with_chemotaxsis', options=options_for_figure4) - -# mf.generic_plotter(starting_index=90, number_of_samples=1, options=options_for_figure2a) -# m2.generic_plotter(starting_index=500, number_of_samples=1, options=options_for_figure2a) -# m3.generic_plotter(starting_index=1200, number_of_samples=1, options=options_for_figure2a) - -# mf.generic_plotter (number_of_samples=10, options=options_for_figure2a) -# mf.create_separate_colorbar(contour_options=options_for_figure2a['contour_options']) - # generic_plotter (start, intervnal, finish, save_filename, data_path, save_path, options) # # All based on options/logic- function diff --git a/python_imaging/partial_history_multilevel_contour_movie.py b/python_imaging/partial_history_multilevel_contour_movie.py index 01a5609..b942d3c 100644 --- a/python_imaging/partial_history_multilevel_contour_movie.py +++ b/python_imaging/partial_history_multilevel_contour_movie.py @@ -1,6 +1,6 @@ import sys import matplotlib.pyplot as plt -sys.path.append(r'/Users/JohnMetzcar/Documents/GitHub/AMIGOS-invasion/python_imaging') +sys.path.append(r'../python_imaging') from image_processing_for_physicell import * @@ -31,34 +31,11 @@ 'INCLUDE_FULL_HISTORY': False } -#### Right now, if you don't have None or the full contour and quiver options, it will break in the plotting ... I wonder if there -#### is a better/more robust way to do it (kwargs???, lots of "trapping"??) but this will be handled later ... +#### Right now, if you don't have None or the full contour and quiver options, it will break in the plotting . mf = PhysiCellPlotter() -# m2 = PhysiCellPlotter() -# m3 = PhysiCellPlotter() -# image_list_for_figure2a = [] - -# image_list_for_figure2a = [90, 500, 1200] - -# file_name = 'march_' + str(90) - -# for number in image_list_for_figure2a: -# mf.generic_plotter(starting_index=number, number_of_samples=1, options=options_for_figure2a, file_name='march_' + str(number)) mf.produce_movie(save_name='1parameter_set_21_20_20_ECM_with_chemotaxsis_revised_05_leaders_increased_realignment_2', trail_length=15, movie_options=movie_options_for_figure_4, image_options=options_for_figure4_movie) -# starting_index: int = 0, sample_step_interval: int = 1, number_of_samples: int = 120, - -# mf.produce_movie(save_name='parameter_set_21_20_20_ECM_with_chemotaxsis_revised_2_05_leaders', trail_length=15, movie_options=movie_options_for_figure_4, \ - # image_options=options_for_figure4_movie, start_file_index = 0, sample_step_interval = 1, end_file_index =1200) -# mf.produce_movie(save_name='1parameter_set_21_20_20_ECM_with_chemotaxsis_revised_05_leaders_increased_realignment_2', trail_length=1, movie_options=movie_options_for_figure_4, image_options=options_for_figure4_movie) - -# mf.generic_plotter(starting_index=90, number_of_samples=1, options=options_for_figure2a) -# m2.generic_plotter(starting_index=500, number_of_samples=1, options=options_for_figure2a) -# m3.generic_plotter(starting_index=1200, number_of_samples=1, options=options_for_figure2a) - -# mf.generic_plotter (number_of_samples=10, options=options_for_figure2a) -# mf.create_separate_colorbar(contour_options=options_for_figure2a['contour_options']) # generic_plotter (start, intervnal, finish, save_filename, data_path, save_path, options) # diff --git a/python_imaging/partial_history_multilevel_contour_still.py b/python_imaging/partial_history_multilevel_contour_still.py index e4baab7..992608a 100644 --- a/python_imaging/partial_history_multilevel_contour_still.py +++ b/python_imaging/partial_history_multilevel_contour_still.py @@ -1,6 +1,6 @@ import sys import matplotlib.pyplot as plt -sys.path.append(r'/Users/JohnMetzcar/Documents/GitHub/AMIGOS-invasion/python_imaging') +sys.path.append(r'../python_imaging') from image_processing_for_physicell import * @@ -24,21 +24,12 @@ }, } -#### Right now, if you don't have None or the full contour and quiver options, it will break in the plotting ... I wonder if there -#### is a better/more robust way to do it (kwargs???, lots of "trapping"??) but this will be handled later ... and I can ask Randy etc -### What is up with scaling - hum ... - -# oof - I got different results on the two runs when I did and didn't scale by anistoropy ... yikes! How do I manage that!! +#### Right now, if you don't have None or the full contour and quiver options, it will break in the plotting ... mf = PhysiCellPlotter() -# m2 = PhysiCellPlotter() -# m3 = PhysiCellPlotter() - -# image_list_for_figure2a = [] image_list_for_figure5c = [480, 1920] -# file_name = 'march_' + str(90) number_of_samples = 12 for number in image_list_for_figure5c: starting_index = number-number_of_samples + 1 @@ -46,17 +37,6 @@ mf.create_separate_colorbar(contour_options = options_for_figure5c["contour_options"]) -# starting_index: int = 0, sample_step_interval: int = 1, number_of_samples: int = 120, - -# mf.generic_plotter(number_of_samples = 481, file_name='parameter_set_21_20_20_ECM_with_chemotaxsis', options=options_for_figure4) - -# mf.generic_plotter(starting_index=90, number_of_samples=1, options=options_for_figure2a) -# m2.generic_plotter(starting_index=500, number_of_samples=1, options=options_for_figure2a) -# m3.generic_plotter(starting_index=1200, number_of_samples=1, options=options_for_figure2a) - -# mf.generic_plotter (number_of_samples=10, options=options_for_figure2a) -# mf.create_separate_colorbar(contour_options=options_for_figure2a['contour_options']) - # generic_plotter (start, intervnal, finish, save_filename, data_path, save_path, options) # # All based on options/logic- function