<commit_before>
file ( GLOB SimpleITKBasicFiltersSource *.cxx *.h )

macro( process_one_member_variable VARIABLE_NAME VARIABLE_TYPE VARIABLE_VALUE )

  set(MEMBER_VARIABLES_DECLARATION ${MEMBER_VARIABLES_DECLARATION}
    "${VARIABLE_TYPE}  m_${VARIABLE_NAME};"
    )

  set(MEMBER_VARIABLES_INITIALIZATION ${MEMBER_VARIABLES_INITIALIZATION}
    "this->m_${VARIABLE_NAME} = ${VARIABLE_VALUE};"
    )

  set(MEMBER_VARIABLES_SERIALIZATION ${MEMBER_VARIABLES_SERIALIZATION}
    "out << \"\t${VARIABLE_NAME}: \" << this->m_${VARIABLE_NAME} << \"\\n\"; "
    )

  set(MEMBER_VARIABLES_TRANSFER ${MEMBER_VARIABLES_TRANSFER}
    "filter->Set${VARIABLE_NAME}( this->m_${VARIABLE_NAME} );"
    )

endmacro()

macro( process_all_member_variables  VARIABLES_RECORDS )

  message( "${VARIABLES_RECORDS}" )

  set(MEMBER_VARIABLES_DECLARATION "" PARENT_SCOPE)
  set(MEMBER_VARIABLES_INITIALIZATION "" PARENT_SCOPE)
  set(MEMBER_VARIABLES_SERIALIZATION "" PARENT_SCOPE)
  set(MEMBER_VARIABLES_TRANSFER "" PARENT_SCOPE)

  foreach(  variable_line ${VARIABLES_RECORDS} )
    message( " --- START PARSING--- ${variable_line}" )
    string( REGEX MATCH "[A-Za-z]* "   variable_name  "${variable_line}")
    string( REGEX MATCH " [a-z]* "     variable_type  "${variable_line}")
    string( REGEX MATCH " [a-z.0-9]*$" variable_value "${variable_line}")
    message( "variable_name = ${variable_name}" )
    message( "variable_type = ${variable_type}" )
    message( "variable_value = ${variable_value}" )
    if( variable_name )
      process_one_member_variable( ${variable_name} ${variable_type} ${variable_value} )
    endif()
  endforeach()

endmacro()


macro( process_filter_descriptor  FILTER_FILE_NAME )

set( FILTER_PARAMETER_FILE_NAME "${CMAKE_CURRENT_SOURCE_DIR}/${FILTER_FILE_NAME}.in" )

message( "${FILTER_PARAMETER_FILE_NAME}" )

if( EXISTS "${FILTER_PARAMETER_FILE_NAME}" )

  file( STRINGS "${FILTER_PARAMETER_FILE_NAME}" variable_records NEWLINE_CONSUME)

  set(MEMBER_VARIABLES_DECLARATION "" PARENT_SCOPE)
  set(MEMBER_VARIABLES_INITIALIZATION "" PARENT_SCOPE)
  set(MEMBER_VARIABLES_SERIALIZATION "" PARENT_SCOPE)
  set(MEMBER_VARIABLES_TRANSFER "" PARENT_SCOPE)

  process_all_member_variables( ${variable_records} )

endif()

endmacro()


macro( generate_dual_filter FILTERNAME )

  set(FILTERNAME  ${FILTERNAME})

  process_filter_descriptor( ${FILTERNAME} )

  configure_file(
    "${CMAKE_CURRENT_SOURCE_DIR}/sitkDualImageFilterTemplate.h.in"
    "${CMAKE_CURRENT_BINARY_DIR}/sitk${FILTERNAME}ImageFilter.h"
    )

  configure_file(
    "${CMAKE_CURRENT_SOURCE_DIR}/sitkDualImageFilterTemplate.cxx.in"
    "${CMAKE_CURRENT_BINARY_DIR}/sitk${FILTERNAME}ImageFilter.cxx"
    )

  set(SimpleITKBasicFiltersSource ${SimpleITKBasicFiltersSource}
    "${CMAKE_CURRENT_BINARY_DIR}/sitk${FILTERNAME}ImageFilter.cxx")

endmacro()

