<commit_before># Configuration header
set(DICOM_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
set(DICOM_BUILD_TESTING ${BUILD_TESTING})
set(DICOM_USE_GDCM ${USE_GDCM})
set(DICOM_USE_DCMTK ${USE_DCMTK})
configure_file(${DICOM_SOURCE_DIR}/CMake/vtkDICOMConfig.h.in
  "${CMAKE_CURRENT_BINARY_DIR}/vtkDICOMConfig.h" @ONLY)
configure_file(${DICOM_SOURCE_DIR}/CMake/vtkDICOMBuild.h.in
  "${CMAKE_CURRENT_BINARY_DIR}/vtkDICOMBuild.h" @ONLY)

# Include directories
include_directories(${DICOM_INCLUDE_DIRS})

# Create the main library
set(LIB_NAME vtkDICOM)

if(WIN32)
  set(REFCOUNT_SRC vtkDICOMReferenceCount.cxx)
else()
  set(REFCOUNT_HDR vtkDICOMReferenceCount.h)
endif()

# Sources in the current directory (library sources only!)
set(LIB_SRCS
  vtkDICOMMetaData.cxx
  vtkDICOMDictionary.cxx
  vtkDICOMFilePath.cxx
  vtkDICOMFile.cxx
  vtkDICOMFileDirectory.cxx
  vtkDICOMTag.cxx
  vtkDICOMTagPath.cxx
  vtkDICOMVR.cxx
  vtkDICOMVM.cxx
  vtkDICOMCharacterSet.cxx
  vtkDICOMDataElement.cxx
  vtkDICOMDictHash.cxx
  vtkDICOMDictEntry.cxx
  vtkDICOMDictPrivate.cxx
  vtkDICOMDirectory.cxx
  vtkDICOMFileSorter.cxx
  vtkDICOMGenerator.cxx
  vtkDICOMImageCodec.cxx
  vtkDICOMSCGenerator.cxx
  vtkDICOMCTGenerator.cxx
  vtkDICOMMRGenerator.cxx
  vtkDICOMParser.cxx
  vtkDICOMCompiler.cxx
  vtkDICOMReader.cxx
  vtkDICOMSliceSorter.cxx
  vtkDICOMSequence.cxx
  vtkDICOMItem.cxx
  vtkDICOMSorter.cxx
  ${REFCOUNT_SRC}
  vtkDICOMUtilities.cxx
  vtkDICOMUtilitiesUIDTable.cxx
  vtkDICOMValue.cxx
  vtkDICOMWriter.cxx
  vtkDICOMAlgorithm.cxx
  vtkDICOMLookupTable.cxx
  vtkDICOMApplyPalette.cxx
  vtkDICOMApplyRescale.cxx
  vtkDICOMToRAS.cxx
  vtkDICOMCTRectifier.cxx
  vtkDICOMMetaDataAdapter.cxx
  vtkNIFTIHeader.cxx
  vtkNIFTIReader.cxx
  vtkNIFTIWriter.cxx
  vtkScancoCTReader.cxx
)

# Headers without a matching .cxx file are listed here
set(LIB_HDRS
  ${REFCOUNT_HDR}
  vtkNIFTIPrivate.h
  ${CMAKE_CURRENT_BINARY_DIR}/vtkDICOMBuild.h
  ${CMAKE_CURRENT_BINARY_DIR}/vtkDICOMConfig.h
  ${CMAKE_CURRENT_BINARY_DIR}/vtkDICOMModule.h
)

# Internal headers (not installed)
set(LIB_PRIVATE_HDRS
  vtkNIFTIPrivate.h
  ${CMAKE_CURRENT_BINARY_DIR}/vtkDICOMBuild.h
)

# Sources that are abstract
set(LIB_ABSTRACT
  vtkDICOMGenerator.cxx
)

# Sources that are not vtkObjects
set(LIB_SPECIAL
  vtkDICOMFile.cxx
  vtkDICOMFileDirectory.cxx
  vtkDICOMFilePath.cxx
  vtkDICOMTag.cxx
  vtkDICOMTagPath.cxx
  vtkDICOMVR.cxx
  vtkDICOMVM.cxx
  vtkDICOMCharacterSet.cxx
  vtkDICOMDictEntry.cxx
  vtkDICOMDictHash.cxx
  vtkDICOMDictionary.cxx
  vtkDICOMDictPrivate.cxx
  vtkDICOMDataElement.cxx
  vtkDICOMImageCodec.cxx
  ${REFCOUNT_SRC}
  vtkDICOMSequence.cxx
  vtkDICOMItem.cxx
  vtkDICOMValue.cxx
  vtkDICOMMetaDataAdapter.cxx
  vtkDICOMUtilitiesUIDTable.cxx
)

set_source_files_properties(${LIB_HDRS} ${LIB_SPECIAL}
  PROPERTIES WRAP_EXCLUDE ON)
set_source_files_properties(${LIB_ABSTRACT}
  PROPERTIES ABSTRACT ON)
set_source_files_properties(${LIB_PRIVATE_HDRS}
  PROPERTIES SKIP_HEADER_INSTALL ON)

if(Module_vtkDICOM) # Building as a VTK remote module

  vtk_module_library(vtkDICOM ${LIB_SRCS} ${LIB_HDRS})
  target_link_libraries(${LIB_NAME}
    LINK_PRIVATE ${GDCM_LIBS} ${DCMTK_LIBS})

else() # else MODULE_vtkDICOM

configure_file(${DICOM_SOURCE_DIR}/CMake/vtkDICOMModule.h.in
  "${CMAKE_CURRENT_BINARY_DIR}/vtkDICOMModule.h" COPYONLY)

# Automatically find the header for each cxx file
foreach(arg ${LIB_SRCS})
  get_filename_component(src "${arg}" ABSOLUTE)
  string(REGEX REPLACE "\\.(cxx|c|mm|m)$" ".h" hdr "${src}")
  if("${hdr}" MATCHES "\\.h$" AND EXISTS "${hdr}")
    list(APPEND LIB_HDRS "${hdr}")
  endif()
endforeach()

# Create the hierarchy file
if("${VTK_MAJOR_VERSION}" GREATER 5)
  if(BUILD_PYTHON_WRAPPERS OR BUILD_JAVA_WRAPPERS)
    set_source_files_properties(${LIB_SPECIAL} PROPERTIES WRAP_SPECIAL ON)
    set(MODULE_HIERARCHY_NAME ${LIB_NAME}Hierarchy)
    # The VTK 6 wrapping macros require vtk-module to be set
    set(vtk-module ${LIB_NAME})
    # _LINK_DEPENDS is a variable suffix from the VTK 6 module macros
    set(${vtk-module}_LINK_DEPENDS ${VTK_LIBS} ${KWSYS_LIBS} ${ZLIB_LIBS})
    include(${DICOM_SOURCE_DIR}/CMake/vtkWrapHierarchy.cmake)
    vtk_wrap_hierarchy(${MODULE_HIERARCHY_NAME} ${CMAKE_CURRENT_BINARY_DIR}
      "${LIB_SRCS}")
    set(KIT_HIERARCHY_FILE ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_HIERARCHY_NAME}.txt)
    set(LIB_HIERARCHY_STAMP ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_HIERARCHY_NAME}.stamp)
  endif()
