example1 Program

Uses

  • program~~example1~~UsesGraph program~example1 example1 forcolormap_utils forcolormap_utils program~example1->forcolormap_utils forimage forimage program~example1->forimage module~forcolormap forcolormap program~example1->module~forcolormap module~colormap_parameters colormap_parameters module~forcolormap->module~colormap_parameters module~matplotlib_colormaps matplotlib_colormaps module~forcolormap->module~matplotlib_colormaps module~miscellaneous_colormaps miscellaneous_colormaps module~forcolormap->module~miscellaneous_colormaps module~scientific_colour_maps scientific_colour_maps module~forcolormap->module~scientific_colour_maps iso_fortran_env iso_fortran_env module~colormap_parameters->iso_fortran_env module~matplotlib_colormaps->module~colormap_parameters module~miscellaneous_colormaps->module~colormap_parameters module~scientific_colour_maps->module~colormap_parameters

This example demonstrates how ForImage can be used to import/export PPM files.


Calls

program~~example1~~CallsGraph program~example1 example1 export_pnm export_pnm program~example1->export_pnm finalize finalize program~example1->finalize import_pnm import_pnm program~example1->import_pnm proc~load Colormap%load program~example1->proc~load proc~write_ppm_colorbar Colormap%write_ppm_colorbar program~example1->proc~write_ppm_colorbar test_colormap test_colormap program~example1->test_colormap proc~check Colormap%check proc~load->proc~check proc~reverse Colormap%reverse proc~load->proc~reverse proc~write_ppm_colorbar->export_pnm get_format get_format proc~write_ppm_colorbar->get_format proc~compute_rgb Colormap%compute_RGB proc~write_ppm_colorbar->proc~compute_rgb proc~get_zmax Colormap%get_zmax proc~write_ppm_colorbar->proc~get_zmax proc~get_zmin Colormap%get_zmin proc~write_ppm_colorbar->proc~get_zmin set_format set_format proc~write_ppm_colorbar->set_format set_pnm set_pnm proc~write_ppm_colorbar->set_pnm proc~get_levels~2 Colormaps_info%get_levels proc~check->proc~get_levels~2 proc~get_name~2 Colormaps_info%get_name proc~check->proc~get_name~2 proc~get_ncolormaps Colormaps_info%get_ncolormaps proc~check->proc~get_ncolormaps proc~set_all Colormaps_info%set_all proc~check->proc~set_all proc~get_rgb Colormap%get_RGB proc~compute_rgb->proc~get_rgb proc~set_info table%set_info proc~set_all->proc~set_info

Variables

Type Attributes Name Initial
type(Colormap) :: custom_cmap
type(format_pnm) :: ex1_colorbar
type(format_pnm) :: ex1_colormap

Source Code

program example1
    use forcolormap
    use forcolormap_utils, only: test_colormap
    use forimage
    implicit none

    type(Colormap) :: custom_cmap
    type(format_pnm) :: ex1_colormap, ex1_colorbar

    ! Create ppm files
    call custom_cmap%load('test_map_to_load.txt', 0.0_wp, 2.0_wp)
    call custom_cmap%colorbar('a_loaded_colormap_ascii_test', encoding='ascii')
    call test_colormap(custom_cmap, 'a_loaded_colormap_ascii_colorbar', encoding='ascii')
    call custom_cmap%print()

    ! Import ascii ppm files
    call ex1_colormap%import_pnm('a_loaded_colormap_ascii_test','ppm', 'ascii')
    call ex1_colorbar%import_pnm('a_loaded_colormap_ascii_colorbar','ppm', 'ascii')

    ! Change colormap and colorbar colors
    ex1_colormap%pixels = int(ex1_colormap%pixels * 1.6)
    ex1_colorbar%pixels = int(ex1_colorbar%pixels * 1.6)

    ! Export binary ppm files
    call ex1_colormap%export_pnm('a_loaded_colormap_binary_test_m', 'binary')
    call ex1_colorbar%export_pnm('a_loaded_colormap_binary_colorbar_m', 'binary')

    ! Deallocate
    call ex1_colormap%finalize()
    call ex1_colorbar%finalize()

end program example1