macro( generate_single_filter FILTERNAME )

  set(FILTERNAME  ${FILTERNAME})

  process_filter_descriptor( ${FILTERNAME} )

  configure_file(
    "${CMAKE_CURRENT_SOURCE_DIR}/sitkImageFilterTemplate.h.in"<commit_msg>ENH:  Reset generation of member variables.<commit_after>
file ( GLOB SimpleITKBasicFiltersSource *.cxx *.h )

macro( process_one_member_variable VARIABLE_NAME VARIABLE_TYPE VARIABLE_VALUE )

  set(MEMBER_VARIABLES_DECLARATION ${MEMBER_VARIABLES_DECLARATION}
    "${VARIABLE_TYPE}  m_${VARIABLE_NAME};"
    )

  set(MEMBER_VARIABLES_INITIALIZATION ${MEMBER_VARIABLES_INITIALIZATION}
    "this->m_${VARIABLE_NAME} = ${VARIABLE_VALUE};"
    )

  set(MEMBER_VARIABLES_SERIALIZATION ${MEMBER_VARIABLES_SERIALIZATION}
    "out << \"\t${VARIABLE_NAME}: \" << this->m_${VARIABLE_NAME} << \"\\n\"; "
    )

  set(MEMBER_VARIABLES_TRANSFER ${MEMBER_VARIABLES_TRANSFER}
    "filter->Set${VARIABLE_NAME}( this->m_${VARIABLE_NAME} );"
    )

endmacro()

macro( process_all_member_variables  VARIABLES_RECORDS )

  message( "${VARIABLES_RECORDS}" )

  foreach(  variable_line ${VARIABLES_RECORDS} )
    message( " --- START PARSING--- ${variable_line}" )
    string( REGEX MATCH "[A-Za-z]* "   variable_name  "${variable_line}")
    string( REGEX MATCH " [a-z]* "     variable_type  "${variable_line}")
    string( REGEX MATCH " [a-z.0-9]*$" variable_value "${variable_line}")
    message( "variable_name = ${variable_name}" )
    message( "variable_type = ${variable_type}" )
    message( "variable_value = ${variable_value}" )
    if( variable_name )
      process_one_member_variable( ${variable_name} ${variable_type} ${variable_value} )
    endif()
  endforeach()

endmacro()


macro( process_filter_descriptor  FILTER_FILE_NAME )

set( FILTER_PARAMETER_FILE_NAME "${CMAKE_CURRENT_SOURCE_DIR}/${FILTER_FILE_NAME}.in" )

message( "${FILTER_PARAMETER_FILE_NAME}" )

if( EXISTS "${FILTER_PARAMETER_FILE_NAME}" )

  file( STRINGS "${FILTER_PARAMETER_FILE_NAME}" variable_records NEWLINE_CONSUME)

  process_all_member_variables( ${variable_records} )

endif()

endmacro()


macro( generate_dual_filter FILTERNAME )

  set(FILTERNAME  ${FILTERNAME})

  set(MEMBER_VARIABLES_DECLARATION "")
  set(MEMBER_VARIABLES_INITIALIZATION "")
  set(MEMBER_VARIABLES_SERIALIZATION "")
  set(MEMBER_VARIABLES_TRANSFER "")

  process_filter_descriptor( ${FILTERNAME} )

  configure_file(
    "${CMAKE_CURRENT_SOURCE_DIR}/sitkDualImageFilterTemplate.h.in"
    "${CMAKE_CURRENT_BINARY_DIR}/sitk${FILTERNAME}ImageFilter.h"
    )

  configure_file(
    "${CMAKE_CURRENT_SOURCE_DIR}/sitkDualImageFilterTemplate.cxx.in"
    "${CMAKE_CURRENT_BINARY_DIR}/sitk${FILTERNAME}ImageFilter.cxx"
    )

  set(SimpleITKBasicFiltersSource ${SimpleITKBasicFiltersSource}
    "${CMAKE_CURRENT_BINARY_DIR}/sitk${FILTERNAME}ImageFilter.cxx")

endmacro()

macro( generate_single_filter FILTERNAME )

  set(FILTERNAME  ${FILTERNAME})

  set(MEMBER_VARIABLES_DECLARATION "")
  set(MEMBER_VARIABLES_INITIALIZATION "")
  set(MEMBER_VARIABLES_SERIALIZATION "")
  set(MEMBER_VARIABLES_TRANSFER "")

  process_filter_descriptor( ${FILTERNAME} )

  configure_file(
    "${CMAKE_CURRENT_SOURCE_DIR}/sitkImageFilterTemplate.h.in"
{'fraction_non_alphanumeric': 0.12570668440305952, 'fraction_numerical': 0.0006651147322913202, 'mean_word_length': 5.913793103448276, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1341586', 'n_tokens_mistral': 2289, 'n_tokens_neox': 2222, 'n_words': 276}