[断面画像を重ね合わせて、物体を3次元表示]の , [バックヤード処理・サブグループ]

[断面画像を重ね合わせて、物体を3次元表示], Python(パイソン) 使って作ってみた ,ソースプログラムリスト あり へ

-----
2024.8.23 presented in [note] ( //note.com/runningWater/ )
2024.9.14 プログラム改変に伴う、書き直しを行った

----------
1 はじめに

これ以降に記述されている内容は、このようなコンピューター・プログラムを制作した、というような事を、ただ、述べているに過ぎない。

以下の記述を読んだ人が、それを単に参考にする、というのであれば、問題は無いと、思われる。

しかし、記述されている内容に沿って、その人が、そこに記されているのと同様の制作や作業を行った際に、その制作、作業、コンピューターの作動の結果、使用されたコンピューター等、様々な方面において、何らかの問題が発生しない、という保証は、全くない。

その制作、作業、コンピューターの作動の結果、その人や、その人が所属している組織、その人が使用した様々な機器、インフラストラクチャー等の、身の上にどのような事が起ころうとも、私は一切、責任を負わない。

このプログラムは、Python(パイソン) 言語を使って、記述されている。

----------
2 バックヤード処理・サブグループ

これは、動作の様が、画面上に現れないような処理を担当する、という機能を果たす、サブルグループである。

これを構成しているモジュールは、以下の通りである。

 BackYardProcess
 HiddenLineRemoval
 MakeImageData
 ViewSpace
 WorldSpace
 WriteImageToOuterMedia

----------
3 BackYardProcess モジュール

ファイル名  [BackYardProcess.py]

----------


import  MakeImageData
import  WriteImageToOuterMedia

MODULE_NAME = "BackYardProcess"

global_ins_ImageDataTwoDimensionHandling = " "

    #------------------------------------------------------------
def  initializing_process (  ) :

    methode_name = " initializing_process"

    print ( "==================================" )
    print ( "Enter into Module = " + MODULE_NAME
                      + " , function = " + methode_name )
    print ( "==================================" )

    MakeImageData   \
           .initializing_process (  )

  #----------------------------------------
def set_rotation_angle ( arg_ins_DataToBeHandedOver ) :

    function_name = "set_rotation_angle"

    print ( "==================================" )
    print ( "Enter into Module = " + MODULE_NAME
                      + " , function = " + function_name )
    print ( "==================================" )

    rotation_angle_degree_XAxis_to_YAxis = \
        arg_ins_DataToBeHandedOver  \
            .get_value ( 1 )
    rotation_angle_degree_XAxis_to_ZAxis = \
        arg_ins_DataToBeHandedOver  \
            .get_value ( 2 )

    print ( "==================================" )
    print ( "Module = " + MODULE_NAME
                      + " , function = " + function_name )
    print (  "rotation_angle_degree_XAxis_to_YAxis = " \
                  + rotation_angle_degree_XAxis_to_YAxis )
    print (  "rotation_angle_degree_XAxis_to_ZAxis = " \
                  + rotation_angle_degree_XAxis_to_ZAxis )
    print ( "==================================" )

     # ---------------------------
    global global_ins_ImageDataTwoDimensionHandling
    global_ins_ImageDataTwoDimensionHandling = \
        MakeImageData   \
            .set_rotation_angle_degree ( \
                       rotation_angle_degree_XAxis_to_YAxis
                     , rotation_angle_degree_XAxis_to_ZAxis
                                )

    print ( "==================================" )
    print ( "Exit from Module = " + MODULE_NAME
                      + " , function = " + function_name )
    print ( "Done , set_rotation_angle_degree" )
    print ( "rotation_angle_degree_XAxis_to_YAxis = " + \
              str ( rotation_angle_degree_XAxis_to_YAxis ) )
    print ( "rotation_angle_degree_XAxis_to_ZAxis = " + \
              str ( rotation_angle_degree_XAxis_to_ZAxis ) )
    print ( "==================================" )

    return global_ins_ImageDataTwoDimensionHandling

  #----------------------------------------
def make_image_data ( arg_ins_DataToBeHandedOver ) :

    function_name = "make_image_data"

    print ( "==================================" )
    print ( "Enter into Module = " + MODULE_NAME
                      + " , function = " + function_name )
    print ( "==================================" )

    global global_ins_ImageDataTwoDimensionHandling
    global_ins_ImageDataTwoDimensionHandling  \
            = MakeImageData  \
                 .make_image_data ( arg_ins_DataToBeHandedOver )

    width_of_ImageData  \
        = global_ins_ImageDataTwoDimensionHandling  \
                 .get_width_of_ImageData ()
    height_of_ImageData  \
        = global_ins_ImageDataTwoDimensionHandling  \
                 .get_height_of_ImageData ()

    print ( "==================================" )
    print ( "Exit from Module = " + MODULE_NAME
                      + " , function = " + function_name )
    print ( "width_of_ImageData = " + str ( width_of_ImageData ) )
    print ( "height_of_ImageData = " + str ( height_of_ImageData ) )
    print ( "==================================" )

    return global_ins_ImageDataTwoDimensionHandling

  #----------------------------------------
def  write_image_to_OuterMedia ( ) :

    function_name = "write_image_to_OuterMedia"

    print ( "==================================" )
    print ( "Enter into Module = " + MODULE_NAME
                      + " , function = " + function_name )
    print ( "==================================" )

    global global_ins_ImageDataTwoDimensionHandling

    WriteImageToOuterMedia   \
          .write_image_to_OuterMedia (
               global_ins_ImageDataTwoDimensionHandling
                           )

    print ( "==================================" )
    print ( "Exit from Module = " + MODULE_NAME
                      + " , function = " + function_name )
    print ( "==================================" )

    return

----------
4 HiddenLineRemoval モジュール

ファイル名 [HiddenLineRemoval.py]

----------


import numpy as NUMPY

#**********************
import  ErrorProcess
#**********************

#========================================
class HiddenLineRemoval :

    CV_CLASS_NAME = "HiddenLineRemoval"

    #--View ----------------------------------------------------------
    # dordinate system in View Space
    #   X + ---> to right side
    #   Y + ---> to upper side
    # origin located at left under corner of window

    #--------------------------------
        # definition of constructer
    def __init__( self
                , arg_requester_module
                , arg_requester_function

                , arg_x_value_of_perspective_drawing_vanishing_point
                , arg_width_of_Field_of_View
                , arg_height_of_Field_of_View
                                ) :


        methode_name = "constructer"

        print ( "==================================" )
        print ( "Enter into , Class = " + HiddenLineRemoval.CV_CLASS_NAME
                      + " , methode = " + methode_name )
        print ( "    arg_requester_module = " + arg_requester_module
                   + " , arg_requester_function = " + arg_requester_function )
        print ( "    arg_x_value_of_perspective_drawing_vanishing_point = "  \
                  + str ( arg_x_value_of_perspective_drawing_vanishing_point ) )
        print ( "    arg_width_of_Field_of_View = " +  str ( arg_width_of_Field_of_View ) )
        print ( "    arg_height_of_Field_of_View = " +  str ( arg_height_of_Field_of_View ) )
        print ( "==================================" )

        self.iv_x_value_of_perspective_drawing_vanishing_point \
                    = arg_x_value_of_perspective_drawing_vanishing_point
        self.iv_width_of_Field_of_View = arg_width_of_Field_of_View
        self.iv_height_of_Field_of_View = arg_height_of_Field_of_View

        self.iv_row_size_of_Matrix = self.iv_height_of_Field_of_View
        self.iv_column_size_of_Matrix = self.iv_width_of_Field_of_View

           # set matrix of x_value, initializing value [drawing_vanishing_point]
        self.iv_matrix_using_NUMPY_containing_x_value_of_each_location  \
             = NUMPY.full (  \
                     (  self.iv_row_size_of_Matrix
                      , self.iv_column_size_of_Matrix
                     )
                  , float ( self.iv_x_value_of_perspective_drawing_vanishing_point )
                          )

        self.iv_list_of_ErrorMessage = [
                       "******** Error !!! **********"
                     , " "
                     , " "
                     , " "
                     , " "
                     , " "
                       ]

        print ( "==================================" )
        print ( "Exit from , Class = " + HiddenLineRemoval.CV_CLASS_NAME
                      + " , methode = " + methode_name )
        print ( "    arg_requester_module = " + arg_requester_module
                   + " , arg_requester_function = " + arg_requester_function )
        print ( "==================================" )

    #------------------------------------------------------------
    def  detect_and_set_x_value_of_directed_location ( \
                       self
                    ,  arg_requester_module
                    ,  arg_requester_function

                    ,  arg_X_in_ViewSpace
                    ,  arg_Y_in_ViewSpace
                    ,  arg_x_in_WorldSpace
                                ) :

        methode_name = "detect_and_set_x_value_of_directed_location"

        # print ( "==================================" )
        # print ( "Enter into , Class = " + HiddenLineRemoval.CV_CLASS_NAME
        #               + " , methode = " + methode_name )
        # print ( "    arg_requester_module = " + arg_requester_module
         #           + " , arg_requester_function = " + arg_requester_function )
        # print ( "    arg_X_in ViewSpace = "  \
        #          + str ( arg_X_in ViewSpace )
        # print ( "    arg_Y_in ViewSpace = " +  str ( arg_Y_in ViewSpace ) )
        # print ( "    arg_x_in_WorldSpace = " +  str ( arg_x_in_WorldSpace ) )
        # print ( "==================================" )

        row_in_Matrix = int ( self.iv_height_of_Field_of_View  \
                                - arg_Y_in_ViewSpace - 1 )
        column_in_Matrix = int ( arg_X_in_ViewSpace )

        if ( ( row_in_Matrix < 0 ) \
             or                    \
             ( row_in_Matrix >= self.iv_row_size_of_Matrix )  \
             or                       \
             ( column_in_Matrix < 0 ) \
             or                       \
             ( column_in_Matrix >= self.iv_column_size_of_Matrix )  \
           ) :
            print( "==================================" )
            print( "Class = "
                   + HiddenLineRemoval.CV_CLASS_NAME
                      + " , methode = " + methode_name )
            print ( "arg_requester_module = " , arg_requester_module )
            print ( "arg_requester_function = " , arg_requester_function )
            print ( "Error !!!  Over Area")

            print ( "arg_X_in_ViewSpace = " , arg_X_in_ViewSpace )
            print ( "arg_Y_in_ViewSpace = " , arg_Y_in_ViewSpace )
            print ( "arg_x_in_WorldSpace = " , arg_x_in_WorldSpace )

            print ( "row_in_Matrix = " , row_in_Matrix )
            print ( "column_in_Matrix = " , column_in_Matrix )
            print ( "self.iv_row_size_of_Matrix = " \
                         , self.iv_row_size_of_Matrix )
            print ( "self.iv_column_size_of_Matrix = " \
                         , self.iv_column_size_of_Matrix )
            print( "==================================" )

            self.iv_list_of_ErrorMessage [ 0 ] = \
              "**** Error !!!  Area Over ****"
            ErrorProcess.do_error_process (
                         #arg_requester_module
                   HiddenLineRemoval.CV_CLASS_NAME
                         #arg_requester_function
                 , methode_name
                         #arg_terminate_process_Y_or_N
                 , "Y"
                         #arg_self.iv_list_of_ErrorMessage
                 , self.iv_list_of_ErrorMessage
                     )
             # -------------------------------
        value_x_in_Matrix =                                                                           \
            self.iv_matrix_using_NUMPY_containing_x_value_of_each_location   \
                  [ row_in_Matrix  ] [  column_in_Matrix  ]

             # print ( "==================================" )
             # print ( "Class = " + HiddenLineRemoval.CV_CLASS_NAME
             #               + " , methode = " + methode_name )
             # print ( "    arg_X_in ViewSpace = "  + str ( arg_X_in ViewSpace )
             # print ( "    arg_Y_in ViewSpace = " +  str ( arg_Y_in ViewSpace ) )
             # print ( "    column_in_Matrix = "  + str ( column_in_Matrix )
             # print ( "    row_in_Matrix = " +  str ( row_in_Matrix ) )
              # print ( "    arg_x_in_WorldSpace = " +  str ( arg_x_in_WorldSpace ) )
              # print ( "    value_x_in_Matrix = "   + str ( value_x_in_Matrix )
              # print ( "==================================" )

        if ( arg_x_in_WorldSpace >  value_x_in_Matrix ) :
              #this location is not in HiddenLine,
              #  so , it must not be removed, it must be drawed
              self.iv_matrix_using_NUMPY_containing_x_value_of_each_location   \
                  [ row_in_Matrix  ] [  column_in_Matrix ]   \
                     =  arg_x_in_WorldSpace
                         # it must be drawed
             # print ( "==================================" )
             # print ( "Class = " + HiddenLineRemoval.CV_CLASS_NAME
             #               + " , methode = " + methode_name )
             # print ( "    return "Y"  )
              # print ( "==================================" )

              return "Y"

              #this location is HiddenLine,
              #  so , it must be removed, it must not be drawed
                           # print ( "==================================" )
             # print ( "Class = " + HiddenLineRemoval.CV_CLASS_NAME
             #               + " , methode = " + methode_name )
             # print ( "    return "N"  )
              # print ( "==================================" )
        return "N"


----------
5 MakeImageData モジュール

ファイル名 [MakeImageData.py]

----------


import ImageDataTwoDimensionHandling
import  WorldSpace
import  ViewSpace

#*****************************************
import ParametersContainer
#*****************************************

MODULE_NAME = "MakeImageData"

global_ins_WorldSpace = " "
global_ins_ViewSpace = " "

     # -----------------------------------------
def   initializing_process (  ) :

    function_name = "initializing_process"

    global  global_ins_WorldSpace
    global_ins_WorldSpace = \
          WorldSpace.WorldSpace ( MODULE_NAME ,  function_name )

    global  global_ins_ViewSpace
    global_ins_ViewSpace = \
          ViewSpace.ViewSpace ( MODULE_NAME ,  function_name )

     # -----------------------------------------
def  set_rotation_angle_degree ( \
                   arg_rotation_angle_degree_XAxis_to_YAxis
                 , arg_rotation_angle_degree_XAxis_to_ZAxis
                                ) :

    function_name = "set_rotation_angle_degree"

    print ( "==================================" )
    print ( "Enter into , Module = " + MODULE_NAME
                      + " , function = " + function_name )
    print (  "arg_rotation_angle_degree_XAxis_to_YAxis = " \
                  , arg_rotation_angle_degree_XAxis_to_YAxis )
    print (  "arg_rotation_angle_degree_XAxis_to_ZAxis = " \
                  ,  arg_rotation_angle_degree_XAxis_to_ZAxis )
    print ( "==================================" )

    global  global_ins_ViewSpace
    global_ins_ViewSpace    \
            .set_rotation_angle_degree ( \
                       arg_rotation_angle_degree_XAxis_to_YAxis
                     , arg_rotation_angle_degree_XAxis_to_ZAxis )

    print ( "==================================" )
    print ( "Exit from , Module = " + MODULE_NAME
                      + " , function = " + function_name )
    print (  "arg_rotation_angle_degree_XAxis_to_YAxis = " \
                  , arg_rotation_angle_degree_XAxis_to_YAxis )
    print (  "arg_rotation_angle_degree_XAxis_to_ZAxis = " \
                  ,  arg_rotation_angle_degree_XAxis_to_ZAxis )
    print ( "==================================" )

    return_instance = \
        global_ins_ViewSpace  \
            .get_ImageDataTwoDimensionHandling_for_presnting_View_Space ( )

    return return_instance

        # -------------------------------------
def make_image_data ( arg_ins_DataToBeHandedOver ) :

    function_name = "make_image_data"

    print ( "==================================" )
    print ( "Enter into Module = " + MODULE_NAME
                      + " , function = " + function_name )
    print ( "==================================" )

    global_ins_WorldSpace   \
            .initializing_process ( )
    global_ins_ViewSpace    \
            .initializing_process ( )

    response_list_from_WorldSpace = " "

    process_continue = "Y"
    while ( process_continue == "Y" ) :
              # --------------------------------------
        response_list_from_WorldSpace = \
              global_ins_WorldSpace  \
                     .make_one_point_on_WorldSpace ( )
              # --------------------------------------
        if (  response_list_from_WorldSpace [ 1 - 1 ] == "N" ) :
                   # process reached to end,
                   #    so there is no need to continue process
                process_continue = "N"
                break
               # ----------------------------------------------

        list_x_y_z_in_WorldSpace = [  \
                 response_list_from_WorldSpace [ 2 - 1 ]   # x in WoldSpace  \
              ,  response_list_from_WorldSpace [ 3 - 1 ]   # y in WoldSpace  \
              ,  response_list_from_WorldSpace [ 4 - 1 ]   # z in WoldSpace  \
                                    ]
        list_color_value_for_drawing = [  \
                  response_list_from_WorldSpace [ 5 - 1 ]   # Blue
               ,  response_list_from_WorldSpace [ 6 - 1 ]   # Green
               ,  response_list_from_WorldSpace [ 7 - 1 ]   # Red
                                       ]
        global_ins_ViewSpace  \
             .draw_one_point_in_ViewSpace ( \
                       list_x_y_z_in_WorldSpace
                    ,  list_color_value_for_drawing
                                         )

#***************************************************************
                 # draw axis line
    list_start_point_x_y_z = [ 0 , 0 , 0 ]
    list_end_point_x_y_z = [   [ 100 , 0 , 0 ]  \
                            ,  [ 0 , 100 , 0 ]  \
                            ,  [ 0 , 0 , 100 ]  ]

    for axis_number in range ( 1 , 4 ) :
        display_axis   \
              = ( ParametersContainer  \
                     .global_par_display_axis ) [ axis_number - 1 ]
        if ( display_axis != "_" ) :
            global_ins_ViewSpace  \
                 .draw_axis_line ( \
                       display_axis
                    ,  list_start_point_x_y_z
                    ,  list_end_point_x_y_z [ axis_number - 1 ]
                              )

    # global_ins_ViewSpace  \
    #         .draw_axis_line ( \
    #                "X"    # arg_axis_x_y_z
    #                            )
    # global_ins_ViewSpace  \
    #         .draw_axis_line ( \
    #                "Y"    # arg_axis_x_y_z
    #                            )
    # global_ins_ViewSpace  \
    #          .draw_axis_line ( \
    #                "Z"    # arg_axis_x_y_z
    #                            )
#***************************************************************

    print ( "==================================" )
    print ( "Exit from Module = " + MODULE_NAME
                      + " , function = " + function_name )
    print ( "==================================" )

    return_instance = \
        global_ins_ViewSpace  \
            .get_ImageDataTwoDimensionHandling_for_presnting_View_Space ( )

    return return_instance

----------
6 ViewSpace モジュール

ファイル名 [ViewSpace.py]

----------


import numpy as NUMPY
import ImageDataTwoDimensionHandling
import ParametersContainer

#*********************************************
import MatrixFor3DRotaionV2
         # import MatrixFor3DRotaion
#*********************************************
import HiddenLineRemoval

#========================================
class ViewSpace :

    CV_CLASS_NAME = "ViewSpace"

    #------------------------------------------------------------
    # cordinate system in World Space
    #   x + ---> to forward side
    #   y + ---> to right side
    #   Z + ---> to upper side

    #--View ----------------------------------------------------------
    # dordinate system in View Space
    #   X + ---> to right side
    #   Y + ---> to upper side
    # origin located at left under corner of window

    #--------------------------------
        # definition of constructer
    def __init__( self
                , arg_requester_module
                , arg_requester_function
                                ) :

        methode_name = "constructer"

        print ( "==================================" )
        print ( "Enter into , Class = " + ViewSpace.CV_CLASS_NAME
                      + " , methode = " + methode_name )
        print ( "    arg_requester_module = " + arg_requester_module
                   + " , arg_requester_function = " + arg_requester_function )
        print ( "==================================" )

#************************************************
        self.iv_ins_MatrixFor3DRotaionV2 = " "
             # self.iv_ins_MatrixFor3DRotaion = " "
#************************************************

        self.iv_rotation_angle_degree_XAxis_to_YAxis = 0
        self.iv_rotation_angle_degree_XAxis_to_ZAxis = 0

        self.iv_ins_HiddenLineRemoval = " "
                 #----------------------------------

        self.iv_ins_ImageDataTwoDimensionHandling_for_presnting_View_Space = \
               ImageDataTwoDimensionHandling  \
                   .ImageDataTwoDimensionHandling ( \
                               ViewSpace.CV_CLASS_NAME
                             , methode_name )
                    #---------------------
        self.iv_abs_path_of_ImageDataFile     \
            = ParametersContainer.global_par_abs_path_of_base_directory    \
              + ParametersContainer.global_par_path_of_input_directory    \
              + ParametersContainer.global_par_path_of_BaseImageDataForDisplay_directory  \
              + ParametersContainer.global_par_file_name_part_1_of_BaseImageDataForDisplay  \
              + ParametersContainer.global_par_file_name_ending_part_of_BaseImageDataForDisplay
        self.iv_ins_ImageDataTwoDimensionHandling_for_presnting_View_Space \
               .load_image_data (
                         ViewSpace.CV_CLASS_NAME
                       , methode_name
                       , self.iv_abs_path_of_ImageDataFile
                            )
               #---------------------
        self.iv_width_of_ViewSpace = \
             self.iv_ins_ImageDataTwoDimensionHandling_for_presnting_View_Space \
                .get_width_of_ImageData ( )
        self.iv_height_of_ViewSpace = \
             self.iv_ins_ImageDataTwoDimensionHandling_for_presnting_View_Space \
                .get_height_of_ImageData ( )
               #---------------------
        self.iv_half_width_of_ViewSpace = ( int ) ( self.iv_width_of_ViewSpace / 2.0 )
        self.iv_half_height_of_ViewSpace = ( int ) ( self.iv_height_of_ViewSpace / 2.0 )

        self.iv_x_value_of_perspective_drawing_vanishing_point  \
            = float ( ParametersContainer  \
                   .global_par_x_value_of_perspective_drawing_vanishing_point )

        #------------------------------------------------

        print ( "==================================" )
        print ( "Exit from , Class = " + ViewSpace.CV_CLASS_NAME
                      + " , methode = " + methode_name )
        print ( "    arg_requester_module = " + arg_requester_module
                   + " , arg_requester_function = " + arg_requester_function )
        print ( "==================================" )

        return

        #------------------------------------------------------------
    def  get_ImageDataTwoDimensionHandling_for_presnting_View_Space ( \
                      self ) :

        return self.iv_ins_ImageDataTwoDimensionHandling_for_presnting_View_Space

        #------------------------------------------------------------
    def  set_rotation_angle_degree ( \
                       self
                     , arg_rotation_angle_degree_XAxis_to_YAxis
                     , arg_rotation_angle_degree_XAxis_to_ZAxis
                                ) :

        methode_name = "set_rotation_angle_degree_XAxis_to_YAxis"

        self.iv_rotation_angle_degree_XAxis_to_YAxis = \
                float ( arg_rotation_angle_degree_XAxis_to_YAxis )
        self.iv_rotation_angle_degree_XAxis_to_ZAxis = \
                float ( arg_rotation_angle_degree_XAxis_to_ZAxis )

#************************ make rotation instance ***************
        self.iv_ins_MatrixFor3DRotaionV2 = \
            MatrixFor3DRotaionV2          \
               .MatrixFor3DRotaionV2 (
                            # self.iv_ins_MatrixFor3DRotaion = \
                            #      MatrixFor3DRotaion          \
                            #         .MatrixFor3DRotaion (
#*********************************************************
                   ViewSpace.CV_CLASS_NAME  # arg_requester_module
                 , methode_name     # arg_requester_function
                          # first rotation
                 , "Z"       # arg_first_rotation_around_axis
                 , self.iv_rotation_angle_degree_XAxis_to_YAxis

                          # second rotation
                 , "Y"       # arg_need_Y_N_second_rotation

                 , "Y"        # arg_second_rotation_around_axis
                 , self.iv_rotation_angle_degree_XAxis_to_ZAxis
                               )

        self.clear_ViewSpace (  )
        self.iv_ins_ImageDataTwoDimensionHandling_for_presnting_View_Space \
            .insert_text_into_ImageData (
                     ViewSpace.CV_CLASS_NAME  # arg_requester_module
                   , methode_name  # arg_requester_function
                              # in the commonly used mathematical XY cordinates
                   , 50   # arg_x_on_ImageData_space
                   , 50   # arg_y_on_ImageData_space

                   , "angles have been set"   # arg_text_inserted

                   , 60 # arg_font_color_Blue
                   , 60 # arg_font_color_Green
                   , 180 # arg_font_color_Red
                   )

        return \
         self.iv_ins_ImageDataTwoDimensionHandling_for_presnting_View_Space

    #------------------------------------------------------------
    def  initializing_process ( \
                       self
                                ) :

        methode_name = "initializing_process"

            # reload image_data
        self.iv_ins_ImageDataTwoDimensionHandling_for_presnting_View_Space \
               .load_image_data (
                         ViewSpace.CV_CLASS_NAME
                       , methode_name
                       , self.iv_abs_path_of_ImageDataFile
                            )

            #--- prepare area for HiddenLineRemoval ---

        print ( "==================================" )
        print ( "Class = " + ViewSpace.CV_CLASS_NAME
                      + " , methode = " + methode_name )
        print ( "x_value_of_perspective = " + \
             str ( ParametersContainer  \
                     .global_par_x_value_of_perspective_drawing_vanishing_point \
                   ) )
        print ( "==================================" )

        self.iv_ins_HiddenLineRemoval = \
              HiddenLineRemoval  \
                .HiddenLineRemoval ( \
                    ViewSpace.CV_CLASS_NAME
                  , methode_name

                  , ParametersContainer  \
                     .global_par_x_value_of_perspective_drawing_vanishing_point
                  , self.iv_width_of_ViewSpace
                  , self.iv_height_of_ViewSpace
                                 )
        return

    #------------------------------------------------------------
    def  clear_ViewSpace ( self ) :

        methode_name = "clear_ViewSpace"

        self.iv_ins_ImageDataTwoDimensionHandling_for_presnting_View_Space \
               .load_image_data (
                         ViewSpace.CV_CLASS_NAME
                       , methode_name
                       , self.iv_abs_path_of_ImageDataFile
                            )

    #------------------------------------------------------------
    def  draw_one_point_in_ViewSpace ( \
                       self
                    ,  arg_list_x_y_z_in_WorldSpace
                    ,  arg_list_color_value_for_drawing
                                ) :

        methode_name = "draw_one_point_in_ViewSpace"

        # print ( "==================================" )
        # print ( "Enter into , Class = " + HiddenLineRemoval.CV_CLASS_NAME
        #               + " , methode = " + methode_name )
        # print ( "    arg_requester_module = " + arg_requester_module
         #           + " , arg_requester_function = " + arg_requester_function )
        # print ( "    arg_X_in ViewSpace = "  \
        #          + str ( arg_X_in ViewSpace )
        # print ( "    arg_Y_in ViewSpace = " +  str ( arg_Y_in ViewSpace ) )
        # print ( "    arg_x_in_WorldSpace = " +  str ( arg_x_in_WorldSpace ) )
        # print ( "==================================" )

        #-------------- not draw color? -------------------------
        if ( ( arg_list_color_value_for_drawing [ 0 ] \
                  < int ( ParametersContainer.global_par_drawing_color_sleshold ) )\
                 and                                                                                      \
              ( arg_list_color_value_for_drawing [ 1 ] \
                  < int ( ParametersContainer.global_par_drawing_color_sleshold ) )\
                 and                                                                                      \
              ( arg_list_color_value_for_drawing [ 2 ] \
                  < int ( ParametersContainer.global_par_drawing_color_sleshold ) )\
            ) :
                #not draw this point
            return "N"

         #------------------------------------
        drawing_location_in_ViewSpace = \
            self.calculate_drawing_location_in_ViewSpace (  \
                    arg_list_x_y_z_in_WorldSpace
                                               )

        it_must_be_drawed_Y_N_about_hidden_line = \
            self.iv_ins_HiddenLineRemoval    \
                .detect_and_set_x_value_of_directed_location ( \
                       ViewSpace.CV_CLASS_NAME
                    ,  methode_name
                    ,  drawing_location_in_ViewSpace [ 0 ]   # arg_X_in ViewSpace
                    ,  drawing_location_in_ViewSpace [ 1 ]   # arg_Y_in ViewSpace
                    ,  arg_list_x_y_z_in_WorldSpace [ 0 ]   #arg_x_in_WorldSpace
                                   )
        if ( it_must_be_drawed_Y_N_about_hidden_line == "Y" ) :
               # ------ draw one point --------------
            self.draw_one_point_at_directed_location_in_ViewSpace (  \
                    [ drawing_location_in_ViewSpace [ 0 ]   \
                    , drawing_location_in_ViewSpace [ 1 ]   \
                    ]
                 ,  arg_list_color_value_for_drawing
                                )
            return "Y"

        return "N"

    #------------------------------------------------------------
    def  draw_axis_line ( \
                       self
#**********************************************
                    ,  arg_display_axis
                    ,  arg_list_start_point_x_y_z
                    ,  arg_list_end_point_x_y_z
#**********************************************
                                ) :

        methode_name = "draw_axis_line"

        # print ( "==================================" )
        # print ( "Enter into , Class = " + HiddenLineRemoval.CV_CLASS_NAME
        #               + " , methode = " + methode_name )
        # print ( "    arg_requester_module = " + arg_requester_module
         #           + " , arg_requester_function = " + arg_requester_function )
        # print ( "    arg_X_in ViewSpace = "  \
        #          + str ( arg_X_in ViewSpace )
        # print ( "    arg_Y_in ViewSpace = " +  str ( arg_Y_in ViewSpace ) )
        # print ( "    arg_x_in_WorldSpace = " +  str ( arg_x_in_WorldSpace ) )
        # print ( "==================================" )

#*********************************************************
        # list_start_point_x_y_z = [ 0  ,  0  , 0 ]
        # list_end_point_x_y_z = [ 0  ,  0  , 0 ]
        #  if ( arg_axis_x_y_z == "X" ) :
        #     list_end_point_x_y_z [ 0 ] = 120
        #  if ( arg_axis_x_y_z == "Y" ) :
        #     list_end_point_x_y_z [ 1 ] = 120
        #  if ( arg_axis_x_y_z == "Z" ) :
        #     list_end_point_x_y_z [ 2 ] = 120

                    #------------------------------------
        drawing_location_start_point_in_ViewSpace = \
            self.calculate_drawing_location_in_ViewSpace (  \
                    arg_list_start_point_x_y_z
                                               )
        drawing_location_end_point_in_ViewSpace = \
            self.calculate_drawing_location_in_ViewSpace (  \
                    arg_list_end_point_x_y_z
                                               )

        self.iv_ins_ImageDataTwoDimensionHandling_for_presnting_View_Space \
             .insert_line_figure_into_ImageData (
                     ViewSpace.CV_CLASS_NAME  # arg_requester_module
                   , methode_name  # arg_requester_function
                              # in the commonly used mathematical XY cordinates
                   , drawing_location_start_point_in_ViewSpace [ 0 ] \
                          # arg_From_x_on_ImageData_space
                   , drawing_location_start_point_in_ViewSpace [ 1 ]  \
                          # arg_From_y_on_ImageData_space
                   , drawing_location_end_point_in_ViewSpace [ 0 ]  \
                                 # arg_To_x_on_ImageData_space
                   , drawing_location_end_point_in_ViewSpace [ 1 ]  \
                                 # arg_To_y_on_ImageData_space

                   , 3    # arg_thickness_of_line_figure

                   , 20  # arg_color_Blue
                   , 10  # arg_color_Green
                   , 220 # arg_color_Red
                                   )

        self.iv_ins_ImageDataTwoDimensionHandling_for_presnting_View_Space \
               .insert_text_into_ImageData (
                     ViewSpace.CV_CLASS_NAME  # arg_requester_module
                   , methode_name  # arg_requester_function
                              # in the commonly used mathematical XY cordinates
                   , drawing_location_end_point_in_ViewSpace [ 0 ]  \
                                 # arg_To_x_on_ImageData_space
                   , drawing_location_end_point_in_ViewSpace [ 1 ]  \

#*********************************************
                   , arg_display_axis
                         # , arg_axis_x_y_z
#*********************************************

                   , 20  # arg_color_Blue
                   , 10  # arg_color_Green
                   , 220 # arg_color_Red
                                   )

        return

    #------------------------------------------------------------
    def  calculate_drawing_location_in_ViewSpace (  \
                         self
                      ,  arg_list_x_y_z_in_WorldSpace
                                               ) :

                 # do rotation
#***********************************************
        list__x_y_z_after_rotation = \
           self.iv_ins_MatrixFor3DRotaionV2    \
               .calculate_cordinate_after_rotation (    \
                     arg_list_x_y_z_in_WorldSpace
                                            )
#***********************************************
               # x in WorldSpace
        w1 = list__x_y_z_after_rotation [ 0 ] \
                -  self.iv_x_value_of_perspective_drawing_vanishing_point
        w2 = 0 - self.iv_x_value_of_perspective_drawing_vanishing_point

        rate_of_magnification = w1 / w2

        w1_X = list__x_y_z_after_rotation [ 1 ]    # y cordinate value
        w1_Y = list__x_y_z_after_rotation [ 2 ]    # z cordinate value

        w2_X = w1_X * rate_of_magnification
        w2_Y = w1_Y * rate_of_magnification

        drawing_location_X_in_ViewSpace = \
             int ( self.iv_half_width_of_ViewSpace + w2_X )
        drawing_location_Y_in_ViewSpace = \
             int ( self.iv_half_height_of_ViewSpace + w2_Y )

        return_list = [ drawing_location_X_in_ViewSpace   \
                     ,  drawing_location_Y_in_ViewSpace ]

        return return_list

    #------------------------------------------------------------
    def  draw_one_point_at_directed_location_in_ViewSpace (  \
                               self
                            ,  arg_list_X_Y_in_ViewSpace
                            ,  arg_list_color_value_for_drawing
                                ) :

        methode_name = "draw_one_point_at_directed_location_in_ViewSpace"

        self.iv_ins_ImageDataTwoDimensionHandling_for_presnting_View_Space \
             .put_data_of_one_pixel ( \
                      ViewSpace.CV_CLASS_NAME  # arg_requester_module
                    , methode_name     # arg_requester_function

                           # in the commonly used mathematical XY cordinates
                    , arg_list_X_Y_in_ViewSpace [ 0 ] # arg_x_on_ImageData_space
                    , arg_list_X_Y_in_ViewSpace [ 1 ] # arg_Y_on_ImageData_space

                    , arg_list_color_value_for_drawing [ 0 ]  # arg_color_data_Blue
                    , arg_list_color_value_for_drawing [ 1 ]  # arg_color_data_Green
                    , arg_list_color_value_for_drawing [ 2 ]  # arg_color_data_Red
                         )




7 WorldSpace モジュール

ファイル名 [WorldSpace.py]

----------


import ParametersContainer
import ImageDataTwoDimensionHandling

#========================================
class WorldSpace :

    CV_CLASS_NAME = "WorldSpace"

    #------------------------------------------------------------
    # cordinate system in World Space
    #   x + ---> to forward side
    #   y + ---> to right side
    #   Z + ---> to upper side

    #--------------------------------
        # definition of constructer
    def __init__( self
                , arg_requester_module
                , arg_requester_function
                                ) :

        methode_name = "constructer"

        print ( "==================================" )
        print ( "Enter into , Class = " + WorldSpace.CV_CLASS_NAME
                      + " , methode = " + methode_name )
        print ( "    arg_requester_module = " + arg_requester_module
                   + " , arg_requester_function = " + arg_requester_function )
        print ( "==================================" )

        self.iv_abs_path_of_input_ImageDataFile = " "

        self.iv_ins_ImageDataTwoDimensionHandling = \
             ImageDataTwoDimensionHandling   \
                 .ImageDataTwoDimensionHandling (  \
                     WorldSpace.CV_CLASS_NAME    #  arg_requester_module
                   , methode_name    # arg_requester_function"
                                )
        self.iv_width_of_imageData = 0
        self.iv_height_of_imageData = 0
        self.iv_half_width_of_imageData = 0
        self.iv_half_height_of_imageData = 0

        self.iv_from_x = 0
        self.iv_to_x = 0
        self.iv_incliment_x = 0

        self.iv_from_y = 0
        self.iv_to_y = 0
        self.iv_incliment_y = 0

        self.iv_number_of_related_files_from = 0
        self.iv_number_of_related_files_to = 0
        self.iv_from_z = 0
        self.iv_to_z = 0
        self.iv_incliment_z = 0

        self.iv_current_x_of_onePoint_in_WorldSpace = 0
        self.iv_current_y_of_onePoint_in_WorldSpace = 0
        self.iv_current_z_of_onePoint_in_WorldSpace = 0

        self.iv_next_continue = " "
        self.iv_next_x = 0
        self.iv_next_y = 0
        self.iv_next_z = 0

        self.iv_x_of_onePoint_in_WorldSpace = 0
        self.iv_y_of_onePoint_in_WorldSpace = 0
        self.iv_z_of_onePoint_in_WorldSpace = 0

        self.conversion_rate_from_WorldSpace_to_ImageDataSpace = 0
        self.conversion_rate_from_WorldSpace_to_ViewSpace_XY = 0.0
        self.conversion_rate_from_WorldSpace_to_ViewSpace_Z = 0.0

        #------------------------------------------------------------
    def  initializing_process ( self ) :

        methode_name = "initializing_process"

        print ( "==================================" )
        print ( "Enter into , Class = " + WorldSpace.CV_CLASS_NAME \
                       + " , methode = " + methode_name )
        print ( "==================================" )

#*******************************
        self.iv_number_of_related_files_from \
           = int ( ParametersContainer  \
                     .global_par_number_of_related_files_from )
        self.iv_number_of_related_files_to \
           = int ( ParametersContainer  \
                     .global_par_number_of_related_files_to )
        self.iv_from_z \
           = int ( ParametersContainer  \
                     .global_par_from_z )
        self.iv_to_z \
           = int ( ParametersContainer  \
                     .global_par_to_z )
        self.iv_incliment_z \
           = int ( ParametersContainer  \
                     .global_par_incliment_z )
#*******************************

        self.get_image_data_related_to_z ( self.iv_from_z )

#*****************************************
        self.conversion_rate_from_WorldSpace_to_ViewSpace_XY \
           = float ( ParametersContainer  \
                  .global_par_conversion_rate_from_WorldSpace_to_ViewSpace_XY )
        self.conversion_rate_from_WorldSpace_to_ViewSpace_Z \
           = float ( ParametersContainer  \
                     .global_par_conversion_rate_from_WorldSpace_to_ViewSpace_Z )
        self.conversion_rate_from_WorldSpace_to_ImageDataSpace \
           = float ( ParametersContainer  \
                     .global_par_conversion_rate_from_WorldSpace_to_ImageDataSpace )

        margin_value \
           = int ( ParametersContainer  \
                      .global_par_margin_value )
#*****************************************

        w_x = int ( self.iv_half_width_of_imageData \
                    / self.conversion_rate_from_WorldSpace_to_ImageDataSpace )
        w_y = int ( self.iv_half_height_of_imageData \
                    / self.conversion_rate_from_WorldSpace_to_ImageDataSpace )
        self.iv_from_x = 0 - w_x + margin_value
        self.iv_to_x   = 0 + w_x - margin_value

#*****************************************
        self.iv_incliment_x \
           = int ( ParametersContainer  \
                     .global_par_incliment_x )
#*****************************************

        self.iv_from_y = 0 - w_y + margin_value
        self.iv_to_y   = 0 + w_y - margin_value

#*****************************************
        self.iv_incliment_y  \
           = int ( ParametersContainer  \
                     .global_par_incliment_y )
#*****************************************

        print ( "==================================" )
        print ( "Class = " + WorldSpace.CV_CLASS_NAME \
                       + " , methode = " + methode_name )
        print ( "self.iv_half_width_of_imageData = " \
                       , self.iv_half_width_of_imageData )
        print ( "self.iv_half_height_of_imageData = " \
                       , self.iv_half_height_of_imageData )
        print ( "w_x = " , w_x )
        print ( "w_y = " , w_y )

        print ( "self.iv_from_x = " , self.iv_from_x )
        print ( "self.iv_to_x = " , self.iv_to_x )
        print ( "self.iv_from_y = " , self.iv_from_y )
        print ( "self.iv_to_y = " , self.iv_to_y )
        print ( "==================================" )

        #**********************************

        self.iv_current_x_of_onePoint_in_WorldSpace = self.iv_from_x
        self.iv_current_y_of_onePoint_in_WorldSpace = self.iv_from_y
        self.iv_current_z_of_onePoint_in_WorldSpace = self.iv_from_z

        self.iv_next_continue = "Y"
        self.iv_next_x = self.iv_current_x_of_onePoint_in_WorldSpace
        self.iv_next_y = self.iv_current_y_of_onePoint_in_WorldSpace
        self.iv_next_z = self.iv_current_z_of_onePoint_in_WorldSpace

        print ( "==================================" )
        print ( "Exit from , Class = " + WorldSpace.CV_CLASS_NAME  \
                       + " , methode = " + methode_name )
        print ( "==================================" )

        #------------------------------------------------------------
    def  get_image_data_related_to_z ( self \
                             , arg_z_value ) :

        methode_name = "get_image_data_related_to_z"

        print ( "==================================" )
        print ( "Enter into , Class = " + WorldSpace.CV_CLASS_NAME \
                       + " , methode = " + methode_name )
        print ( "arg_z_value = " , arg_z_value )
        print ( "==================================" )

        w_1 = int ( arg_z_value )
        file_order_number = w_1
        if ( w_1 < self.iv_number_of_related_files_from ) :
            file_order_number = self.iv_number_of_related_files_from
        if ( w_1 > self.iv_number_of_related_files_to ) :
            file_order_number = self.iv_number_of_related_files_to

               #----------------------
        self.iv_abs_path_of_input_ImageDataFile =  \
           self.make_abs_path_of_input_ImageDataFile ( \
              file_order_number )

        self.iv_ins_ImageDataTwoDimensionHandling   \
                  .load_image_data ( \
                       WorldSpace.CV_CLASS_NAME    #  arg_requester_module
                     , methode_name    # arg_requester_function"
                     , self.iv_abs_path_of_input_ImageDataFile )

        self.iv_width_of_imageData = \
              self.iv_ins_ImageDataTwoDimensionHandling  \
                  .get_width_of_ImageData (  )
        self.iv_half_width_of_imageData = \
              int ( self.iv_width_of_imageData / 2.0 )

        self.iv_height_of_imageData = \
              self.iv_ins_ImageDataTwoDimensionHandling  \
                  .get_height_of_ImageData (  )
        self.iv_half_height_of_imageData = \
              int ( self.iv_height_of_imageData / 2.0 )

        print ( "==================================" )
        print ( "Class = " + WorldSpace.CV_CLASS_NAME \
                       + " , methode = " + methode_name )
        print ( "self.iv_width_of_imageData = " \
                   , self.iv_width_of_imageData )
        print ( "self.iv_height_of_imageData = " \
                   , self.iv_height_of_imageData )
        print ( "==================================" )

        print ( "==================================" )
        print ( "Exit from , Class = " + WorldSpace.CV_CLASS_NAME \
                       + " , methode = " + methode_name )
        print ( "arg_z_value = " , arg_z_value )
        print ( "file_order_number = " , file_order_number )
        print ( "==================================" )

        #------------------------------------------------------------
    def  make_abs_path_of_input_ImageDataFile ( self \
                             , arg_file_order_number ) :

        if ( arg_file_order_number < 10 ) :
            string_of_file_order_number = "0" + str ( arg_file_order_number )
        else :
            string_of_file_order_number = str ( arg_file_order_number )

        abs_path_of_ImageDataFile     \
            = ParametersContainer.global_par_abs_path_of_base_directory    \
              + ParametersContainer.global_par_path_of_input_directory    \
              + ParametersContainer.global_par_path_of_DrawingImageData_directory  \
              + ParametersContainer.global_par_file_name_part_1_of_DrawingImageData  \
              + "_" + string_of_file_order_number  \
              + ParametersContainer.global_par_file_name_ending_part_of_DrawingImageData

        return  abs_path_of_ImageDataFile

        #------------------------------------------------------------
    def  make_one_point_on_WorldSpace ( self ) :

        methode_name = "make_one_point_on_WorldSpace"

        return_list = [  \
                         "Y"    #process continue  \
                      , 0  #x \
                      , 0  #y \
                      , 0  #z \
                           #-----
                      , 0   # Blue   \
                      , 0    # Green   \
                      , 0    # Red     \
                      ]

        if ( self.iv_next_continue != "Y" ) :
                   # reached to process end
            return_list [ 0 ] = "N"
            return return_list

              #------------------------

        if ( self.iv_current_z_of_onePoint_in_WorldSpace != \
                  self.iv_next_z ) :
                      # get imagedata for next z
            self.get_image_data_related_to_z ( self.iv_next_z )

        #***************************************************

               # decide z value for return
        self.iv_current_z_of_onePoint_in_WorldSpace = \
              self.iv_next_z

        w_z = self.iv_current_z_of_onePoint_in_WorldSpace \
               * self.conversion_rate_from_WorldSpace_to_ViewSpace_Z
        return_list [ 3 ] = w_z

         #return_list [ 3 ] = self.iv_current_z_of_onePoint_in_WorldSpace

               # decide x and value for return
        self.iv_current_x_of_onePoint_in_WorldSpace = \
              self.iv_next_x
        self.iv_current_y_of_onePoint_in_WorldSpace = \
              self.iv_next_y

        w_x = self.iv_current_x_of_onePoint_in_WorldSpace \
               * self.conversion_rate_from_WorldSpace_to_ViewSpace_XY
        w_y = self.iv_current_y_of_onePoint_in_WorldSpace \
               * self.conversion_rate_from_WorldSpace_to_ViewSpace_XY

        return_list [ 1 ] = w_x
        return_list [ 2 ] = w_y

        # return_list [ 1 ] = self.iv_current_x_of_onePoint_in_WorldSpace
        # return_list [ 2 ] = self.iv_current_y_of_onePoint_in_WorldSpace

        #*****************************************************

        color_list_for_return = \
             self.decide_color (   \
                   self.iv_current_x_of_onePoint_in_WorldSpace  \
                 , self.iv_current_y_of_onePoint_in_WorldSpace  \
                                  )
        return_list [ 4 ] = color_list_for_return [ 0 ]
        return_list [ 5 ] = color_list_for_return [ 1 ]
        return_list [ 6 ] = color_list_for_return [ 2 ]

               # decide next x , y , z
        self.decide_next_x_y_z ( )

        return  return_list

        #------------------------------------------------------------
    def  decide_next_x_y_z ( self ) :

        methode_name = "decide_next_x_y_z"

        self.iv_next_continue = "Y"
        self.iv_next_x = self.iv_current_x_of_onePoint_in_WorldSpace
        self.iv_next_y = self.iv_current_y_of_onePoint_in_WorldSpace
        self.iv_next_z = self.iv_current_z_of_onePoint_in_WorldSpace

        w_x = self.iv_current_x_of_onePoint_in_WorldSpace + \
                    self.iv_incliment_x
        if ( w_x <= self.iv_to_x ) :
            self.iv_next_x = w_x   # x
            return

        self.iv_next_x = self.iv_from_x   # x
        w_y = self.iv_current_y_of_onePoint_in_WorldSpace  \
                   + self.iv_incliment_y
        if ( w_y <= self.iv_to_y ) :
            self.iv_next_y = w_y    # y
            return

        self.iv_next_y = self.iv_from_y   # y
        w_z = self.iv_current_z_of_onePoint_in_WorldSpace  \
                   + self.iv_incliment_z
        if ( w_z <= self.iv_to_z ) :
            self.iv_next_z = w_z    # z
            return

        else :
            self.iv_next_continue = "N"
            return


        #------------------------------------------------------------
    def  decide_color ( self , arg_x , arg_y ) :

        methode_name = "decide_color"

        w_x = arg_x * \
            self.conversion_rate_from_WorldSpace_to_ImageDataSpace
        w_y = arg_y * \
            self.conversion_rate_from_WorldSpace_to_ImageDataSpace

        get_x = int ( self.iv_half_width_of_imageData \
                           + w_x )
        get_y = int ( self.iv_half_height_of_imageData \
                           + w_y )
              # -------------------------------
        return_list =  \
            self.iv_ins_ImageDataTwoDimensionHandling    \
               .get_data_of_one_pixel (   \
                           WorldSpace.CV_CLASS_NAME # arg_requester_module
                         , methode_name  # arg_requester_function
                              # in the commonly used mathematical XY cordinates
                         , get_x
                         , get_y )

        return return_list


----------
8 WriteImageToOuterMedia モジュール

ファイル名 [WriteImageToOuterMedia.py]

----------

import  datetime
import  MakeImageData
import  ParametersContainer

MODULE_NAME = "WriteImageToOuterMedia"

  #----------------------------------------
def  write_image_to_OuterMedia (
             arg_ins_ImageDataTwoDimensionHandling
                               ) :

    function_name = "write_image_to_OuterMedia"

    print ( "==================================" )
    print ( "Enter into Module = " + MODULE_NAME
                      + " , function = " + function_name )
    print ( "==================================" )

       #get date and time value
    date_now = datetime.date.today()
    time_now = datetime.datetime.now()  \
                        .time()

    date_now_string = str ( date_now )

    date_now_string_rewritten = \
    date_now_string                         \
              .translate (                  \
                  str.maketrans (           \
                      {   '.'  :    '_'     \
                      ,   '-'  :    '_'     \
                      }                     \
                                )           \
                         )
    print ( "date_now_string = " + date_now_string )
    print ( "date_now_string_rewritten = " + date_now_string_rewritten )

    time_now_string = str ( time_now )

    time_now_string_rewritten = \
    time_now_string                         \
              .translate (                  \
                  str.maketrans (           \
                      {   '.'  :    '_'     \
                      ,   '-'  :    '_'     \
                      ,   ':'  :    '_'     \
                      }                     \
                                )           \
                         )
    print ( "time_now_string = " + time_now_string )
    print ( "time_now_string_rewritten = " + time_now_string_rewritten )

    print ( "date_now = " + str ( date_now ) )
    print ( "time_now  = " + str ( time_now )  )

    if ( ParametersContainer    \
             .global_par_insert_date_and_time_Y_N  == "Y" ) :
           #insert date and time into ImageData
        arg_ins_ImageDataTwoDimensionHandling         \
            .insert_text_into_ImageData (
                     MODULE_NAME
                   , function_name
                              # in the commonly used mathematical XY cordinates
                   , 50   #arg_x_on_ImageData_space
                   , 30   #arg_y_on_ImageData_space

                   ,      #insert String
                     ( str ( date_now ) + " , " + str ( time_now ) )

                   , 60   # arg_font_color_Blue
                   , 20   # arg_font_color_Green
                   , 150  # arg_font_color_Red
                                   )
                 #-------------------------------------
    abs_path_of_output_file     \
        = ParametersContainer.global_par_abs_path_of_base_directory    \
          + ParametersContainer.global_par_path_of_output_directory    \
          + ParametersContainer.global_par_path_of_CopyOfDisplayingImageData_directory  \
          + ParametersContainer.global_par_file_name_part_1_of_CopyOfDisplayingImageData  \
              + "_"               \
              + date_now_string_rewritten  \
              + "_"               \
              + time_now_string_rewritten   \
          + ParametersContainer.global_par_file_name_ending_part_of_CopyOfDisplayingImageData

    arg_ins_ImageDataTwoDimensionHandling         \
        .write_loaded_image_data_to_directed_path (
                          MODULE_NAME     #requester module name
                        , function_name   #requester function name
                        , abs_path_of_output_file )

    print ( "==================================" )
    print ( "Module = " + MODULE_NAME
                      + " , function = " + function_name )
    print ( "Image Data have been written into directed media" )
    print ( "abs_path_of_output_file = "  \
                    + abs_path_of_output_file )
    print ( "==================================" )

    print ( "==================================" )
    print ( "Exit from Module = " + MODULE_NAME
                      + " , function = " + function_name )
    print ( "==================================" )

    return


----------

[断面画像を重ね合わせて、物体を3次元表示], Python(パイソン) 使って作ってみた ,ソースプログラムリスト あり へ


この記事が気に入ったらサポートをしてみませんか?