endif()

# Set the library name suffix for VTK 6 libraries
set(LIB_NAME_SUFFIX "-${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}")
if(DEFINED VTK_CUSTOM_LIBRARY_SUFFIX)
  set(LIB_NAME_SUFFIX "${VTK_CUSTOM_LIBRARY_SUFFIX}")
endif()

# Create the library
add_library(${LIB_NAME} ${LIB_SRCS} ${LIB_HIERARCHY_STAMP})
if("${VTK_MAJOR_VERSION}" GREATER 5)
  set_target_properties(${LIB_NAME} PROPERTIES
    OUTPUT_NAME ${LIB_NAME}${LIB_NAME_SUFFIX})
endif()
set_target_properties(${LIB_NAME} PROPERTIES
  VERSION "${DICOM_VERSION}" SOVERSION "${DICOM_SHORT_VERSION}")
if(BUILD_PYTHON_WRAPPERS OR BUILD_JAVA_WRAPPERS AND
   NOT (CMAKE_VERSION VERSION_LESS 2.8))
  set_target_properties(${LIB_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(${LIB_NAME} LINK_PUBLIC ${VTK_LIBS})
target_link_libraries(${LIB_NAME} LINK_PRIVATE
  ${KWSYS_LIBS} ${ZLIB_LIBS} ${GDCM_LIBS} ${DCMTK_LIBS})

# Wrappers
if(BUILD_PYTHON_WRAPPERS AND NOT Module_vtkDICOM)
  set(vtk-module ${LIB_NAME})
  set(XY) # Get python version, e.g. 27 for python 2.7
  if(vtkPython_LIBRARIES)<commit_msg>Link the charls lib to the base lib.<commit_after># Configuration header
set(DICOM_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
set(DICOM_BUILD_TESTING ${BUILD_TESTING})
set(DICOM_USE_GDCM ${USE_GDCM})
set(DICOM_USE_DCMTK ${USE_DCMTK})
configure_file(${DICOM_SOURCE_DIR}/CMake/vtkDICOMConfig.h.in
  "${CMAKE_CURRENT_BINARY_DIR}/vtkDICOMConfig.h" @ONLY)
configure_file(${DICOM_SOURCE_DIR}/CMake/vtkDICOMBuild.h.in
  "${CMAKE_CURRENT_BINARY_DIR}/vtkDICOMBuild.h" @ONLY)

# Include directories
include_directories(${DICOM_INCLUDE_DIRS})

# Create the main library
set(LIB_NAME vtkDICOM)

if(WIN32)
  set(REFCOUNT_SRC vtkDICOMReferenceCount.cxx)
else()
  set(REFCOUNT_HDR vtkDICOMReferenceCount.h)
endif()

# Sources in the current directory (library sources only!)
set(LIB_SRCS
  vtkDICOMMetaData.cxx
  vtkDICOMDictionary.cxx
  vtkDICOMFilePath.cxx
  vtkDICOMFile.cxx
  vtkDICOMFileDirectory.cxx
  vtkDICOMTag.cxx
  vtkDICOMTagPath.cxx
  vtkDICOMVR.cxx
  vtkDICOMVM.cxx
  vtkDICOMCharacterSet.cxx
  vtkDICOMDataElement.cxx
  vtkDICOMDictHash.cxx
  vtkDICOMDictEntry.cxx
  vtkDICOMDictPrivate.cxx
  vtkDICOMDirectory.cxx
  vtkDICOMFileSorter.cxx
  vtkDICOMGenerator.cxx
  vtkDICOMImageCodec.cxx
  vtkDICOMSCGenerator.cxx
  vtkDICOMCTGenerator.cxx
  vtkDICOMMRGenerator.cxx
  vtkDICOMParser.cxx
  vtkDICOMCompiler.cxx
  vtkDICOMReader.cxx
  vtkDICOMSliceSorter.cxx
  vtkDICOMSequence.cxx
  vtkDICOMItem.cxx
  vtkDICOMSorter.cxx
  ${REFCOUNT_SRC}
  vtkDICOMUtilities.cxx
  vtkDICOMUtilitiesUIDTable.cxx
  vtkDICOMValue.cxx
  vtkDICOMWriter.cxx
  vtkDICOMAlgorithm.cxx
  vtkDICOMLookupTable.cxx
  vtkDICOMApplyPalette.cxx
  vtkDICOMApplyRescale.cxx
  vtkDICOMToRAS.cxx
  vtkDICOMCTRectifier.cxx
  vtkDICOMMetaDataAdapter.cxx
  vtkNIFTIHeader.cxx
  vtkNIFTIReader.cxx
  vtkNIFTIWriter.cxx
  vtkScancoCTReader.cxx
)

# Headers without a matching .cxx file are listed here
set(LIB_HDRS
  ${REFCOUNT_HDR}
  vtkNIFTIPrivate.h
  ${CMAKE_CURRENT_BINARY_DIR}/vtkDICOMBuild.h
  ${CMAKE_CURRENT_BINARY_DIR}/vtkDICOMConfig.h
  ${CMAKE_CURRENT_BINARY_DIR}/vtkDICOMModule.h
)

# Internal headers (not installed)
set(LIB_PRIVATE_HDRS
  vtkNIFTIPrivate.h
  ${CMAKE_CURRENT_BINARY_DIR}/vtkDICOMBuild.h
)

# Sources that are abstract
set(LIB_ABSTRACT
  vtkDICOMGenerator.cxx
)

# Sources that are not vtkObjects
set(LIB_SPECIAL
  vtkDICOMFile.cxx
  vtkDICOMFileDirectory.cxx
  vtkDICOMFilePath.cxx
  vtkDICOMTag.cxx
  vtkDICOMTagPath.cxx
  vtkDICOMVR.cxx
  vtkDICOMVM.cxx
  vtkDICOMCharacterSet.cxx
  vtkDICOMDictEntry.cxx
  vtkDICOMDictHash.cxx
  vtkDICOMDictionary.cxx
  vtkDICOMDictPrivate.cxx
  vtkDICOMDataElement.cxx
  vtkDICOMImageCodec.cxx
  ${REFCOUNT_SRC}
  vtkDICOMSequence.cxx
  vtkDICOMItem.cxx
  vtkDICOMValue.cxx
  vtkDICOMMetaDataAdapter.cxx
  vtkDICOMUtilitiesUIDTable.cxx
)

set_source_files_properties(${LIB_HDRS} ${LIB_SPECIAL}
  PROPERTIES WRAP_EXCLUDE ON)
set_source_files_properties(${LIB_ABSTRACT}
  PROPERTIES ABSTRACT ON)
set_source_files_properties(${LIB_PRIVATE_HDRS}
  PROPERTIES SKIP_HEADER_INSTALL ON)

if(Module_vtkDICOM) # Building as a VTK remote module

  vtk_module_library(vtkDICOM ${LIB_SRCS} ${LIB_HDRS})
  target_link_libraries(${LIB_NAME}
    LINK_PRIVATE ${GDCM_LIBS} ${DCMTK_LIBS})
  if(USE_DCMTK AND DCMTK_charls_LIBRARY)
    target_link_libraries(${LIB_NAME} LINK_PRIVATE ${DCMTK_charls_LIBRARY})
  endif()

else() # else MODULE_vtkDICOM

configure_file(${DICOM_SOURCE_DIR}/CMake/vtkDICOMModule.h.in
  "${CMAKE_CURRENT_BINARY_DIR}/vtkDICOMModule.h" COPYONLY)

# Automatically find the header for each cxx file
foreach(arg ${LIB_SRCS})
  get_filename_component(src "${arg}" ABSOLUTE)
  string(REGEX REPLACE "\\.(cxx|c|mm|m)$" ".h" hdr "${src}")
  if("${hdr}" MATCHES "\\.h$" AND EXISTS "${hdr}")
    list(APPEND LIB_HDRS "${hdr}")
  endif()
endforeach()

# Create the hierarchy file
if("${VTK_MAJOR_VERSION}" GREATER 5)
  if(BUILD_PYTHON_WRAPPERS OR BUILD_JAVA_WRAPPERS)
    set_source_files_properties(${LIB_SPECIAL} PROPERTIES WRAP_SPECIAL ON)
    set(MODULE_HIERARCHY_NAME ${LIB_NAME}Hierarchy)
    # The VTK 6 wrapping macros require vtk-module to be set
    set(vtk-module ${LIB_NAME})
    # _LINK_DEPENDS is a variable suffix from the VTK 6 module macros
    set(${vtk-module}_LINK_DEPENDS ${VTK_LIBS} ${KWSYS_LIBS} ${ZLIB_LIBS})
    include(${DICOM_SOURCE_DIR}/CMake/vtkWrapHierarchy.cmake)
    vtk_wrap_hierarchy(${MODULE_HIERARCHY_NAME} ${CMAKE_CURRENT_BINARY_DIR}
      "${LIB_SRCS}")
    set(KIT_HIERARCHY_FILE ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_HIERARCHY_NAME}.txt)
    set(LIB_HIERARCHY_STAMP ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_HIERARCHY_NAME}.stamp)
  endif()
endif()

# Set the library name suffix for VTK 6 libraries
set(LIB_NAME_SUFFIX "-${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}")
if(DEFINED VTK_CUSTOM_LIBRARY_SUFFIX)
  set(LIB_NAME_SUFFIX "${VTK_CUSTOM_LIBRARY_SUFFIX}")
endif()

# Create the library
add_library(${LIB_NAME} ${LIB_SRCS} ${LIB_HIERARCHY_STAMP})
if("${VTK_MAJOR_VERSION}" GREATER 5)
  set_target_properties(${LIB_NAME} PROPERTIES
    OUTPUT_NAME ${LIB_NAME}${LIB_NAME_SUFFIX})
endif()
set_target_properties(${LIB_NAME} PROPERTIES
  VERSION "${DICOM_VERSION}" SOVERSION "${DICOM_SHORT_VERSION}")
if(BUILD_PYTHON_WRAPPERS OR BUILD_JAVA_WRAPPERS AND
   NOT (CMAKE_VERSION VERSION_LESS 2.8))
  set_target_properties(${LIB_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(${LIB_NAME} LINK_PUBLIC ${VTK_LIBS})
target_link_libraries(${LIB_NAME} LINK_PRIVATE
  ${KWSYS_LIBS} ${ZLIB_LIBS} ${GDCM_LIBS} ${DCMTK_LIBS})
if(USE_DCMTK AND DCMTK_charls_LIBRARY)
  target_link_libraries(${LIB_NAME} LINK_PRIVATE ${DCMTK_charls_LIBRARY})
endif()

# Wrappers
if(BUILD_PYTHON_WRAPPERS AND NOT Module_vtkDICOM)
  set(vtk-module ${LIB_NAME})
  set(XY) # Get python version, e.g. 27 for python 2.7
  if(vtkPython_LIBRARIES)
{'fraction_non_alphanumeric': 0.09623727312970341, 'fraction_numerical': 0.0023019034971226205, 'mean_word_length': 6.456105610561056, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2718378', 'n_tokens_mistral': 5022, 'n_tokens_neox': 4901, 'n_words': 682}