flash-radiomics 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. flash_radiomics-1.0.0/CMakeLists.txt +257 -0
  2. flash_radiomics-1.0.0/LICENSE +29 -0
  3. flash_radiomics-1.0.0/MANIFEST.in +17 -0
  4. flash_radiomics-1.0.0/PKG-INFO +623 -0
  5. flash_radiomics-1.0.0/README.md +593 -0
  6. flash_radiomics-1.0.0/flash_radiomics/__init__.py +212 -0
  7. flash_radiomics-1.0.0/flash_radiomics/_bindings.py +1322 -0
  8. flash_radiomics-1.0.0/flash_radiomics/base.py +253 -0
  9. flash_radiomics-1.0.0/flash_radiomics/featureextractor.py +1711 -0
  10. flash_radiomics-1.0.0/flash_radiomics/firstorder.py +360 -0
  11. flash_radiomics-1.0.0/flash_radiomics/generalinfo.py +204 -0
  12. flash_radiomics-1.0.0/flash_radiomics/glcm.py +516 -0
  13. flash_radiomics-1.0.0/flash_radiomics/gldm.py +358 -0
  14. flash_radiomics-1.0.0/flash_radiomics/gldzm.py +265 -0
  15. flash_radiomics-1.0.0/flash_radiomics/glrlm.py +224 -0
  16. flash_radiomics-1.0.0/flash_radiomics/glszm.py +308 -0
  17. flash_radiomics-1.0.0/flash_radiomics/hdf5_io.py +485 -0
  18. flash_radiomics-1.0.0/flash_radiomics/ih.py +158 -0
  19. flash_radiomics-1.0.0/flash_radiomics/imageoperations.py +1910 -0
  20. flash_radiomics-1.0.0/flash_radiomics/ivh.py +191 -0
  21. flash_radiomics-1.0.0/flash_radiomics/ngtdm.py +187 -0
  22. flash_radiomics-1.0.0/flash_radiomics/pes_controls.py +350 -0
  23. flash_radiomics-1.0.0/flash_radiomics/preprocessing.py +372 -0
  24. flash_radiomics-1.0.0/flash_radiomics/schemas/paramSchema.yaml +205 -0
  25. flash_radiomics-1.0.0/flash_radiomics/schemas/schemaFuncs.py +136 -0
  26. flash_radiomics-1.0.0/flash_radiomics/shape.py +300 -0
  27. flash_radiomics-1.0.0/flash_radiomics/shape2D.py +77 -0
  28. flash_radiomics-1.0.0/flash_radiomics/spatial_phenotyping.py +1722 -0
  29. flash_radiomics-1.0.0/flash_radiomics/voxel.py +2787 -0
  30. flash_radiomics-1.0.0/flash_radiomics.egg-info/PKG-INFO +623 -0
  31. flash_radiomics-1.0.0/flash_radiomics.egg-info/SOURCES.txt +93 -0
  32. flash_radiomics-1.0.0/flash_radiomics.egg-info/dependency_links.txt +1 -0
  33. flash_radiomics-1.0.0/flash_radiomics.egg-info/not-zip-safe +1 -0
  34. flash_radiomics-1.0.0/flash_radiomics.egg-info/top_level.txt +1 -0
  35. flash_radiomics-1.0.0/pyproject.toml +32 -0
  36. flash_radiomics-1.0.0/setup.cfg +4 -0
  37. flash_radiomics-1.0.0/setup.py +170 -0
  38. flash_radiomics-1.0.0/src/api/flash_radiomics_api.c +939 -0
  39. flash_radiomics-1.0.0/src/api/flash_radiomics_api.h +119 -0
  40. flash_radiomics-1.0.0/src/api/mps_detection.h +50 -0
  41. flash_radiomics-1.0.0/src/api/mps_detection.m +75 -0
  42. flash_radiomics-1.0.0/src/core/dicom_converter.c +193 -0
  43. flash_radiomics-1.0.0/src/core/dicom_converter.h +12 -0
  44. flash_radiomics-1.0.0/src/core/image_io.c +858 -0
  45. flash_radiomics-1.0.0/src/core/image_io.h +26 -0
  46. flash_radiomics-1.0.0/src/core/nifti1_io.c +409 -0
  47. flash_radiomics-1.0.0/src/core/nifti1_io.h +166 -0
  48. flash_radiomics-1.0.0/src/core/types.h +99 -0
  49. flash_radiomics-1.0.0/src/core/utils.c +404 -0
  50. flash_radiomics-1.0.0/src/core/utils.h +121 -0
  51. flash_radiomics-1.0.0/src/cuda/cuda_common.cu +1178 -0
  52. flash_radiomics-1.0.0/src/cuda/cuda_common.h +210 -0
  53. flash_radiomics-1.0.0/src/cuda/firstorder_cuda.cu +562 -0
  54. flash_radiomics-1.0.0/src/cuda/firstorder_cuda.h +25 -0
  55. flash_radiomics-1.0.0/src/cuda/glcm_cuda.cu +1678 -0
  56. flash_radiomics-1.0.0/src/cuda/glcm_cuda.h +41 -0
  57. flash_radiomics-1.0.0/src/cuda/gldm_cuda.cu +480 -0
  58. flash_radiomics-1.0.0/src/cuda/gldm_cuda.h +44 -0
  59. flash_radiomics-1.0.0/src/cuda/glrlm_cuda.cu +1342 -0
  60. flash_radiomics-1.0.0/src/cuda/glrlm_cuda.h +37 -0
  61. flash_radiomics-1.0.0/src/cuda/glszm_cuda.cu +1020 -0
  62. flash_radiomics-1.0.0/src/cuda/glszm_cuda.h +37 -0
  63. flash_radiomics-1.0.0/src/cuda/ngtdm_cuda.cu +448 -0
  64. flash_radiomics-1.0.0/src/cuda/ngtdm_cuda.h +42 -0
  65. flash_radiomics-1.0.0/src/cuda/reduction_kernels.cu +793 -0
  66. flash_radiomics-1.0.0/src/cuda/reduction_kernels.h +40 -0
  67. flash_radiomics-1.0.0/src/cuda/shape_cuda.cu +17 -0
  68. flash_radiomics-1.0.0/src/cuda/shape_cuda.h +22 -0
  69. flash_radiomics-1.0.0/src/cuda/voxel_batch_texture_cuda.cu +4615 -0
  70. flash_radiomics-1.0.0/src/cuda/voxel_multi_class_cuda.cu +9 -0
  71. flash_radiomics-1.0.0/src/cuda/voxel_multi_class_cuda.h +94 -0
  72. flash_radiomics-1.0.0/src/features/cshape.c +1208 -0
  73. flash_radiomics-1.0.0/src/features/cshape.h +9 -0
  74. flash_radiomics-1.0.0/src/features/firstorder_cpu.c +546 -0
  75. flash_radiomics-1.0.0/src/features/firstorder_cpu.h +25 -0
  76. flash_radiomics-1.0.0/src/features/glcm_cpu.c +1790 -0
  77. flash_radiomics-1.0.0/src/features/glcm_cpu.h +59 -0
  78. flash_radiomics-1.0.0/src/features/gldm_cpu.c +755 -0
  79. flash_radiomics-1.0.0/src/features/gldm_cpu.h +50 -0
  80. flash_radiomics-1.0.0/src/features/glrlm_cpu.c +1488 -0
  81. flash_radiomics-1.0.0/src/features/glrlm_cpu.h +42 -0
  82. flash_radiomics-1.0.0/src/features/glszm_cpu.c +1392 -0
  83. flash_radiomics-1.0.0/src/features/glszm_cpu.h +44 -0
  84. flash_radiomics-1.0.0/src/features/ngtdm_cpu.c +793 -0
  85. flash_radiomics-1.0.0/src/features/ngtdm_cpu.h +47 -0
  86. flash_radiomics-1.0.0/src/features/shape_cpu.c +652 -0
  87. flash_radiomics-1.0.0/src/features/shape_cpu.h +18 -0
  88. flash_radiomics-1.0.0/src/mps/firstorder_mps.h +31 -0
  89. flash_radiomics-1.0.0/src/mps/firstorder_mps.m +23 -0
  90. flash_radiomics-1.0.0/src/mps/glcm_mps.h +25 -0
  91. flash_radiomics-1.0.0/src/mps/glcm_mps.m +25 -0
  92. flash_radiomics-1.0.0/src/mps/glrlm_mps.h +23 -0
  93. flash_radiomics-1.0.0/src/mps/glrlm_mps.m +21 -0
  94. flash_radiomics-1.0.0/src/mps/glszm_mps.h +23 -0
  95. flash_radiomics-1.0.0/src/mps/glszm_mps.m +21 -0
