deproj.m 2.19 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
classdef deproj
    %DEPROJ Manage a collection of epicells.
    
    properties
        epicells
        units
    end
    
    methods
        function obj = deproj( epicells, units )
            obj.epicells = epicells;
            obj.units = units;
        end
    end
    
    %% Plotting routines.
    methods
        
        %% Generate figures.
        
        % Figure with the local plan orientation for a collection of epicells.
        [ hf, ax1, ax2, ax3 ] = plot_fit_plane( obj, scale_bar_length )
        
        % Plot the 2D ellipses on the tissue surface.
        [ hf, hc, he ] = plot_fit_ellipse( obj, scale_bar_length )
        
        %% Helpers.
        % They are public in case of.
        
        % Add the tissue plot colored with the 1st euler angle.
        hts = add_plot_euler_alpha( obj, ax )
        
        % Add the tissue plot colored with the 2nd euler angle.
        hts = add_plot_euler_beta( obj, ax )
        
        % Add the tissue plot colored with the 3rd euler angle.
        hts = add_plot_euler_gamma( obj, ax )
        
        % Add the epicell ids to the specified plot axes.
        hts = add_plot_id( obj,  ax )
        
        % Add a scale-bar to the plot.
        [ hsb, ht ] = add_plot_scalebar( obj, length, ax )
        
        % Plots the boundaries as patches, colored by the specified values.
        hts = add_plot_variable( obj, values, ax )
    end
    
     %% Public static methods: builders.
    methods ( Access = public, Hidden = false, Static = true )
        
        % Returns the Z position of points taken from a height-map.
        obj = from_heightmap( I, ...
            H, ...
            pixel_size, ...
            voxel_depth, ...
            units, ...
            invert_z, ...
            inpaint_zeros, ...
            prune_zeros );
    end
    
    %% Private static methods: utilities.
    methods ( Access = private, Hidden = true, Static = true )
        
        % Returns the Z position of points taken from a height-map.
        z_coords = get_z( P, H, pixel_size, voxel_depth )
        
        % Returns the cells from a BW image with ridges.
        [ objects, junction_graph ] = mask_to_objects( I, downsample )
        
    end
end