@@ -0,0 +1,257 @@
1
+ cmake_minimum_required(VERSION 3.18)
2
+ project(flash_radiomics C CXX)
3
+
4
+ set(CMAKE_C_STANDARD 11)
5
+ set(CMAKE_C_STANDARD_REQUIRED ON)
6
+
7
+ set(CMAKE_CXX_STANDARD 14)
8
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
9
+
10
+ if(NOT CMAKE_BUILD_TYPE)
11
+ set(CMAKE_BUILD_TYPE Release)
12
+ endif()
13
+
14
+ option(
15
+ FLASH_RADIOMICS_NATIVE_CPU
16
+ "Use native CPU instruction tuning (-march=native or -mcpu=native). Disable for portable cluster builds."
17
+ OFF
18
+ )
19
+ if(APPLE)
20
+ set(CMAKE_C_FLAGS_RELEASE "-O3 -fPIC" CACHE STRING "Flags used by the C compiler during release builds" FORCE)
21
+ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm64|aarch64|ARM64")
22
+ if(FLASH_RADIOMICS_NATIVE_CPU)
23
+ set(CMAKE_C_FLAGS_RELEASE "-O3 -mcpu=native -fPIC" CACHE STRING "Flags used by the C compiler during release builds" FORCE)
24
+ else()
25
+ set(CMAKE_C_FLAGS_RELEASE "-O3 -fPIC" CACHE STRING "Flags used by the C compiler during release builds" FORCE)
26
+ endif()
27
+ else()
28
+ if(FLASH_RADIOMICS_NATIVE_CPU)
29
+ set(CMAKE_C_FLAGS_RELEASE "-O3 -march=native -fPIC" CACHE STRING "Flags used by the C compiler during release builds" FORCE)
30
+ else()
31
+ set(CMAKE_C_FLAGS_RELEASE "-O3 -fPIC" CACHE STRING "Flags used by the C compiler during release builds" FORCE)
32
+ endif()
33
+ endif()
34
+ message(STATUS "FLASH_RADIOMICS_NATIVE_CPU=${FLASH_RADIOMICS_NATIVE_CPU}")
35
+ message(STATUS "C release flags: ${CMAKE_C_FLAGS_RELEASE}")
36
+ set(CMAKE_C_FLAGS_DEBUG "-g -O0 -fPIC" CACHE STRING "Flags used by the C compiler during debug builds" FORCE)
37
+
38
+ option(ENABLE_CUDA "Enable CUDA GPU acceleration support" ON)
39
+
40
+ if(ENABLE_CUDA)
41
+ include(CheckLanguage)
42
+ check_language(CUDA)
43
+
44
+ if(CMAKE_CUDA_COMPILER)
45
+ enable_language(CUDA)
46
+ find_package(CUDAToolkit QUIET)
47
+
48
+ if(CUDAToolkit_FOUND)
49
+ message(STATUS "CUDA found: ${CUDAToolkit_VERSION}")
50
+ message(STATUS "CUDA Toolkit Root: ${CUDAToolkit_TARGET_DIR}")
51
+
52
+ set(CMAKE_CUDA_STANDARD 14)
53
+ set(CMAKE_CUDA_STANDARD_REQUIRED ON)
54
+
55
+ set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -O3 --use_fast_math -Xcompiler -fPIC")
56
+
57
+ set(CMAKE_CUDA_ARCHITECTURES "70;75;80;86;89;90")
58
+
59
+ set(CUDA_AVAILABLE TRUE)
60
+ message(STATUS "CUDA support enabled - Building with GPU acceleration")
61
+ else()
62
+ set(CUDA_AVAILABLE FALSE)
63
+ message(STATUS "CUDA Toolkit not found - Building without CUDA support")
64
+ endif()
65
+ else()
66
+ set(CUDA_AVAILABLE FALSE)
67
+ message(STATUS "CUDA compiler not found - Building without CUDA support")
68
+ endif()
69
+ else()
70
+ set(CUDA_AVAILABLE FALSE)
71
+ message(STATUS "CUDA support disabled by user - Building without CUDA support")
72
+ endif()
73
+
74
+ set(CORE_SOURCES
75
+ src/core/image_io.c
76
+ src/core/dicom_converter.c
77
+ src/core/utils.c
78
+ src/core/nifti1_io.c
79
+ )
80
+
81
+ set(FEATURE_CPU_SOURCES
82
+ src/features/firstorder_cpu.c
83
+ src/features/glcm_cpu.c
84
+ src/features/glrlm_cpu.c
85
+ src/features/glszm_cpu.c
86
+ src/features/gldm_cpu.c
87
+ src/features/ngtdm_cpu.c
88
+ src/features/cshape.c
89
+ src/features/shape_cpu.c
90
+ )
91
+
92
+ set(API_SOURCES
93
+ src/api/flash_radiomics_api.c
94
+ )
95
+
96
+ if(APPLE)
97
+ set(MPS_DETECTION_SOURCE
98
+ src/api/mps_detection.m
99
+ )
100
+ endif()
101
+
102
+ if(APPLE)
103
+ add_library(flash_radiomics_cpu SHARED
104
+ ${CORE_SOURCES}
105
+ ${FEATURE_CPU_SOURCES}
106
+ ${API_SOURCES}
107
+ ${MPS_DETECTION_SOURCE}
108
+ )
109
+ else()
110
+ add_library(flash_radiomics_cpu SHARED
111
+ ${CORE_SOURCES}
112
+ ${FEATURE_CPU_SOURCES}
113
+ ${API_SOURCES}
114
+ )
115
+ endif()
116
+
117
+ target_include_directories(flash_radiomics_cpu PUBLIC
118
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/core
119
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/features
120
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/api
121
+ )
122
+
123
+ if(APPLE)
124
+ find_library(METAL_FRAMEWORK Metal)
125
+ find_library(FOUNDATION_FRAMEWORK Foundation)
126
+
127
+ target_link_libraries(flash_radiomics_cpu PUBLIC
128
+ ${METAL_FRAMEWORK}
129
+ ${FOUNDATION_FRAMEWORK}
130
+ z
131
+ m
132
+ )
133
+ else()
134
+ target_link_libraries(flash_radiomics_cpu PUBLIC
135
+ z
136
+ m
137
+ )
138
+ endif()
139
+
140
+ if(APPLE)
141
+ enable_language(OBJC)
142
+
143
+ set(FEATURE_MPS_SOURCES
144
+ src/mps/firstorder_mps.m
145
+ src/mps/glcm_mps.m
146
+ src/mps/glrlm_mps.m
147
+ src/mps/glszm_mps.m
148
+ )
149
+
150
+ add_library(flash_radiomics_mps SHARED
151
+ ${CORE_SOURCES}
152
+ ${FEATURE_CPU_SOURCES}
153
+ ${FEATURE_MPS_SOURCES}
154
+ ${API_SOURCES}
155
+ ${MPS_DETECTION_SOURCE}
156
+ )
157
+
158
+ target_include_directories(flash_radiomics_mps PUBLIC
159
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/core
160
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/mps
161
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/api
162
+ )
163
+
164
+ target_compile_definitions(flash_radiomics_mps PRIVATE FLASH_RADIOMICS_MPS_ENABLED)
165
+
166
+ find_library(METAL_FRAMEWORK Metal)
167
+ find_library(FOUNDATION_FRAMEWORK Foundation)
168
+
169
+ target_link_libraries(flash_radiomics_mps PUBLIC
170
+ ${METAL_FRAMEWORK}
171
+ ${FOUNDATION_FRAMEWORK}
172
+ z
173
+ m
174
+ )
175
+ endif()
176
+
177
+ if(CUDA_AVAILABLE)
178
+ set(FEATURE_CUDA_SOURCES
179
+ src/cuda/cuda_common.cu
180
+ src/cuda/reduction_kernels.cu
181
+ src/cuda/firstorder_cuda.cu
182
+ src/cuda/glcm_cuda.cu
183
+ src/cuda/glrlm_cuda.cu
184
+ src/cuda/glszm_cuda.cu
185
+ src/cuda/gldm_cuda.cu
186
+ src/cuda/ngtdm_cuda.cu
187
+ src/cuda/shape_cuda.cu
188
+ src/cuda/voxel_batch_texture_cuda.cu
189
+ )
190
+
191
+ add_library(flash_radiomics_cuda SHARED
192
+ ${CORE_SOURCES}
193
+ ${FEATURE_CPU_SOURCES}
194
+ ${FEATURE_CUDA_SOURCES}
195
+ ${API_SOURCES}
196
+ )
197
+
198
+ if(APPLE)
199
+ target_sources(flash_radiomics_cuda PRIVATE ${MPS_DETECTION_SOURCE})
200
+ endif()
201
+
202
+ target_include_directories(flash_radiomics_cuda PUBLIC
203
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/core
204
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/features
205
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/cuda
206
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/api
207
+ )
208
+
209
+ target_compile_definitions(flash_radiomics_cuda PRIVATE FLASH_RADIOMICS_CUDA_ENABLED)
210
+
211
+ target_link_libraries(flash_radiomics_cuda PUBLIC
212
+ CUDA::cudart
213
+ z
214
+ m
215
+ )
216
+ if(APPLE)
217
+ target_link_libraries(flash_radiomics_cuda PUBLIC
218
+ ${METAL_FRAMEWORK}
219
+ ${FOUNDATION_FRAMEWORK}
220
+ )
221
+ endif()
222
+
223
+ set_target_properties(flash_radiomics_cuda PROPERTIES
224
+ CUDA_SEPARABLE_COMPILATION ON
225
+ CUDA_RESOLVE_DEVICE_SYMBOLS ON
226
+ POSITION_INDEPENDENT_CODE ON
227
+ )
228
+
229
+ message(STATUS "CUDA library target configured: flash_radiomics_cuda")
230
+ endif()
231
+
232
+ install(TARGETS flash_radiomics_cpu
233
+ LIBRARY DESTINATION lib
234
+ ARCHIVE DESTINATION lib
235
+ RUNTIME DESTINATION bin
236
+ )
237
+
238
+ if(APPLE)
239
+ install(TARGETS flash_radiomics_mps
240
+ LIBRARY DESTINATION lib
241
+ ARCHIVE DESTINATION lib
242
+ RUNTIME DESTINATION bin
243
+ )
244
+ endif()
245
+
246
+ if(CUDA_AVAILABLE)
247
+ install(TARGETS flash_radiomics_cuda
248
+ LIBRARY DESTINATION lib
249
+ ARCHIVE DESTINATION lib
250
+ RUNTIME DESTINATION bin
251
+ )
252
+ endif()
253
+
254
+ install(DIRECTORY src/core/ DESTINATION include/flash_radiomics
255
+ FILES_MATCHING PATTERN "*.h")
256
+ install(DIRECTORY src/api/ DESTINATION include/flash_radiomics
257
+ FILES_MATCHING PATTERN "*.h")
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, Flash-Radiomics contributors
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,17 @@
1
+ include README.md
2
+ include LICENSE
3
+ include CMakeLists.txt
4
+ include pyproject.toml
5
+ recursive-include src *.c *.h *.m *.cu
6
+ recursive-include flash_radiomics *.py
7
+ recursive-include flash_radiomics/schemas *.yaml
8
+ prune configs
9
+ prune docs
10
+ prune helper_docs
11
+ prune reproducibility
12
+ prune test_functionality
13
+ prune tutorials
14
+ prune tools
15
+ global-exclude *.py[cod]
16
+ global-exclude __pycache__
17
+ global-exclude .DS_Store