├── .gitignore
├── BoneTexture
├── BoneTexture.py
├── CMakeLists.txt
├── Resources
│ ├── Icons
│ │ └── BoneTexture.png
│ └── UI
│ │ └── BoneTexture.ui
└── Testing
│ ├── CMakeLists.txt
│ └── Python
│ └── CMakeLists.txt
├── BoneTextureExtension.png
├── CMakeLists.txt
├── ComputeBMFeatureMaps
├── CMakeLists.txt
├── ComputeBMFeatureMaps.cxx
├── ComputeBMFeatureMaps.xml
└── Testing
│ ├── CMakeLists.txt
│ └── Cxx
│ └── CMakeLists.txt
├── ComputeBMFeatures
├── CMakeLists.txt
├── ComputeBMFeatures.cxx
├── ComputeBMFeatures.xml
└── Testing
│ ├── CMakeLists.txt
│ └── Cxx
│ └── CMakeLists.txt
├── ComputeGLCMFeatureMaps
├── CMakeLists.txt
├── ComputeGLCMFeatureMaps.cxx
├── ComputeGLCMFeatureMaps.xml
└── Testing
│ ├── CMakeLists.txt
│ └── Cxx
│ └── CMakeLists.txt
├── ComputeGLCMFeatures
├── CMakeLists.txt
├── ComputeGLCMFeatures.cxx
├── ComputeGLCMFeatures.xml
└── Testing
│ ├── CMakeLists.txt
│ └── Cxx
│ └── CMakeLists.txt
├── ComputeGLRLMFeatureMaps
├── CMakeLists.txt
├── ComputeGLRLMFeatureMaps.cxx
├── ComputeGLRLMFeatureMaps.xml
└── Testing
│ ├── CMakeLists.txt
│ └── Cxx
│ └── CMakeLists.txt
├── ComputeGLRLMFeatures
├── CMakeLists.txt
├── ComputeGLRLMFeatures.cxx
├── ComputeGLRLMFeatures.xml
└── Testing
│ ├── CMakeLists.txt
│ └── Cxx
│ └── CMakeLists.txt
├── CreateLabelMapFromCSV
├── CMakeLists.txt
├── CreateLabelMapFromCSV.cxx
├── CreateLabelMapFromCSV.xml
└── Testing
│ ├── CMakeLists.txt
│ └── Cxx
│ └── CMakeLists.txt
├── Docs
└── BoneTextureExtensionTutorial_2017.pdf
├── LICENSE.txt
├── README.md
├── SaveVectorImageAsCSV
├── CMakeLists.txt
├── SaveVectorImageAsCSV.cxx
├── SaveVectorImageAsCSV.xml
└── Testing
│ ├── CMakeLists.txt
│ └── Cxx
│ └── CMakeLists.txt
├── SeparateVectorImage
├── CMakeLists.txt
├── SeparateVectorImage.cxx
├── SeparateVectorImage.xml
└── Testing
│ ├── CMakeLists.txt
│ └── Cxx
│ └── CMakeLists.txt
├── SuperBuild.cmake
└── SuperBuild
├── External_ITKBoneMorphometry.cmake
└── External_ITKTextureFeature.cmake
/.gitignore:
--------------------------------------------------------------------------------
1 | BoneTexture/BoneTexture.pyc
2 | BoneTextureSerializer/BoneTextureSerializer.pyc
3 | CMakeLists.txt.user
4 |
--------------------------------------------------------------------------------
/BoneTexture/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #-----------------------------------------------------------------------------
2 | set(MODULE_NAME BoneTexture)
3 |
4 | #-----------------------------------------------------------------------------
5 | set(MODULE_PYTHON_SCRIPTS
6 | ${MODULE_NAME}.py
7 | )
8 |
9 | set(MODULE_PYTHON_RESOURCES
10 | Resources/Icons/${MODULE_NAME}.png
11 | Resources/UI/${MODULE_NAME}.ui
12 | )
13 |
14 | #-----------------------------------------------------------------------------
15 | slicerMacroBuildScriptedModule(
16 | NAME ${MODULE_NAME}
17 | SCRIPTS ${MODULE_PYTHON_SCRIPTS}
18 | RESOURCES ${MODULE_PYTHON_RESOURCES}
19 | WITH_GENERIC_TESTS
20 | )
21 |
22 | #-----------------------------------------------------------------------------
23 | if(BUILD_TESTING)
24 |
25 | # Register the unittest subclass in the main script as a ctest.
26 | # Note that the test will also be available at runtime.
27 | slicer_add_python_unittest(SCRIPT ${MODULE_NAME}.py)
28 |
29 | # Additional build-time testing
30 | add_subdirectory(Testing)
31 | endif()
32 |
--------------------------------------------------------------------------------
/BoneTexture/Resources/Icons/BoneTexture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kitware/BoneTextureExtension/3410506efaa404131f7b02aa70769f537b1f2b3d/BoneTexture/Resources/Icons/BoneTexture.png
--------------------------------------------------------------------------------
/BoneTexture/Resources/UI/BoneTexture.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | BoneTexture
4 |
5 |
6 |
7 | 0
8 | 0
9 | 416
10 | 1437
11 |
12 |
13 |
14 | -
15 |
16 |
17 | Single Image Mode
18 |
19 |
20 |
21 | -
22 |
23 |
24 | Serializer Mode
25 |
26 |
27 |
28 | -
29 |
30 |
31 | Inputs
32 |
33 |
34 |
-
35 |
36 |
37 | 0
38 |
39 |
40 |
41 |
-
42 |
43 |
44 | Input data folder:
45 |
46 |
47 |
48 | -
49 |
50 |
51 | ctkPathLineEdit::Dirs|ctkPathLineEdit::Drives|ctkPathLineEdit::NoDot|ctkPathLineEdit::NoDotDot|ctkPathLineEdit::Readable
52 |
53 |
54 |
55 | -
56 |
57 |
58 | Note: The input data should be named: Scan_{ID} for the input scan and Seg_{ID} for the corresponding label map (if a region mask exists)
59 |
60 |
61 | true
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 | -
70 |
71 |
72 | Input volume:
73 |
74 |
75 |
76 | -
77 |
78 |
79 | Input labelmap:
80 |
81 |
82 |
83 | -
84 |
85 |
86 | Pick the input to the algorithm.
87 |
88 |
89 |
90 | vtkMRMLScalarVolumeNode
91 |
92 |
93 |
94 | false
95 |
96 |
97 | false
98 |
99 |
100 | false
101 |
102 |
103 | inputVolume
104 |
105 |
106 |
107 | -
108 |
109 |
110 | Specify Mask
111 |
112 |
113 |
114 | -
115 |
116 |
117 |
118 | 7
119 |
120 |
121 |
122 | This defines region over which texture features will be computed (Note: This option will greatly improve computation time)
123 |
124 |
125 | true
126 |
127 |
128 |
129 | -
130 |
131 |
132 |
133 | vtkMRMLLabelMapVolumeNode
134 |
135 |
136 |
137 |
138 |
139 |
140 | false
141 |
142 |
143 | false
144 |
145 |
146 |
147 |
148 |
149 | inputLabelMap
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 | -
158 |
159 |
160 | Conversion: Vector Input Scan to Scalar
161 |
162 |
163 |
-
164 |
165 |
166 | Convert Input Scan to Scalar
167 |
168 |
169 |
170 | -
171 |
172 |
-
173 |
174 |
175 |
176 | 3
177 | 0
178 |
179 |
180 |
181 |
182 | -
183 |
184 |
185 |
186 | 1
187 | 0
188 |
189 |
190 |
191 |
192 |
193 |
194 | -
195 |
196 |
197 | Convert Input Scan to Scalar
198 |
199 |
200 |
201 |
202 |
203 |
204 | -
205 |
206 |
207 | Process Inputs
208 |
209 |
210 |
211 | -
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 | -
222 |
223 |
224 | Computation
225 |
226 |
227 |
-
228 |
229 |
230 | Features choice
231 |
232 |
233 |
-
234 |
235 |
236 |
237 |
238 |
239 |
240 | -
241 |
242 |
243 |
244 |
245 |
246 |
247 | -
248 |
249 |
250 | Gray Level Co-occurrences (GLCM) features
251 |
252 |
253 |
254 | -
255 |
256 |
257 |
258 |
259 |
260 |
261 | -
262 |
263 |
264 | Gray Level Run Length (GLRLM) features
265 |
266 |
267 |
268 | -
269 |
270 |
271 | Bone Morphometry (BM) features
272 |
273 |
274 |
275 |
276 |
277 |
278 | -
279 |
280 |
281 | Populate Parameters Based on Inputs
282 |
283 |
284 |
285 | -
286 |
287 |
288 | true
289 |
290 |
291 | GLCM parameters
292 |
293 |
294 | true
295 |
296 |
297 | true
298 |
299 |
300 | false
301 |
302 |
303 |
304 | QLayout::SetMinimumSize
305 |
306 |
307 | 9
308 |
309 |
-
310 |
311 |
312 | QFormLayout::AllNonFixedFieldsGrow
313 |
314 |
-
315 |
316 |
317 | Mask "inside" value:
318 |
319 |
320 |
321 | -
322 |
323 |
324 | 1000
325 |
326 |
327 | 1
328 |
329 |
330 | 1
331 |
332 |
333 | GLCMFeaturesValue.insideMask
334 |
335 |
336 |
337 | -
338 |
339 |
340 | Number of bins:
341 |
342 |
343 |
344 | -
345 |
346 |
347 | 1
348 |
349 |
350 | 1200
351 |
352 |
353 | 10
354 |
355 |
356 | GLCMFeaturesValue.binNumber
357 |
358 |
359 |
360 | -
361 |
362 |
363 | Voxel Intensity Range:
364 |
365 |
366 |
367 | -
368 |
369 |
-
370 |
371 |
372 | min:
373 |
374 |
375 |
376 | -
377 |
378 |
379 | max:
380 |
381 |
382 |
383 | -
384 |
385 |
386 | -1000000
387 |
388 |
389 | 1000000
390 |
391 |
392 | 4000
393 |
394 |
395 | GLCMFeaturesValue.pixelIntensityMax
396 |
397 |
398 |
399 | -
400 |
401 |
402 | -1000000
403 |
404 |
405 | 1000000
406 |
407 |
408 | GLCMFeaturesValue.pixelIntensityMin
409 |
410 |
411 |
412 |
413 |
414 | -
415 |
416 |
417 | Neighborhood Radius:
418 |
419 |
420 |
421 | -
422 |
423 |
424 | 100
425 |
426 |
427 | 4
428 |
429 |
430 | GLCMFeaturesValue.neighborhoodRadius
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 | -
440 |
441 |
442 | true
443 |
444 |
445 | GLRLM parameters
446 |
447 |
448 | true
449 |
450 |
451 | true
452 |
453 |
454 | false
455 |
456 |
457 |
458 | QLayout::SetMinimumSize
459 |
460 |
461 | 9
462 |
463 |
-
464 |
465 |
466 | QFormLayout::AllNonFixedFieldsGrow
467 |
468 |
-
469 |
470 |
471 | Number of bins:
472 |
473 |
474 |
475 | -
476 |
477 |
478 | Voxel Intensity Range:
479 |
480 |
481 |
482 | -
483 |
484 |
485 | Distance range:
486 |
487 |
488 |
489 | -
490 |
491 |
-
492 |
493 |
494 | min:
495 |
496 |
497 |
498 | -
499 |
500 |
501 | max:
502 |
503 |
504 |
505 | -
506 |
507 |
508 | -1000000
509 |
510 |
511 | 1000000
512 |
513 |
514 | 4000
515 |
516 |
517 | GLRLMFeaturesValue.pixelIntensityMax
518 |
519 |
520 |
521 | -
522 |
523 |
524 | -1000000
525 |
526 |
527 | 1000000
528 |
529 |
530 | GLRLMFeaturesValue.pixelIntensityMin
531 |
532 |
533 |
534 |
535 |
536 | -
537 |
538 |
539 | QFormLayout::AllNonFixedFieldsGrow
540 |
541 |
-
542 |
543 |
544 | min:
545 |
546 |
547 |
548 | -
549 |
550 |
551 | max:
552 |
553 |
554 |
555 | -
556 |
557 |
558 | 1000.000000000000000
559 |
560 |
561 | 0.100000000000000
562 |
563 |
564 | 1.000000000000000
565 |
566 |
567 | GLRLMFeaturesValue.distanceMax
568 |
569 |
570 |
571 | -
572 |
573 |
574 | 5.000000000000000
575 |
576 |
577 | 0.100000000000000
578 |
579 |
580 | GLRLMFeaturesValue.distanceMin
581 |
582 |
583 |
584 |
585 |
586 | -
587 |
588 |
589 | 1
590 |
591 |
592 | 1200
593 |
594 |
595 | 10
596 |
597 |
598 | GLRLMFeaturesValue.binNumber
599 |
600 |
601 |
602 | -
603 |
604 |
605 | Neighborhood Radius:
606 |
607 |
608 |
609 | -
610 |
611 |
612 | 100
613 |
614 |
615 | 4
616 |
617 |
618 | GLRLMFeaturesValue.neighborhoodRadius
619 |
620 |
621 |
622 | -
623 |
624 |
625 | Mask "inside" value:
626 |
627 |
628 |
629 | -
630 |
631 |
632 | 1000
633 |
634 |
635 | 1
636 |
637 |
638 | 1
639 |
640 |
641 | GLRLMFeaturesValue.insideMask
642 |
643 |
644 |
645 |
646 |
647 |
648 |
649 |
650 | -
651 |
652 |
653 | BM parameters
654 |
655 |
656 | true
657 |
658 |
659 | false
660 |
661 |
662 |
-
663 |
664 |
-
665 |
666 |
667 | Threshold:
668 |
669 |
670 |
671 | -
672 |
673 |
674 | Neighborhood Radius:
675 |
676 |
677 |
678 | -
679 |
680 |
681 | -1000000
682 |
683 |
684 | 1000000
685 |
686 |
687 | 0
688 |
689 |
690 | 1
691 |
692 |
693 | BMFeaturesValue.threshold
694 |
695 |
696 |
697 | -
698 |
699 |
700 | 100
701 |
702 |
703 | 4
704 |
705 |
706 | BMFeaturesValue.neighborhoodRadius
707 |
708 |
709 |
710 |
711 |
712 |
713 |
714 |
715 |
716 |
717 |
718 | -
719 |
720 |
721 | Qt::StrongFocus
722 |
723 |
724 | Export
725 |
726 |
727 | false
728 |
729 |
730 |
-
731 |
732 |
733 |
-
734 |
735 |
736 | Output folder:
737 |
738 |
739 |
740 | -
741 |
742 |
743 | ctkPathLineEdit::Dirs|ctkPathLineEdit::Drives|ctkPathLineEdit::Executable|ctkPathLineEdit::NoDot|ctkPathLineEdit::NoDotDot|ctkPathLineEdit::PermissionMask|ctkPathLineEdit::Readable|ctkPathLineEdit::Writable
744 |
745 |
746 |
747 |
748 |
749 |
750 | -
751 |
752 |
753 | Separate feature maps
754 |
755 |
756 |
757 | -
758 |
759 |
760 | Save feature values table
761 |
762 |
763 |
764 | -
765 |
766 |
-
767 |
768 |
769 | Filename:
770 |
771 |
772 |
773 | -
774 |
775 |
776 |
777 |
778 | -
779 |
780 |
781 | Export Results
782 |
783 |
784 |
785 |
786 |
787 |
788 | -
789 |
790 |
791 | Results
792 |
793 |
794 | true
795 |
796 |
797 | false
798 |
799 |
800 |
-
801 |
802 |
803 | Feature Values
804 |
805 |
806 | true
807 |
808 |
809 |
-
810 |
811 |
812 |
813 | 0
814 | 0
815 |
816 |
817 |
818 |
819 | 0
820 | 326
821 |
822 |
823 |
824 | Qt::ScrollBarAsNeeded
825 |
826 |
827 | true
828 |
829 |
830 | QAbstractItemView::NoEditTriggers
831 |
832 |
833 | QAbstractItemView::ExtendedSelection
834 |
835 |
836 | true
837 |
838 |
839 | 100
840 |
841 |
842 | true
843 |
844 |
845 | false
846 |
847 |
848 | true
849 |
850 |
851 | true
852 |
853 |
854 |
855 | 1
856 |
857 |
858 |
859 |
860 | 2
861 |
862 |
863 |
864 |
865 | 3
866 |
867 |
868 |
869 |
870 | 4
871 |
872 |
873 |
874 |
875 | 5
876 |
877 |
878 |
879 |
880 | 6
881 |
882 |
883 |
884 |
885 | 7
886 |
887 |
888 |
889 |
890 | 8
891 |
892 |
893 |
894 |
895 | 9
896 |
897 |
898 |
899 |
900 | 10
901 |
902 |
903 |
904 |
905 | GLCM Features
906 |
907 |
908 |
909 |
910 | Values
911 |
912 |
913 |
914 |
915 | GLRLM Features
916 |
917 |
918 |
919 |
920 | Values
921 |
922 |
923 |
924 |
925 | BM Features
926 |
927 |
928 |
929 |
930 | Values
931 |
932 |
933 | -
934 |
935 | Energy
936 |
937 |
938 | -
939 |
940 | 0.0
941 |
942 |
943 | -
944 |
945 | Short Run Emphasis
946 |
947 |
948 | -
949 |
950 | 0.0
951 |
952 |
953 | -
954 |
955 | Bone Volume Density
956 |
957 |
958 | -
959 |
960 | 0.0
961 |
962 |
963 | -
964 |
965 | Entropy
966 |
967 |
968 | -
969 |
970 | 0.0
971 |
972 |
973 | -
974 |
975 | Long Run Emphasis
976 |
977 |
978 | -
979 |
980 | 0.0
981 |
982 |
983 | -
984 |
985 | Trabecular Thickness
986 |
987 |
988 | -
989 |
990 | 0.0
991 |
992 |
993 | -
994 |
995 | Correlation
996 |
997 |
998 | -
999 |
1000 | 0.0
1001 |
1002 |
1003 | -
1004 |
1005 | Grey Level Nonuniformity
1006 |
1007 |
1008 | -
1009 |
1010 | 0.0
1011 |
1012 |
1013 | -
1014 |
1015 | Trabecular Separation
1016 |
1017 |
1018 | -
1019 |
1020 | 0.0
1021 |
1022 |
1023 | -
1024 |
1025 | Inverse Difference Moment
1026 |
1027 |
1028 | -
1029 |
1030 | 0.0
1031 |
1032 |
1033 | -
1034 |
1035 | Run Length Nonuniformity
1036 |
1037 |
1038 | -
1039 |
1040 | 0.0
1041 |
1042 |
1043 | -
1044 |
1045 | Trabecular Number
1046 |
1047 |
1048 | -
1049 |
1050 | 0.0
1051 |
1052 |
1053 | -
1054 |
1055 | Inertia
1056 |
1057 |
1058 | -
1059 |
1060 | 0.0
1061 |
1062 |
1063 | -
1064 |
1065 | Low Grey Level Run Emphasis
1066 |
1067 |
1068 | -
1069 |
1070 | 0.0
1071 |
1072 |
1073 | -
1074 |
1075 | Bone Surface Density
1076 |
1077 |
1078 | -
1079 |
1080 | 0.0
1081 |
1082 |
1083 | -
1084 |
1085 | Cluster Shade
1086 |
1087 |
1088 | -
1089 |
1090 | 0.0
1091 |
1092 |
1093 | -
1094 |
1095 | High Grey Level Run Emphasis
1096 |
1097 |
1098 | -
1099 |
1100 | 0.0
1101 |
1102 |
1103 | -
1104 |
1105 | Cluster Prominence
1106 |
1107 |
1108 | -
1109 |
1110 | 0.0
1111 |
1112 |
1113 | -
1114 |
1115 | Short Run Low Grey Level Emphasis
1116 |
1117 |
1118 | -
1119 |
1120 | 0.0
1121 |
1122 |
1123 | -
1124 |
1125 | Haralick Correlation
1126 |
1127 |
1128 | -
1129 |
1130 | 0.0
1131 |
1132 |
1133 | -
1134 |
1135 | Short Run High Grey Level Emphasis
1136 |
1137 |
1138 | -
1139 |
1140 | 0.0
1141 |
1142 |
1143 | -
1144 |
1145 | Long Run Low Grey Level Emphasis
1146 |
1147 |
1148 | -
1149 |
1150 | 0.0
1151 |
1152 |
1153 | -
1154 |
1155 | Long Run High Grey Level Emphasis
1156 |
1157 |
1158 | -
1159 |
1160 | 0.0
1161 |
1162 |
1163 |
1164 |
1165 |
1166 |
1167 |
1168 | -
1169 |
1170 |
1171 | Display Colormaps
1172 |
1173 |
1174 | true
1175 |
1176 |
1177 |
-
1178 |
1179 |
1180 | Feature set:
1181 |
1182 |
1183 |
1184 | -
1185 |
1186 |
1187 | Feature:
1188 |
1189 |
1190 |
1191 | -
1192 |
1193 |
1194 | -
1195 |
1196 |
1197 |
1198 |
1199 |
1200 |
1201 |
1202 |
1203 | -
1204 |
1205 |
1206 | Compute Texture Maps
1207 |
1208 |
1209 |
1210 | -
1211 |
1212 |
1213 |
1214 | 0
1215 | 0
1216 |
1217 |
1218 |
1219 | 24
1220 |
1221 |
1222 |
1223 | -
1224 |
1225 |
1226 | Compute Texture Feature Set
1227 |
1228 |
1229 |
1230 | -
1231 |
1232 |
1233 |
1234 | 0
1235 | 0
1236 |
1237 |
1238 |
1239 | 24
1240 |
1241 |
1242 |
1243 | -
1244 |
1245 |
1246 | Qt::Vertical
1247 |
1248 |
1249 |
1250 | 20
1251 | 40
1252 |
1253 |
1254 |
1255 |
1256 |
1257 |
1258 |
1259 |
1260 | qMRMLNodeComboBox
1261 | QWidget
1262 |
1263 |
1264 |
1265 | qMRMLWidget
1266 | QWidget
1267 |
1268 | 1
1269 |
1270 |
1271 | ctkCollapsibleButton
1272 | QWidget
1273 |
1274 | 1
1275 |
1276 |
1277 | ctkCollapsibleGroupBox
1278 | QGroupBox
1279 |
1280 | 1
1281 |
1282 |
1283 | ctkPathLineEdit
1284 | QWidget
1285 |
1286 |
1287 |
1288 |
1289 |
1290 |
1291 | BoneTexture
1292 | mrmlSceneChanged(vtkMRMLScene*)
1293 | inputScanComboBox
1294 | setMRMLScene(vtkMRMLScene*)
1295 |
1296 |
1297 | 122
1298 | 132
1299 |
1300 |
1301 | 248
1302 | 61
1303 |
1304 |
1305 |
1306 |
1307 | BoneTexture
1308 | mrmlSceneChanged(vtkMRMLScene*)
1309 | inputSegmentationComboBox
1310 | setMRMLScene(vtkMRMLScene*)
1311 |
1312 |
1313 | 130
1314 | 331
1315 |
1316 |
1317 | 182
1318 | 252
1319 |
1320 |
1321 |
1322 |
1323 |
1324 |
--------------------------------------------------------------------------------
/BoneTexture/Testing/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(Python)
2 |
--------------------------------------------------------------------------------
/BoneTexture/Testing/Python/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | #slicer_add_python_unittest(SCRIPT ${MODULE_NAME}ModuleTest.py)
3 |
--------------------------------------------------------------------------------
/BoneTextureExtension.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kitware/BoneTextureExtension/3410506efaa404131f7b02aa70769f537b1f2b3d/BoneTextureExtension.png
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.16.3)
2 |
3 | project(BoneTextureExtension)
4 |
5 | #-----------------------------------------------------------------------------
6 | # Extension meta-information
7 | set(EXTENSION_HOMEPAGE "https://www.slicer.org/wiki/Documentation/Nightly/Extensions/BoneTextureExtension")
8 | set(EXTENSION_CATEGORY "Quantification")
9 | set(EXTENSION_CONTRIBUTORS "Jean-Baptiste VIMORT (Kitware Inc.)")
10 | set(EXTENSION_DESCRIPTION "This extensions contain several modules that can be used to compute feature maps of N-Dimensional images using well-known texture analysis methods. Key Features: 8 coocurrence textural features: energy, entropy, correlation, inertia, cluster Shade... / 10 run length textural features: run length emphasis, grey level non uniformity, run length non uniformity, low grey level long run emphasis... / Input configurable parameters: locality of the texture, offset directions for co-ocurrence and run length computation, the number of bins for the intensity histograms, and the intensity range or the range of run lengths.")
11 | set(EXTENSION_ICONURL "https://www.slicer.org/w/img_auth.php/0/09/Logo-BoneTextureExtension.png")
12 | set(EXTENSION_SCREENSHOTURLS "https://www.slicer.org/w/img_auth.php/7/70/BoneTextureExtension-Slicer.png")
13 | set(EXTENSION_DEPENDS "NA") # Specified as a list or "NA" if no dependencies
14 | set(EXTENSION_BUILD_SUBDIRECTORY inner-build)
15 |
16 | set(SUPERBUILD_TOPLEVEL_PROJECT inner)
17 |
18 | #-----------------------------------------------------------------------------
19 | # Extension dependencies
20 | find_package(Slicer REQUIRED)
21 | include(${Slicer_USE_FILE})
22 | mark_as_superbuild(Slicer_DIR)
23 |
24 | find_package(Git REQUIRED)
25 | mark_as_superbuild(GIT_EXECUTABLE)
26 |
27 | #-----------------------------------------------------------------------------
28 | # SuperBuild setup
29 | option(${EXTENSION_NAME}_SUPERBUILD "Build ${EXTENSION_NAME} and the projects it depends on." ON)
30 | mark_as_advanced(${EXTENSION_NAME}_SUPERBUILD)
31 | if(${EXTENSION_NAME}_SUPERBUILD)
32 | include("${CMAKE_CURRENT_SOURCE_DIR}/SuperBuild.cmake")
33 | return()
34 | endif()
35 |
36 | #-----------------------------------------------------------------------------
37 | # Extension modules
38 | add_subdirectory(ComputeGLCMFeatures)
39 | add_subdirectory(ComputeGLRLMFeatures)
40 | add_subdirectory(ComputeBMFeatures)
41 | add_subdirectory(ComputeGLCMFeatureMaps)
42 | add_subdirectory(ComputeGLRLMFeatureMaps)
43 | add_subdirectory(ComputeBMFeatureMaps)
44 | add_subdirectory(BoneTexture)
45 | add_subdirectory(SeparateVectorImage)
46 | add_subdirectory(SaveVectorImageAsCSV)
47 | add_subdirectory(CreateLabelMapFromCSV)
48 |
49 | #-----------------------------------------------------------------------------
50 | set(EXTENSION_CPACK_INSTALL_CMAKE_PROJECTS)
51 | set(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ITKBoneMorphometry_DIR};ITKBoneMorphometry;RuntimeLibraries;/")
52 | set(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ITKTextureFeature_DIR};ITKTextureFeature;RuntimeLibraries;/")
53 | set(${EXTENSION_NAME}_CPACK_INSTALL_CMAKE_PROJECTS "${EXTENSION_CPACK_INSTALL_CMAKE_PROJECTS}" CACHE STRING "List of external projects to install" FORCE)
54 |
55 | #-----------------------------------------------------------------------------
56 | list(APPEND CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR};${EXTENSION_NAME};ALL;/")
57 | list(APPEND CPACK_INSTALL_CMAKE_PROJECTS "${${EXTENSION_NAME}_CPACK_INSTALL_CMAKE_PROJECTS}")
58 | include(${Slicer_EXTENSION_GENERATE_CONFIG})
59 | include(${Slicer_EXTENSION_CPACK})
60 |
--------------------------------------------------------------------------------
/ComputeBMFeatureMaps/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #-----------------------------------------------------------------------------
2 | set(MODULE_NAME ComputeBMFeatureMaps)
3 |
4 | #-----------------------------------------------------------------------------
5 |
6 | #
7 | # SlicerExecutionModel
8 | #
9 | find_package(SlicerExecutionModel REQUIRED)
10 | include(${SlicerExecutionModel_USE_FILE})
11 |
12 | #
13 | # ITK
14 | #
15 | set(${PROJECT_NAME}_ITK_COMPONENTS
16 | ITKIOImageBase
17 | ITKCommon
18 | ITKStatistics
19 | ITKImageGrid
20 | ITKImageSources
21 | ITKTestKernel
22 | ITKMetaIO
23 | ITKImageIntensity
24 | BoneMorphometry
25 | )
26 | find_package(ITK 4.9 COMPONENTS ${${PROJECT_NAME}_ITK_COMPONENTS} REQUIRED)
27 | if(ITK_VERSION VERSION_GREATER_EQUAL "5.3")
28 | foreach(factory_uc IN ITEMS "IMAGEIO" "MESHIO" "TRANSFORMIO")
29 | set(ITK_NO_${factory_uc}_FACTORY_REGISTER_MANAGER 1)
30 | endforeach()
31 | else()
32 | set(ITK_NO_IO_FACTORY_REGISTER_MANAGER 1) # See Libs/ITKFactoryRegistration/CMakeLists.txt
33 | endif()
34 | include(${ITK_USE_FILE})
35 |
36 | #-----------------------------------------------------------------------------
37 | set(MODULE_INCLUDE_DIRECTORIES
38 | ${CMAKE_CURRENT_SOURCE_DIR}/../include
39 | )
40 |
41 | set(MODULE_SRCS
42 | )
43 |
44 | set(MODULE_TARGET_LIBRARIES
45 | ${ITK_LIBRARIES}
46 | )
47 |
48 | #-----------------------------------------------------------------------------
49 | SEMMacroBuildCLI(
50 | NAME ${MODULE_NAME}
51 | TARGET_LIBRARIES ${MODULE_TARGET_LIBRARIES}
52 | INCLUDE_DIRECTORIES ${MODULE_INCLUDE_DIRECTORIES}
53 | ADDITIONAL_SRCS ${MODULE_SRCS}
54 | )
55 |
56 | #-----------------------------------------------------------------------------
57 | if(BUILD_TESTING)
58 | add_subdirectory(Testing)
59 | endif()
60 |
--------------------------------------------------------------------------------
/ComputeBMFeatureMaps/ComputeBMFeatureMaps.cxx:
--------------------------------------------------------------------------------
1 | /*=========================================================================
2 | *
3 | * Copyright Insight Software Consortium
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0.txt
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | *
17 | *=========================================================================*/
18 |
19 |
20 | // Use an anonymous namespace to keep class types and function names
21 | // from colliding when module is used as shared object module. Every
22 | // thing should be in an anonymous namespace except for the module
23 | // entry point, e.g. main()
24 | //
25 |
26 | #include "itkImageFileReader.h"
27 | #include "itkImageFileWriter.h"
28 | #include "itkFloatingPointExceptions.h"
29 | #include "itkImage.h"
30 | #include "itkVector.h"
31 | #include "itkNeighborhood.h"
32 | #include "itkMetaDataDictionary.h"
33 | #include "itkMetaDataObject.h"
34 |
35 | #include "itkBoneMorphometryFeaturesImageFilter.h"
36 | #include "itkReplaceFeatureMapNanInfImageFilter.h"
37 |
38 | #include "itkPluginUtilities.h"
39 |
40 | #include "ComputeBMFeatureMapsCLP.h"
41 |
42 | namespace
43 | {
44 |
45 | template< typename TPixel >
46 | int DoIt( int argc, char * argv[] )
47 | {
48 | PARSE_ARGS;
49 |
50 | const unsigned int Dimension = 3;
51 |
52 | typedef TPixel PixelType;
53 | typedef itk::Image< PixelType, Dimension > InputImageType;
54 | typedef itk::VectorImage< float, Dimension > OutputImageType;
55 |
56 | typedef itk::Neighborhood NeighborhoodType;
57 | NeighborhoodType hood;
58 |
59 | typedef itk::ImageFileReader< InputImageType > ReaderType;
60 | typename ReaderType::Pointer reader = ReaderType::New();
61 | reader->SetFileName( inputVolume );
62 | reader->Update();
63 |
64 | typedef itk::BoneMorphometryFeaturesImageFilter FilterType;
65 | typename FilterType::Pointer filter = FilterType::New();
66 | filter->SetInput(reader->GetOutput());
67 |
68 | if(inputMask != "")
69 | {
70 | typename ReaderType::Pointer maskReader = ReaderType::New();
71 | maskReader->SetFileName( inputMask );
72 | maskReader->Update();
73 | filter->SetMaskImage(maskReader->GetOutput());
74 | }
75 |
76 | hood.SetRadius(neighborhoodRadius);
77 | filter->SetNeighborhoodRadius(hood.GetRadius());
78 | filter->SetThreshold( threshold );
79 | filter->Update();
80 |
81 | typedef itk::ReplaceFeatureMapNanInfImageFilter PostProcessingFilterType;
82 | PostProcessingFilterType::Pointer postProcessingFilter = PostProcessingFilterType::New();
83 |
84 | postProcessingFilter->SetInput( filter->GetOutput() );
85 | postProcessingFilter->Update();
86 |
87 | itk::MetaDataDictionary dictionary;
88 | itk::EncapsulateMetaData(dictionary,"DWMRI_b-value","1.0");
89 | itk::EncapsulateMetaData(dictionary,"modality","DWMRI");
90 | postProcessingFilter->GetOutput()->SetMetaDataDictionary(dictionary);
91 |
92 | typedef itk::ImageFileWriter< OutputImageType > WriterType;
93 | typename WriterType::Pointer writer = WriterType::New();
94 | writer->SetFileName( outputVolume );
95 | writer->SetInput( postProcessingFilter->GetOutput() );
96 | writer->SetUseCompression( true );
97 | writer->Update();
98 |
99 | return EXIT_SUCCESS;
100 | }
101 |
102 | } // end of anonymous namespace
103 |
104 | int main( int argc, char * argv[] )
105 | {
106 | PARSE_ARGS;
107 |
108 | itk::ImageIOBase::IOPixelType inputPixelType;
109 | itk::ImageIOBase::IOComponentType inputComponentType;
110 | itk::FloatingPointExceptions::Enable();
111 | itk::FloatingPointExceptions::SetExceptionAction( itk::FloatingPointExceptions::ABORT );
112 |
113 | try
114 | {
115 |
116 | itk::GetImageType(inputVolume, inputPixelType, inputComponentType);
117 |
118 | switch( inputComponentType )
119 | {
120 | case itk::ImageIOBase::UCHAR:
121 | return DoIt< int >( argc, argv );
122 | break;
123 | case itk::ImageIOBase::USHORT:
124 | return DoIt< int >( argc, argv );
125 | break;
126 | case itk::ImageIOBase::SHORT:
127 | return DoIt< int >( argc, argv );
128 | break;
129 | case itk::ImageIOBase::FLOAT:
130 | return DoIt< float >( argc, argv );
131 | break;
132 | case itk::ImageIOBase::INT:
133 | return DoIt< int >( argc, argv );
134 | break;
135 | default:
136 | std::cerr << "Unknown input image pixel component type: "
137 | << itk::ImageIOBase::GetComponentTypeAsString( inputComponentType )
138 | << std::endl;
139 | return EXIT_FAILURE;
140 | break;
141 | }
142 | }
143 | catch( itk::ExceptionObject & excep )
144 | {
145 | std::cerr << argv[0] << ": exception caught !" << std::endl;
146 | std::cerr << excep << std::endl;
147 | return EXIT_FAILURE;
148 | }
149 | return EXIT_SUCCESS;
150 | }
151 |
--------------------------------------------------------------------------------
/ComputeBMFeatureMaps/ComputeBMFeatureMaps.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Quantification.Bone Morphometry Features
4 | Compute BM Feature Maps
5 | 1.0
6 | http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/ComputeBMFeatureMaps
7 |
8 | Jean-Baptiste Vimort, Kitware Inc.
9 | This work was supported by the National Institute of Health (NIH) National Institute for Dental and Craniofacial Research (NIDCR) R01EB021391 (Textural Biomarkers of Arthritis for the Subchondral Bone in the Temporomandibular Joint)
10 |
11 |
12 | Input/output parameters
13 |
14 | inputVolume
15 |
16 | input
17 | 0
18 | Input Volume
19 |
20 |
21 | outputVolume
22 |
23 | output
24 | 1
25 | Output Volume
26 |
27 |
28 | inputMask
29 |
30 | inputMask
31 | input
32 | s
33 | A mask defining the region over which texture features will be calculated
34 |
35 |
36 |
37 | threshold
38 |
39 | threshold
40 | t
41 | The threshold that will separate the inside and outside of the Bone (everything superior to the threshold is considered as part of the bone)
42 | 1
43 |
44 |
45 | neighborhoodRadius
46 |
47 | neighborhoodRadius
48 | n
49 | The size of the neighborhood radius
50 | 4
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/ComputeBMFeatureMaps/Testing/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(Cxx)
2 |
--------------------------------------------------------------------------------
/ComputeBMFeatureMaps/Testing/Cxx/CMakeLists.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kitware/BoneTextureExtension/3410506efaa404131f7b02aa70769f537b1f2b3d/ComputeBMFeatureMaps/Testing/Cxx/CMakeLists.txt
--------------------------------------------------------------------------------
/ComputeBMFeatures/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #-----------------------------------------------------------------------------
2 | set(MODULE_NAME ComputeBMFeatures)
3 |
4 | #-----------------------------------------------------------------------------
5 |
6 | #
7 | # SlicerExecutionModel
8 | #
9 | find_package(SlicerExecutionModel REQUIRED)
10 | include(${SlicerExecutionModel_USE_FILE})
11 |
12 | #
13 | # ITK
14 | #
15 | set(${PROJECT_NAME}_ITK_COMPONENTS
16 | ITKIOImageBase
17 | ITKCommon
18 | ITKStatistics
19 | ITKImageGrid
20 | ITKImageSources
21 | ITKTestKernel
22 | ITKMetaIO
23 | ITKImageIntensity
24 | BoneMorphometry
25 | )
26 | find_package(ITK 4.9 COMPONENTS ${${PROJECT_NAME}_ITK_COMPONENTS} REQUIRED)
27 | if(ITK_VERSION VERSION_GREATER_EQUAL "5.3")
28 | foreach(factory_uc IN ITEMS "IMAGEIO" "MESHIO" "TRANSFORMIO")
29 | set(ITK_NO_${factory_uc}_FACTORY_REGISTER_MANAGER 1)
30 | endforeach()
31 | else()
32 | set(ITK_NO_IO_FACTORY_REGISTER_MANAGER 1) # See Libs/ITKFactoryRegistration/CMakeLists.txt
33 | endif()
34 | include(${ITK_USE_FILE})
35 |
36 | #-----------------------------------------------------------------------------
37 | set(MODULE_INCLUDE_DIRECTORIES
38 | ${CMAKE_CURRENT_SOURCE_DIR}/../include
39 | )
40 |
41 | set(MODULE_SRCS
42 | )
43 |
44 | set(MODULE_TARGET_LIBRARIES
45 | ${ITK_LIBRARIES}
46 | )
47 |
48 | #-----------------------------------------------------------------------------
49 | SEMMacroBuildCLI(
50 | NAME ${MODULE_NAME}
51 | TARGET_LIBRARIES ${MODULE_TARGET_LIBRARIES}
52 | INCLUDE_DIRECTORIES ${MODULE_INCLUDE_DIRECTORIES}
53 | ADDITIONAL_SRCS ${MODULE_SRCS}
54 | )
55 |
56 | #-----------------------------------------------------------------------------
57 | if(BUILD_TESTING)
58 | add_subdirectory(Testing)
59 | endif()
60 |
--------------------------------------------------------------------------------
/ComputeBMFeatures/ComputeBMFeatures.cxx:
--------------------------------------------------------------------------------
1 | /*=========================================================================
2 | *
3 | * Copyright Insight Software Consortium
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0.txt
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | *
17 | *=========================================================================*/
18 |
19 |
20 | // Use an anonymous namespace to keep class types and function names
21 | // from colliding when module is used as shared object module. Every
22 | // thing should be in an anonymous namespace except for the module
23 | // entry point, e.g. main()
24 | //
25 |
26 | #include "itkImageFileReader.h"
27 | #include "itkImageFileWriter.h"
28 | #include "itkFloatingPointExceptions.h"
29 | #include "itkImage.h"
30 | #include "itkVector.h"
31 | #include "itkNeighborhood.h"
32 | #include "itkMetaDataDictionary.h"
33 | #include "itkMetaDataObject.h"
34 |
35 | #include "itkBoneMorphometryFeaturesFilter.h"
36 |
37 | #include "itkPluginUtilities.h"
38 |
39 | #include "ComputeBMFeaturesCLP.h"
40 |
41 | namespace
42 | {
43 |
44 | template< typename TPixel >
45 | int DoIt( int argc, char * argv[] )
46 | {
47 | PARSE_ARGS;
48 |
49 | const unsigned int Dimension = 3;
50 |
51 | typedef TPixel PixelType;
52 | typedef itk::Image< PixelType, Dimension > InputImageType;
53 |
54 | typedef itk::ImageFileReader< InputImageType > ReaderType;
55 | typename ReaderType::Pointer reader = ReaderType::New();
56 | reader->SetFileName( inputVolume );
57 | reader->Update();
58 |
59 | typedef itk::BoneMorphometryFeaturesFilter FilterType;
60 | typename FilterType::Pointer filter = FilterType::New();
61 | filter->SetInput(reader->GetOutput());
62 |
63 | if(inputMask != "")
64 | {
65 | typename ReaderType::Pointer maskReader = ReaderType::New();
66 | maskReader->SetFileName( inputMask );
67 | maskReader->Update();
68 | filter->SetMaskImage(maskReader->GetOutput());
69 | }
70 |
71 | filter->SetThreshold( threshold );
72 | filter->Update();
73 |
74 | std::ofstream rts;
75 | rts.open(returnParameterFile.c_str() );
76 | rts << "outputVector = "<GetBVTV()<<","
77 | <GetTbTh()<<","
78 | <GetTbSp()<<","
79 | <GetTbN()<<","
80 | <GetBSBV()<< std::endl;
81 | rts<<"BVTV = "<< filter->GetBVTV() << std::endl;
82 | rts<<"TbTh = "<< filter->GetTbTh() << std::endl;
83 | rts<<"TbSp = "<< filter->GetTbSp() << std::endl;
84 | rts<<"TbN = "<< filter->GetTbN() << std::endl;
85 | rts<<"BSBV = "<< filter->GetBSBV() << std::endl;
86 |
87 | return EXIT_SUCCESS;
88 | }
89 |
90 | } // end of anonymous namespace
91 |
92 | int main( int argc, char * argv[] )
93 | {
94 | PARSE_ARGS;
95 |
96 | itk::ImageIOBase::IOPixelType inputPixelType;
97 | itk::ImageIOBase::IOComponentType inputComponentType;
98 | itk::FloatingPointExceptions::Enable();
99 | itk::FloatingPointExceptions::SetExceptionAction( itk::FloatingPointExceptions::ABORT );
100 |
101 | try
102 | {
103 |
104 | itk::GetImageType(inputVolume, inputPixelType, inputComponentType);
105 |
106 | switch( inputComponentType )
107 | {
108 | case itk::ImageIOBase::UCHAR:
109 | return DoIt< int >( argc, argv );
110 | break;
111 | case itk::ImageIOBase::USHORT:
112 | return DoIt< int >( argc, argv );
113 | break;
114 | case itk::ImageIOBase::SHORT:
115 | return DoIt< int >( argc, argv );
116 | break;
117 | case itk::ImageIOBase::FLOAT:
118 | return DoIt< float >( argc, argv );
119 | break;
120 | case itk::ImageIOBase::INT:
121 | return DoIt< int >( argc, argv );
122 | break;
123 | default:
124 | std::cerr << "Unknown input image pixel component type: "
125 | << itk::ImageIOBase::GetComponentTypeAsString( inputComponentType )
126 | << std::endl;
127 | return EXIT_FAILURE;
128 | break;
129 | }
130 | }
131 | catch( itk::ExceptionObject & excep )
132 | {
133 | std::cerr << argv[0] << ": exception caught !" << std::endl;
134 | std::cerr << excep << std::endl;
135 | return EXIT_FAILURE;
136 | }
137 | return EXIT_SUCCESS;
138 | }
139 |
--------------------------------------------------------------------------------
/ComputeBMFeatures/ComputeBMFeatures.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Quantification.Bone Morphometry Features
4 | Compute BM Features
5 | 1.0
6 | http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/ComputeGLRLMFeatures
7 |
8 | Jean-Baptiste Vimort, Kitware Inc.
9 | This work was supported by the National Institute of Health (NIH) National Institute for Dental and Craniofacial Research (NIDCR) R01EB021391 (Textural Biomarkers of Arthritis for the Subchondral Bone in the Temporomandibular Joint)
10 |
11 |
12 |
13 | inputVolume
14 |
15 | input
16 | 0
17 | Input Volume
18 |
19 |
20 | inputMask
21 |
22 | inputMask
23 | input
24 | s
25 | A mask defining the region over which texture features will be calculated
26 |
27 |
28 |
29 | threshold
30 |
31 | threshold
32 | t
33 | The threshold that will separate the inside and outside of the Bone (everything superior to the threshold is considered as part of the bone)
34 | 1
35 |
36 |
37 |
38 |
39 | Output parameters
40 |
41 | BVTV
42 |
43 | output
44 |
45 |
46 | TbTh
47 |
48 | output
49 |
50 |
51 | TbSp
52 |
53 | output
54 |
55 |
56 | TbN
57 |
58 | output
59 |
60 |
61 | BSBV
62 |
63 | output
64 |
65 |
66 |
67 |
68 | Advanced parameters
69 |
70 | outputVector
71 |
72 | output
73 | Output Vector
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/ComputeBMFeatures/Testing/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(Cxx)
2 |
--------------------------------------------------------------------------------
/ComputeBMFeatures/Testing/Cxx/CMakeLists.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kitware/BoneTextureExtension/3410506efaa404131f7b02aa70769f537b1f2b3d/ComputeBMFeatures/Testing/Cxx/CMakeLists.txt
--------------------------------------------------------------------------------
/ComputeGLCMFeatureMaps/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #-----------------------------------------------------------------------------
2 | set(MODULE_NAME ComputeGLCMFeatureMaps)
3 |
4 | #-----------------------------------------------------------------------------
5 |
6 | #
7 | # SlicerExecutionModel
8 | #
9 | find_package(SlicerExecutionModel REQUIRED)
10 | include(${SlicerExecutionModel_USE_FILE})
11 |
12 | #
13 | # ITK
14 | #
15 | set(${PROJECT_NAME}_ITK_COMPONENTS
16 | ITKIOImageBase
17 | ITKCommon
18 | ITKStatistics
19 | ITKImageGrid
20 | ITKImageSources
21 | ITKTestKernel
22 | ITKMetaIO
23 | ITKImageIntensity
24 | TextureFeatures
25 | )
26 | find_package(ITK 4.9 COMPONENTS ${${PROJECT_NAME}_ITK_COMPONENTS} REQUIRED)
27 | if(ITK_VERSION VERSION_GREATER_EQUAL "5.3")
28 | foreach(factory_uc IN ITEMS "IMAGEIO" "MESHIO" "TRANSFORMIO")
29 | set(ITK_NO_${factory_uc}_FACTORY_REGISTER_MANAGER 1)
30 | endforeach()
31 | else()
32 | set(ITK_NO_IO_FACTORY_REGISTER_MANAGER 1) # See Libs/ITKFactoryRegistration/CMakeLists.txt
33 | endif()
34 | include(${ITK_USE_FILE})
35 |
36 | #-----------------------------------------------------------------------------
37 | set(MODULE_INCLUDE_DIRECTORIES
38 | ${CMAKE_CURRENT_SOURCE_DIR}/../include
39 | )
40 |
41 | set(MODULE_SRCS
42 | )
43 |
44 | set(MODULE_TARGET_LIBRARIES
45 | ${ITK_LIBRARIES}
46 | )
47 |
48 | #-----------------------------------------------------------------------------
49 | SEMMacroBuildCLI(
50 | NAME ${MODULE_NAME}
51 | TARGET_LIBRARIES ${MODULE_TARGET_LIBRARIES}
52 | INCLUDE_DIRECTORIES ${MODULE_INCLUDE_DIRECTORIES}
53 | ADDITIONAL_SRCS ${MODULE_SRCS}
54 | )
55 |
56 | #-----------------------------------------------------------------------------
57 | if(BUILD_TESTING)
58 | add_subdirectory(Testing)
59 | endif()
60 |
--------------------------------------------------------------------------------
/ComputeGLCMFeatureMaps/ComputeGLCMFeatureMaps.cxx:
--------------------------------------------------------------------------------
1 | /*=========================================================================
2 | *
3 | * Copyright Insight Software Consortium
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0.txt
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | *
17 | *=========================================================================*/
18 |
19 |
20 | // Use an anonymous namespace to keep class types and function names
21 | // from colliding when module is used as shared object module. Every
22 | // thing should be in an anonymous namespace except for the module
23 | // entry point, e.g. main()
24 | //
25 |
26 | #include "itkImageFileReader.h"
27 | #include "itkImageFileWriter.h"
28 | #include "itkFloatingPointExceptions.h"
29 | #include "itkImage.h"
30 | #include "itkVector.h"
31 | #include "itkNeighborhood.h"
32 | #include "itkMetaDataDictionary.h"
33 | #include "itkMetaDataObject.h"
34 |
35 | #include "itkCoocurrenceTextureFeaturesImageFilter.h"
36 |
37 | #include "itkPluginUtilities.h"
38 |
39 | #include "ComputeGLCMFeatureMapsCLP.h"
40 |
41 | namespace
42 | {
43 |
44 | template< typename TPixel >
45 | int DoIt( int argc, char * argv[] )
46 | {
47 | PARSE_ARGS;
48 |
49 | const unsigned int Dimension = 3;
50 |
51 | typedef TPixel PixelType;
52 | typedef itk::Image< PixelType, Dimension > InputImageType;
53 | typedef itk::VectorImage< float, Dimension > OutputImageType;
54 |
55 | typedef itk::Neighborhood NeighborhoodType;
56 | NeighborhoodType hood;
57 |
58 | typedef itk::ImageFileReader< InputImageType > ReaderType;
59 | typename ReaderType::Pointer reader = ReaderType::New();
60 | reader->SetFileName( inputVolume );
61 | reader->Update();
62 |
63 | typedef itk::Statistics::CoocurrenceTextureFeaturesImageFilter< InputImageType, OutputImageType, InputImageType > FilterType;
64 | typename FilterType::Pointer filter = FilterType::New();
65 | filter->SetInput(reader->GetOutput());
66 |
67 | if(inputMask != "")
68 | {
69 | typename ReaderType::Pointer maskReader = ReaderType::New();
70 | maskReader->SetFileName( inputMask );
71 | maskReader->Update();
72 | filter->SetMaskImage(maskReader->GetOutput());
73 | }
74 |
75 | filter->SetInsidePixelValue(insideMask);
76 | filter->SetNumberOfBinsPerAxis(binNumber);
77 | hood.SetRadius(neighborhoodRadius);
78 | filter->SetNeighborhoodRadius(hood.GetRadius());
79 | filter->SetHistogramMinimum( pixelIntensityMin );
80 | filter->SetHistogramMaximum( pixelIntensityMax );
81 | filter->Update();
82 |
83 | itk::MetaDataDictionary dictionary;
84 | itk::EncapsulateMetaData(dictionary,"DWMRI_b-value","1.0");
85 | itk::EncapsulateMetaData(dictionary,"modality","DWMRI");
86 | filter->GetOutput()->SetMetaDataDictionary(dictionary);
87 |
88 | typedef itk::ImageFileWriter< OutputImageType > WriterType;
89 | typename WriterType::Pointer writer = WriterType::New();
90 | writer->SetFileName( outputVolume );
91 | writer->SetInput( filter->GetOutput() );
92 | writer->SetUseCompression( true );
93 | writer->Update();
94 |
95 | return EXIT_SUCCESS;
96 | }
97 |
98 | } // end of anonymous namespace
99 |
100 | int main( int argc, char * argv[] )
101 | {
102 | PARSE_ARGS;
103 |
104 | itk::ImageIOBase::IOPixelType inputPixelType;
105 | itk::ImageIOBase::IOComponentType inputComponentType;
106 | itk::FloatingPointExceptions::Enable();
107 | itk::FloatingPointExceptions::SetExceptionAction( itk::FloatingPointExceptions::ABORT );
108 |
109 | try
110 | {
111 |
112 | itk::GetImageType(inputVolume, inputPixelType, inputComponentType);
113 |
114 | switch( inputComponentType )
115 | {
116 | case itk::ImageIOBase::UCHAR:
117 | return DoIt< int >( argc, argv );
118 | break;
119 | case itk::ImageIOBase::USHORT:
120 | return DoIt< int >( argc, argv );
121 | break;
122 | case itk::ImageIOBase::SHORT:
123 | return DoIt< int >( argc, argv );
124 | break;
125 | case itk::ImageIOBase::FLOAT:
126 | return DoIt< float >( argc, argv );
127 | break;
128 | case itk::ImageIOBase::INT:
129 | return DoIt< int >( argc, argv );
130 | break;
131 | default:
132 | std::cerr << "Unknown input image pixel component type: "
133 | << itk::ImageIOBase::GetComponentTypeAsString( inputComponentType )
134 | << std::endl;
135 | return EXIT_FAILURE;
136 | break;
137 | }
138 | }
139 | catch( itk::ExceptionObject & excep )
140 | {
141 | std::cerr << argv[0] << ": exception caught !" << std::endl;
142 | std::cerr << excep << std::endl;
143 | return EXIT_FAILURE;
144 | }
145 | return EXIT_SUCCESS;
146 | }
147 |
--------------------------------------------------------------------------------
/ComputeGLCMFeatureMaps/ComputeGLCMFeatureMaps.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Quantification.Texture Features
4 | Compute GLCM Feature Maps
5 | 1.0
6 | http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/ComputeGLCMFeatureMaps
7 |
8 | Jean-Baptiste Vimort, Kitware Inc.
9 | This work was supported by the National Institute of Health (NIH) National Institute for Dental and Craniofacial Research (NIDCR) R01EB021391 (Textural Biomarkers of Arthritis for the Subchondral Bone in the Temporomandibular Joint)
10 |
11 |
12 | Input/output parameters
13 |
14 | inputVolume
15 |
16 | input
17 | 0
18 | Input Volume
19 |
20 |
21 | outputVolume
22 |
23 | output
24 | 1
25 | Output Volume
26 |
27 |
28 | inputMask
29 |
30 | inputMask
31 | input
32 | s
33 | A mask defining the region over which texture features will be calculated
34 |
35 |
36 |
37 | insideMask
38 |
39 | insideMask
40 | i
41 | The pixel value that defines the ”inside” of the mask
42 | 1
43 |
44 |
45 | binNumber
46 |
47 | binNumber
48 | b
49 | The number of intensity bins
50 | 10
51 |
52 |
53 | neighborhoodRadius
54 |
55 | neighborhoodRadius
56 | n
57 | The size of the neighborhood radius
58 | 4
59 |
60 |
61 | pixelIntensityMin
62 |
63 | pixelIntensityMin
64 | p
65 | Minnimum of the pixel intensity range over which the features will be calculated
66 | 0
67 |
68 |
69 | pixelIntensityMax
70 |
71 | pixelIntensityMax
72 | P
73 | Maximum of the pixel intensity range over which the features will be calculated
74 | 4000
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/ComputeGLCMFeatureMaps/Testing/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(Cxx)
2 |
--------------------------------------------------------------------------------
/ComputeGLCMFeatureMaps/Testing/Cxx/CMakeLists.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kitware/BoneTextureExtension/3410506efaa404131f7b02aa70769f537b1f2b3d/ComputeGLCMFeatureMaps/Testing/Cxx/CMakeLists.txt
--------------------------------------------------------------------------------
/ComputeGLCMFeatures/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #-----------------------------------------------------------------------------
2 | set(MODULE_NAME ComputeGLCMFeatures)
3 |
4 | #-----------------------------------------------------------------------------
5 |
6 | #
7 | # SlicerExecutionModel
8 | #
9 | find_package(SlicerExecutionModel REQUIRED)
10 | include(${SlicerExecutionModel_USE_FILE})
11 |
12 | #
13 | # ITK
14 | #
15 | set(${PROJECT_NAME}_ITK_COMPONENTS
16 | ITKIOImageBase
17 | ITKCommon
18 | ITKStatistics
19 | ITKImageGrid
20 | ITKImageSources
21 | ITKTestKernel
22 | ITKMetaIO
23 | ITKImageIntensity
24 | )
25 | find_package(ITK 4.9 COMPONENTS ${${PROJECT_NAME}_ITK_COMPONENTS} REQUIRED)
26 | if(ITK_VERSION VERSION_GREATER_EQUAL "5.3")
27 | foreach(factory_uc IN ITEMS "IMAGEIO" "MESHIO" "TRANSFORMIO")
28 | set(ITK_NO_${factory_uc}_FACTORY_REGISTER_MANAGER 1)
29 | endforeach()
30 | else()
31 | set(ITK_NO_IO_FACTORY_REGISTER_MANAGER 1) # See Libs/ITKFactoryRegistration/CMakeLists.txt
32 | endif()
33 | include(${ITK_USE_FILE})
34 |
35 | #-----------------------------------------------------------------------------
36 | set(MODULE_INCLUDE_DIRECTORIES
37 | ${CMAKE_CURRENT_SOURCE_DIR}/../include
38 | )
39 |
40 | set(MODULE_SRCS
41 | )
42 |
43 | set(MODULE_TARGET_LIBRARIES
44 | ${ITK_LIBRARIES}
45 | )
46 |
47 | #-----------------------------------------------------------------------------
48 | SEMMacroBuildCLI(
49 | NAME ${MODULE_NAME}
50 | TARGET_LIBRARIES ${MODULE_TARGET_LIBRARIES}
51 | INCLUDE_DIRECTORIES ${MODULE_INCLUDE_DIRECTORIES}
52 | ADDITIONAL_SRCS ${MODULE_SRCS}
53 | )
54 |
55 | #-----------------------------------------------------------------------------
56 | if(BUILD_TESTING)
57 | add_subdirectory(Testing)
58 | endif()
59 |
--------------------------------------------------------------------------------
/ComputeGLCMFeatures/ComputeGLCMFeatures.cxx:
--------------------------------------------------------------------------------
1 | /*=========================================================================
2 | *
3 | * Copyright Insight Software Consortium
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0.txt
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | *
17 | *=========================================================================*/
18 |
19 |
20 | // Use an anonymous namespace to keep class types and function names
21 | // from colliding when module is used as shared object module. Every
22 | // thing should be in an anonymous namespace except for the module
23 | // entry point, e.g. main()
24 | //
25 |
26 | #include "itkImageFileReader.h"
27 | #include "itkImageFileWriter.h"
28 | #include "itkFloatingPointExceptions.h"
29 | #include "itkImage.h"
30 | #include "itkVector.h"
31 | #include "itkNeighborhood.h"
32 | #include "itkMetaDataDictionary.h"
33 | #include "itkMetaDataObject.h"
34 |
35 | #include "itkScalarImageToTextureFeaturesFilter.h"
36 |
37 | #include "itkPluginUtilities.h"
38 |
39 | #include "ComputeGLCMFeaturesCLP.h"
40 |
41 | namespace
42 | {
43 |
44 | template< typename TPixel >
45 | int DoIt( int argc, char * argv[] )
46 | {
47 | PARSE_ARGS;
48 |
49 | const unsigned int Dimension = 3;
50 |
51 | typedef TPixel PixelType;
52 | typedef itk::Image< PixelType, Dimension > InputImageType;
53 |
54 | typedef itk::ImageFileReader< InputImageType > ReaderType;
55 | typename ReaderType::Pointer reader = ReaderType::New();
56 | reader->SetFileName( inputVolume );
57 | reader->Update();
58 |
59 | typedef itk::Statistics::ScalarImageToTextureFeaturesFilter< InputImageType> FilterType;
60 | typename FilterType::Pointer filter = FilterType::New();
61 | filter->SetInput(reader->GetOutput());
62 |
63 | if(inputMask != "")
64 | {
65 | typename ReaderType::Pointer maskReader = ReaderType::New();
66 | maskReader->SetFileName( inputMask );
67 | maskReader->Update();
68 | filter->SetMaskImage(maskReader->GetOutput());
69 | }
70 |
71 | filter->SetInsidePixelValue(insideMask);
72 | filter->SetNumberOfBinsPerAxis(binNumber);
73 | filter->SetPixelValueMinMax(pixelIntensityMin, pixelIntensityMax);
74 |
75 | typename FilterType::FeatureNameVectorPointer requestedFeatures = FilterType::FeatureNameVector::New();
76 | requestedFeatures->push_back(static_cast(FilterType::TextureFeaturesFilterType::Energy));
77 | requestedFeatures->push_back(static_cast(FilterType::TextureFeaturesFilterType::Entropy));
78 | requestedFeatures->push_back(static_cast(FilterType::TextureFeaturesFilterType::Correlation));
79 | requestedFeatures->push_back(static_cast(FilterType::TextureFeaturesFilterType::InverseDifferenceMoment));
80 | requestedFeatures->push_back(static_cast(FilterType::TextureFeaturesFilterType::Inertia));
81 | requestedFeatures->push_back(static_cast(FilterType::TextureFeaturesFilterType::ClusterShade));
82 | requestedFeatures->push_back(static_cast(FilterType::TextureFeaturesFilterType::ClusterProminence));
83 | requestedFeatures->push_back(static_cast(FilterType::TextureFeaturesFilterType::HaralickCorrelation));
84 | filter->SetRequestedFeatures(requestedFeatures);
85 |
86 | filter->Update();
87 |
88 | typename FilterType::FeatureValueVector::ConstIterator mIt;
89 | typename FilterType::FeatureValueVectorPointer meanVector = filter->GetFeatureMeans();
90 | std::ofstream rts;
91 | rts.open(returnParameterFile.c_str() );
92 | rts << "outputVector = ";
93 | for(mIt = meanVector->Begin(); mIt != meanVector->End(); mIt++)
94 | {
95 | if(mIt != meanVector->Begin())
96 | {
97 | rts << ",";
98 | }
99 | rts << mIt.Value();
100 | }
101 | rts << std::endl;
102 |
103 | mIt = meanVector->Begin();
104 |
105 | rts<<"Energy = "<< mIt.Value() << std::endl;
106 | mIt++;
107 | rts<<"Entropy = "<< mIt.Value() << std::endl;
108 | mIt++;
109 | rts<<"Correlation = "<< mIt.Value() << std::endl;
110 | mIt++;
111 | rts<<"InverseDifferenceMoment = "<< mIt.Value() << std::endl;
112 | mIt++;
113 | rts<<"Inertia = "<< mIt.Value() << std::endl;
114 | mIt++;
115 | rts<<"ClusterShade = "<< mIt.Value() << std::endl;
116 | mIt++;
117 | rts<<"ClusterProminence = "<< mIt.Value() << std::endl;
118 | mIt++;
119 | rts<<"HaralickCorrelation = "<< mIt.Value() << std::endl;
120 |
121 | return EXIT_SUCCESS;
122 | }
123 |
124 | } // end of anonymous namespace
125 |
126 | int main( int argc, char * argv[] )
127 | {
128 | PARSE_ARGS;
129 |
130 | itk::ImageIOBase::IOPixelType inputPixelType;
131 | itk::ImageIOBase::IOComponentType inputComponentType;
132 | itk::FloatingPointExceptions::Enable();
133 | itk::FloatingPointExceptions::SetExceptionAction( itk::FloatingPointExceptions::ABORT );
134 |
135 | try
136 | {
137 |
138 | itk::GetImageType(inputVolume, inputPixelType, inputComponentType);
139 |
140 | switch( inputComponentType )
141 | {
142 | case itk::ImageIOBase::UCHAR:
143 | return DoIt< int >( argc, argv );
144 | break;
145 | case itk::ImageIOBase::USHORT:
146 | return DoIt< int >( argc, argv );
147 | break;
148 | case itk::ImageIOBase::SHORT:
149 | return DoIt< int >( argc, argv );
150 | break;
151 | case itk::ImageIOBase::FLOAT:
152 | return DoIt< float >( argc, argv );
153 | break;
154 | case itk::ImageIOBase::INT:
155 | return DoIt< int >( argc, argv );
156 | break;
157 | default:
158 | std::cerr << "Unknown input image pixel component type: "
159 | << itk::ImageIOBase::GetComponentTypeAsString( inputComponentType )
160 | << std::endl;
161 | return EXIT_FAILURE;
162 | break;
163 | }
164 | }
165 | catch( itk::ExceptionObject & excep )
166 | {
167 | std::cerr << argv[0] << ": exception caught !" << std::endl;
168 | std::cerr << excep << std::endl;
169 | return EXIT_FAILURE;
170 | }
171 | return EXIT_SUCCESS;
172 | }
173 |
--------------------------------------------------------------------------------
/ComputeGLCMFeatures/ComputeGLCMFeatures.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Quantification.Texture Features
4 | Compute GLCM Features
5 | 1.0
6 | http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/ComputeGLCMFeatures
7 |
8 | Jean-Baptiste Vimort, Kitware Inc.
9 | This work was supported by the National Institute of Health (NIH) National Institute for Dental and Craniofacial Research (NIDCR) R01EB021391 (Textural Biomarkers of Arthritis for the Subchondral Bone in the Temporomandibular Joint)
10 |
11 |
12 | Input parameters
13 |
14 | inputVolume
15 |
16 | input
17 | 0
18 | Input Volume
19 |
20 |
21 | inputMask
22 |
23 | inputMask
24 | input
25 | s
26 | A mask defining the region over which texture features will be calculated
27 |
28 |
29 |
30 | insideMask
31 |
32 | insideMask
33 | i
34 | The pixel value that defines the ”inside” of the mask
35 | 1
36 |
37 |
38 | binNumber
39 |
40 | binNumber
41 | b
42 | The number of intensity bins
43 | 10
44 |
45 |
46 | pixelIntensityMin
47 |
48 | pixelIntensityMin
49 | p
50 | Minnimum of the pixel intensity range over which the features will be calculated
51 | 0
52 |
53 |
54 | pixelIntensityMax
55 |
56 | pixelIntensityMax
57 | P
58 | Maximum of the pixel intensity range over which the features will be calculated
59 | 4000
60 |
61 |
62 |
63 |
64 | Output parameters
65 |
66 | Energy
67 |
68 | output
69 |
70 |
71 | Entropy
72 |
73 | output
74 |
75 |
76 | Correlation
77 |
78 | output
79 |
80 |
81 | InverseDifferenceMoment
82 |
83 | output
84 |
85 |
86 | Inertia
87 |
88 | output
89 |
90 |
91 | ClusterShade
92 |
93 | output
94 |
95 |
96 | ClusterProminence
97 |
98 | output
99 |
100 |
101 | HaralickCorrelation
102 |
103 | output
104 |
105 |
106 |
107 |
108 | Advanced parameters
109 |
110 | outputVector
111 |
112 | output
113 | Output Vector
114 |
115 |
116 |
117 |
--------------------------------------------------------------------------------
/ComputeGLCMFeatures/Testing/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(Cxx)
2 |
--------------------------------------------------------------------------------
/ComputeGLCMFeatures/Testing/Cxx/CMakeLists.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kitware/BoneTextureExtension/3410506efaa404131f7b02aa70769f537b1f2b3d/ComputeGLCMFeatures/Testing/Cxx/CMakeLists.txt
--------------------------------------------------------------------------------
/ComputeGLRLMFeatureMaps/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #-----------------------------------------------------------------------------
2 | set(MODULE_NAME ComputeGLRLMFeatureMaps)
3 |
4 | #-----------------------------------------------------------------------------
5 |
6 | #
7 | # SlicerExecutionModel
8 | #
9 | find_package(SlicerExecutionModel REQUIRED)
10 | include(${SlicerExecutionModel_USE_FILE})
11 |
12 | #
13 | # ITK
14 | #
15 | set(${PROJECT_NAME}_ITK_COMPONENTS
16 | ITKIOImageBase
17 | ITKCommon
18 | ITKStatistics
19 | ITKImageGrid
20 | ITKImageSources
21 | ITKTestKernel
22 | ITKMetaIO
23 | ITKImageIntensity
24 | TextureFeatures
25 | )
26 | find_package(ITK 4.9 COMPONENTS ${${PROJECT_NAME}_ITK_COMPONENTS} REQUIRED)
27 | if(ITK_VERSION VERSION_GREATER_EQUAL "5.3")
28 | foreach(factory_uc IN ITEMS "IMAGEIO" "MESHIO" "TRANSFORMIO")
29 | set(ITK_NO_${factory_uc}_FACTORY_REGISTER_MANAGER 1)
30 | endforeach()
31 | else()
32 | set(ITK_NO_IO_FACTORY_REGISTER_MANAGER 1) # See Libs/ITKFactoryRegistration/CMakeLists.txt
33 | endif()
34 | include(${ITK_USE_FILE})
35 |
36 | #-----------------------------------------------------------------------------
37 | set(MODULE_INCLUDE_DIRECTORIES
38 | ${CMAKE_CURRENT_SOURCE_DIR}/../include
39 | )
40 |
41 | set(MODULE_SRCS
42 | )
43 |
44 | set(MODULE_TARGET_LIBRARIES
45 | ${ITK_LIBRARIES}
46 | )
47 |
48 | #-----------------------------------------------------------------------------
49 | SEMMacroBuildCLI(
50 | NAME ${MODULE_NAME}
51 | TARGET_LIBRARIES ${MODULE_TARGET_LIBRARIES}
52 | INCLUDE_DIRECTORIES ${MODULE_INCLUDE_DIRECTORIES}
53 | ADDITIONAL_SRCS ${MODULE_SRCS}
54 | )
55 |
56 | #-----------------------------------------------------------------------------
57 | if(BUILD_TESTING)
58 | add_subdirectory(Testing)
59 | endif()
60 |
--------------------------------------------------------------------------------
/ComputeGLRLMFeatureMaps/ComputeGLRLMFeatureMaps.cxx:
--------------------------------------------------------------------------------
1 | /*=========================================================================
2 | *
3 | * Copyright Insight Software Consortium
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0.txt
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | *
17 | *=========================================================================*/
18 |
19 |
20 | // Use an anonymous namespace to keep class types and function names
21 | // from colliding when module is used as shared object module. Every
22 | // thing should be in an anonymous namespace except for the module
23 | // entry point, e.g. main()
24 | //
25 |
26 | #include "itkImageFileReader.h"
27 | #include "itkImageFileWriter.h"
28 | #include "itkFloatingPointExceptions.h"
29 | #include "itkImage.h"
30 | #include "itkVector.h"
31 | #include "itkNeighborhood.h"
32 | #include "itkMetaDataDictionary.h"
33 | #include "itkMetaDataObject.h"
34 |
35 | #include "itkRunLengthTextureFeaturesImageFilter.h"
36 |
37 | #include "itkPluginUtilities.h"
38 |
39 | #include "ComputeGLRLMFeatureMapsCLP.h"
40 |
41 | namespace
42 | {
43 |
44 | template< typename TPixel >
45 | int DoIt( int argc, char * argv[] )
46 | {
47 | PARSE_ARGS;
48 |
49 | const unsigned int Dimension = 3;
50 |
51 | typedef TPixel PixelType;
52 | typedef itk::Image< PixelType, Dimension > InputImageType;
53 | typedef itk::VectorImage< float, Dimension > OutputImageType;
54 |
55 | typedef itk::Neighborhood NeighborhoodType;
56 | NeighborhoodType hood;
57 |
58 | typedef itk::ImageFileReader< InputImageType > ReaderType;
59 | typename ReaderType::Pointer reader = ReaderType::New();
60 | reader->SetFileName( inputVolume );
61 | reader->Update();
62 |
63 | typedef itk::Statistics::RunLengthTextureFeaturesImageFilter< InputImageType, OutputImageType ,InputImageType > FilterType;
64 | typename FilterType::Pointer filter = FilterType::New();
65 | filter->SetInput(reader->GetOutput());
66 |
67 | if(inputMask != "")
68 | {
69 | typename ReaderType::Pointer maskReader = ReaderType::New();
70 | maskReader->SetFileName( inputMask );
71 | maskReader->Update();
72 | filter->SetMaskImage(maskReader->GetOutput());
73 | }
74 |
75 | filter->SetInsidePixelValue(insideMask);
76 | filter->SetNumberOfBinsPerAxis(binNumber);
77 | hood.SetRadius(neighborhoodRadius);
78 | filter->SetNeighborhoodRadius(hood.GetRadius());
79 | filter->SetHistogramValueMinimum( pixelIntensityMin );
80 | filter->SetHistogramValueMaximum( pixelIntensityMax );
81 | filter->SetHistogramDistanceMinimum( distanceMin );
82 | filter->SetHistogramDistanceMaximum( distanceMax );
83 | filter->Update();
84 |
85 | itk::MetaDataDictionary dictionary;
86 | itk::EncapsulateMetaData(dictionary,"DWMRI_b-value","1.0");
87 | itk::EncapsulateMetaData(dictionary,"modality","DWMRI");
88 | filter->GetOutput()->SetMetaDataDictionary(dictionary);
89 |
90 | typedef itk::ImageFileWriter< OutputImageType > WriterType;
91 | typename WriterType::Pointer writer = WriterType::New();
92 | writer->SetFileName( outputVolume );
93 | writer->SetInput( filter->GetOutput() );
94 | writer->SetUseCompression( true );
95 | writer->Update();
96 |
97 | return EXIT_SUCCESS;
98 | }
99 |
100 | } // end of anonymous namespace
101 |
102 | int main( int argc, char * argv[] )
103 | {
104 | PARSE_ARGS;
105 |
106 | itk::ImageIOBase::IOPixelType inputPixelType;
107 | itk::ImageIOBase::IOComponentType inputComponentType;
108 | itk::FloatingPointExceptions::Enable();
109 | itk::FloatingPointExceptions::SetExceptionAction( itk::FloatingPointExceptions::ABORT );
110 |
111 | try
112 | {
113 |
114 | itk::GetImageType(inputVolume, inputPixelType, inputComponentType);
115 |
116 | switch( inputComponentType )
117 | {
118 | case itk::ImageIOBase::UCHAR:
119 | return DoIt< int >( argc, argv );
120 | break;
121 | case itk::ImageIOBase::USHORT:
122 | return DoIt< int >( argc, argv );
123 | break;
124 | case itk::ImageIOBase::SHORT:
125 | return DoIt< int >( argc, argv );
126 | break;
127 | case itk::ImageIOBase::FLOAT:
128 | return DoIt< float >( argc, argv );
129 | break;
130 | case itk::ImageIOBase::INT:
131 | return DoIt< int >( argc, argv );
132 | break;
133 | default:
134 | std::cerr << "Unknown input image pixel component type: "
135 | << itk::ImageIOBase::GetComponentTypeAsString( inputComponentType )
136 | << std::endl;
137 | return EXIT_FAILURE;
138 | break;
139 | }
140 | }
141 | catch( itk::ExceptionObject & excep )
142 | {
143 | std::cerr << argv[0] << ": exception caught !" << std::endl;
144 | std::cerr << excep << std::endl;
145 | return EXIT_FAILURE;
146 | }
147 | return EXIT_SUCCESS;
148 | }
149 |
--------------------------------------------------------------------------------
/ComputeGLRLMFeatureMaps/ComputeGLRLMFeatureMaps.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Quantification.Texture Features
4 | Compute GLRLM Feature Maps
5 | 1.0
6 | http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/ComputeGLRLMFeatureMaps
7 |
8 | Jean-Baptiste Vimort, Kitware Inc.
9 | This work was supported by the National Institute of Health (NIH) National Institute for Dental and Craniofacial Research (NIDCR) R01EB021391 (Textural Biomarkers of Arthritis for the Subchondral Bone in the Temporomandibular Joint)
10 |
11 |
12 | Input/output parameters
13 |
14 | inputVolume
15 |
16 | input
17 | 0
18 | Input Volume
19 |
20 |
21 | outputVolume
22 |
23 | output
24 | 1
25 | Output Volume
26 |
27 |
28 | inputMask
29 |
30 | inputMask
31 | input
32 | s
33 | A mask defining the region over which texture features will be calculated
34 |
35 |
36 |
37 | insideMask
38 |
39 | insideMask
40 | i
41 | The pixel value that defines the ”inside” of the mask
42 | 1
43 |
44 |
45 | binNumber
46 |
47 | binNumber
48 | b
49 | The number of intensity bins
50 | 10
51 |
52 |
53 | neighborhoodRadius
54 |
55 | neighborhoodRadius
56 | n
57 | The size of the neighborhood radius
58 | 4
59 |
60 |
61 | pixelIntensityMin
62 |
63 | pixelIntensityMin
64 | p
65 | Minnimum of the pixel intensity range over which the features will be calculated
66 | 0
67 |
68 |
69 | pixelIntensityMax
70 |
71 | pixelIntensityMax
72 | P
73 | Maximum of the pixel intensity range over which the features will be calculated
74 | 4000
75 |
76 |
77 | distanceMin
78 |
79 | distanceMin
80 | d
81 | Minnimum of the distance range over which the features will be calculated
82 | 0.0
83 |
84 |
85 | distanceMax
86 |
87 | distanceMax
88 | D
89 | Maximum of the distance range over which the features will be calculated
90 | 1.0
91 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/ComputeGLRLMFeatureMaps/Testing/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(Cxx)
2 |
--------------------------------------------------------------------------------
/ComputeGLRLMFeatureMaps/Testing/Cxx/CMakeLists.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kitware/BoneTextureExtension/3410506efaa404131f7b02aa70769f537b1f2b3d/ComputeGLRLMFeatureMaps/Testing/Cxx/CMakeLists.txt
--------------------------------------------------------------------------------
/ComputeGLRLMFeatures/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #-----------------------------------------------------------------------------
2 | set(MODULE_NAME ComputeGLRLMFeatures)
3 |
4 | #-----------------------------------------------------------------------------
5 |
6 | #
7 | # SlicerExecutionModel
8 | #
9 | find_package(SlicerExecutionModel REQUIRED)
10 | include(${SlicerExecutionModel_USE_FILE})
11 |
12 | #
13 | # ITK
14 | #
15 | set(${PROJECT_NAME}_ITK_COMPONENTS
16 | ITKIOImageBase
17 | ITKCommon
18 | ITKStatistics
19 | ITKImageGrid
20 | ITKImageSources
21 | ITKTestKernel
22 | ITKMetaIO
23 | ITKImageIntensity
24 | )
25 | find_package(ITK 4.9 COMPONENTS ${${PROJECT_NAME}_ITK_COMPONENTS} REQUIRED)
26 | if(ITK_VERSION VERSION_GREATER_EQUAL "5.3")
27 | foreach(factory_uc IN ITEMS "IMAGEIO" "MESHIO" "TRANSFORMIO")
28 | set(ITK_NO_${factory_uc}_FACTORY_REGISTER_MANAGER 1)
29 | endforeach()
30 | else()
31 | set(ITK_NO_IO_FACTORY_REGISTER_MANAGER 1) # See Libs/ITKFactoryRegistration/CMakeLists.txt
32 | endif()
33 | include(${ITK_USE_FILE})
34 |
35 | #-----------------------------------------------------------------------------
36 | set(MODULE_INCLUDE_DIRECTORIES
37 | ${CMAKE_CURRENT_SOURCE_DIR}/../include
38 | )
39 |
40 | set(MODULE_SRCS
41 | )
42 |
43 | set(MODULE_TARGET_LIBRARIES
44 | ${ITK_LIBRARIES}
45 | )
46 |
47 | #-----------------------------------------------------------------------------
48 | SEMMacroBuildCLI(
49 | NAME ${MODULE_NAME}
50 | TARGET_LIBRARIES ${MODULE_TARGET_LIBRARIES}
51 | INCLUDE_DIRECTORIES ${MODULE_INCLUDE_DIRECTORIES}
52 | ADDITIONAL_SRCS ${MODULE_SRCS}
53 | )
54 |
55 | #-----------------------------------------------------------------------------
56 | if(BUILD_TESTING)
57 | add_subdirectory(Testing)
58 | endif()
59 |
--------------------------------------------------------------------------------
/ComputeGLRLMFeatures/ComputeGLRLMFeatures.cxx:
--------------------------------------------------------------------------------
1 | /*=========================================================================
2 | *
3 | * Copyright Insight Software Consortium
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0.txt
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | *
17 | *=========================================================================*/
18 |
19 |
20 | // Use an anonymous namespace to keep class types and function names
21 | // from colliding when module is used as shared object module. Every
22 | // thing should be in an anonymous namespace except for the module
23 | // entry point, e.g. main()
24 | //
25 |
26 | #include "itkImageFileReader.h"
27 | #include "itkImageFileWriter.h"
28 | #include "itkFloatingPointExceptions.h"
29 | #include "itkImage.h"
30 | #include "itkVector.h"
31 | #include "itkNeighborhood.h"
32 | #include "itkMetaDataDictionary.h"
33 | #include "itkMetaDataObject.h"
34 |
35 | #include "itkScalarImageToRunLengthFeaturesFilter.h"
36 |
37 | #include "itkPluginUtilities.h"
38 |
39 | #include "ComputeGLRLMFeaturesCLP.h"
40 |
41 | namespace
42 | {
43 |
44 | template< typename TPixel >
45 | int DoIt( int argc, char * argv[] )
46 | {
47 | PARSE_ARGS;
48 |
49 | const unsigned int Dimension = 3;
50 |
51 | typedef TPixel PixelType;
52 | typedef itk::Image< PixelType, Dimension > InputImageType;
53 |
54 | typedef itk::ImageFileReader< InputImageType > ReaderType;
55 | typename ReaderType::Pointer reader = ReaderType::New();
56 | reader->SetFileName( inputVolume );
57 | reader->Update();
58 |
59 | typedef itk::Statistics::ScalarImageToRunLengthFeaturesFilter< InputImageType> FilterType;
60 | typename FilterType::Pointer filter = FilterType::New();
61 | filter->SetInput(reader->GetOutput());
62 |
63 | if(inputMask != "")
64 | {
65 | typename ReaderType::Pointer maskReader = ReaderType::New();
66 | maskReader->SetFileName( inputMask );
67 | maskReader->Update();
68 | filter->SetMaskImage(maskReader->GetOutput());
69 | }
70 |
71 | filter->SetInsidePixelValue(insideMask);
72 | filter->SetNumberOfBinsPerAxis(binNumber);
73 | filter->SetPixelValueMinMax(pixelIntensityMin, pixelIntensityMax);
74 | filter->SetDistanceValueMinMax(distanceMin, distanceMax);
75 |
76 | typename FilterType::FeatureNameVectorPointer requestedFeatures = FilterType::FeatureNameVector::New();
77 | requestedFeatures->push_back(static_cast(FilterType::RunLengthFeaturesFilterType::ShortRunEmphasis));
78 | requestedFeatures->push_back(static_cast(FilterType::RunLengthFeaturesFilterType::LongRunEmphasis));
79 | requestedFeatures->push_back(static_cast(FilterType::RunLengthFeaturesFilterType::GreyLevelNonuniformity));
80 | requestedFeatures->push_back(static_cast(FilterType::RunLengthFeaturesFilterType::RunLengthNonuniformity));
81 | requestedFeatures->push_back(static_cast(FilterType::RunLengthFeaturesFilterType::LowGreyLevelRunEmphasis));
82 | requestedFeatures->push_back(static_cast(FilterType::RunLengthFeaturesFilterType::HighGreyLevelRunEmphasis));
83 | requestedFeatures->push_back(static_cast(FilterType::RunLengthFeaturesFilterType::ShortRunLowGreyLevelEmphasis));
84 | requestedFeatures->push_back(static_cast(FilterType::RunLengthFeaturesFilterType::ShortRunHighGreyLevelEmphasis));
85 | requestedFeatures->push_back(static_cast(FilterType::RunLengthFeaturesFilterType::LongRunLowGreyLevelEmphasis));
86 | requestedFeatures->push_back(static_cast(FilterType::RunLengthFeaturesFilterType::LongRunHighGreyLevelEmphasis));
87 | filter->SetRequestedFeatures(requestedFeatures);
88 |
89 | filter->Update();
90 |
91 | typename FilterType::FeatureValueVector::ConstIterator mIt;
92 | typename FilterType::FeatureValueVectorPointer meanVector = filter->GetFeatureMeans();
93 | std::ofstream rts;
94 | rts.open(returnParameterFile.c_str() );
95 | rts << "outputVector = ";
96 | for(mIt = meanVector->Begin(); mIt != meanVector->End(); mIt++)
97 | {
98 | if(mIt != meanVector->Begin())
99 | {
100 | rts << ",";
101 | }
102 | rts << mIt.Value();
103 | }
104 | rts << std::endl;
105 |
106 | mIt = meanVector->Begin();
107 |
108 | rts<<"ShortRunEmphasis = "<< mIt.Value() << std::endl;
109 | mIt++;
110 | rts<<"LongRunEmphasis = "<< mIt.Value() << std::endl;
111 | mIt++;
112 | rts<<"GreyLevelNonuniformity = "<< mIt.Value() << std::endl;
113 | mIt++;
114 | rts<<"RunLengthNonuniformity = "<< mIt.Value() << std::endl;
115 | mIt++;
116 | rts<<"LowGreyLevelRunEmphasis = "<< mIt.Value() << std::endl;
117 | mIt++;
118 | rts<<"HighGreyLevelRunEmphasis = "<< mIt.Value() << std::endl;
119 | mIt++;
120 | rts<<"ShortRunLowGreyLevelEmphasis = "<< mIt.Value() << std::endl;
121 | mIt++;
122 | rts<<"ShortRunHighGreyLevelEmphasis = "<< mIt.Value() << std::endl;
123 | mIt++;
124 | rts<<"LongRunLowGreyLevelEmphasis = "<< mIt.Value() << std::endl;
125 | mIt++;
126 | rts<<"LongRunHighGreyLevelEmphasis = "<< mIt.Value() << std::endl;
127 |
128 | return EXIT_SUCCESS;
129 | }
130 |
131 | } // end of anonymous namespace
132 |
133 | int main( int argc, char * argv[] )
134 | {
135 | PARSE_ARGS;
136 |
137 | itk::ImageIOBase::IOPixelType inputPixelType;
138 | itk::ImageIOBase::IOComponentType inputComponentType;
139 | itk::FloatingPointExceptions::Enable();
140 | itk::FloatingPointExceptions::SetExceptionAction( itk::FloatingPointExceptions::ABORT );
141 |
142 | try
143 | {
144 |
145 | itk::GetImageType(inputVolume, inputPixelType, inputComponentType);
146 |
147 | switch( inputComponentType )
148 | {
149 | case itk::ImageIOBase::UCHAR:
150 | return DoIt< int >( argc, argv );
151 | break;
152 | case itk::ImageIOBase::USHORT:
153 | return DoIt< int >( argc, argv );
154 | break;
155 | case itk::ImageIOBase::SHORT:
156 | return DoIt< int >( argc, argv );
157 | break;
158 | case itk::ImageIOBase::FLOAT:
159 | return DoIt< float >( argc, argv );
160 | break;
161 | case itk::ImageIOBase::INT:
162 | return DoIt< int >( argc, argv );
163 | break;
164 | default:
165 | std::cerr << "Unknown input image pixel component type: "
166 | << itk::ImageIOBase::GetComponentTypeAsString( inputComponentType )
167 | << std::endl;
168 | return EXIT_FAILURE;
169 | break;
170 | }
171 | }
172 | catch( itk::ExceptionObject & excep )
173 | {
174 | std::cerr << argv[0] << ": exception caught !" << std::endl;
175 | std::cerr << excep << std::endl;
176 | return EXIT_FAILURE;
177 | }
178 | return EXIT_SUCCESS;
179 | }
180 |
--------------------------------------------------------------------------------
/ComputeGLRLMFeatures/ComputeGLRLMFeatures.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Quantification.Texture Features
4 | Compute GLRLM Features
5 | 1.0
6 | http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/ComputeGLRLMFeatures
7 |
8 | Jean-Baptiste Vimort, Kitware Inc.
9 | This work was supported by the National Institute of Health (NIH) National Institute for Dental and Craniofacial Research (NIDCR) R01EB021391 (Textural Biomarkers of Arthritis for the Subchondral Bone in the Temporomandibular Joint)
10 |
11 |
12 | Input parameters
13 |
14 | inputVolume
15 |
16 | input
17 | 0
18 | Input Volume
19 |
20 |
21 | inputMask
22 |
23 | inputMask
24 | input
25 | s
26 | A mask defining the region over which texture features will be calculated
27 |
28 |
29 |
30 | insideMask
31 |
32 | insideMask
33 | i
34 | The pixel value that defines the ”inside” of the mask
35 | 1
36 |
37 |
38 | binNumber
39 |
40 | binNumber
41 | b
42 | The number of intensity bins
43 | 10
44 |
45 |
46 | pixelIntensityMin
47 |
48 | pixelIntensityMin
49 | p
50 | Minnimum of the pixel intensity range over which the features will be calculated
51 | 0
52 |
53 |
54 | pixelIntensityMax
55 |
56 | pixelIntensityMax
57 | P
58 | Maximum of the pixel intensity range over which the features will be calculated
59 | 4000
60 |
61 |
62 | distanceMin
63 |
64 | distanceMin
65 | d
66 | Minnimum of the distance range over which the features will be calculated
67 | 0.0
68 |
69 |
70 | distanceMax
71 |
72 | distanceMax
73 | D
74 | Maximum of the distance range over which the features will be calculated
75 | 1.0
76 |
77 |
78 |
79 |
80 | Output parameters
81 |
82 | ShortRunEmphasis
83 |
84 | output
85 |
86 |
87 | LongRunEmphasis
88 |
89 | output
90 |
91 |
92 | GreyLevelNonuniformity
93 |
94 | output
95 |
96 |
97 | RunLengthNonuniformity
98 |
99 | output
100 |
101 |
102 | LowGreyLevelRunEmphasis
103 |
104 | output
105 |
106 |
107 | HighGreyLevelRunEmphasis
108 |
109 | output
110 |
111 |
112 | ShortRunLowGreyLevelEmphasis
113 |
114 | output
115 |
116 |
117 | ShortRunHighGreyLevelEmphasis
118 |
119 | output
120 |
121 |
122 | LongRunLowGreyLevelEmphasis
123 |
124 | output
125 |
126 |
127 | LongRunHighGreyLevelEmphasis
128 |
129 | output
130 |
131 |
132 |
133 |
134 | Advanced parameters
135 |
136 | outputVector
137 |
138 | output
139 | Output Vector
140 |
141 |
142 |
143 |
--------------------------------------------------------------------------------
/ComputeGLRLMFeatures/Testing/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(Cxx)
2 |
--------------------------------------------------------------------------------
/ComputeGLRLMFeatures/Testing/Cxx/CMakeLists.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kitware/BoneTextureExtension/3410506efaa404131f7b02aa70769f537b1f2b3d/ComputeGLRLMFeatures/Testing/Cxx/CMakeLists.txt
--------------------------------------------------------------------------------
/CreateLabelMapFromCSV/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #-----------------------------------------------------------------------------
2 | set(MODULE_NAME CreateLabelMapFromCSV)
3 |
4 | #-----------------------------------------------------------------------------
5 |
6 | #
7 | # SlicerExecutionModel
8 | #
9 | find_package(SlicerExecutionModel REQUIRED)
10 | include(${SlicerExecutionModel_USE_FILE})
11 |
12 | #
13 | # ITK
14 | #
15 | set(${PROJECT_NAME}_ITK_COMPONENTS
16 | ITKIOImageBase
17 | ITKCommon
18 | ITKStatistics
19 | ITKImageGrid
20 | ITKImageSources
21 | ITKTestKernel
22 | ITKMetaIO
23 | ITKImageIntensity
24 | )
25 | find_package(ITK 4.9 COMPONENTS ${${PROJECT_NAME}_ITK_COMPONENTS} REQUIRED)
26 | if(ITK_VERSION VERSION_GREATER_EQUAL "5.3")
27 | foreach(factory_uc IN ITEMS "IMAGEIO" "MESHIO" "TRANSFORMIO")
28 | set(ITK_NO_${factory_uc}_FACTORY_REGISTER_MANAGER 1)
29 | endforeach()
30 | else()
31 | set(ITK_NO_IO_FACTORY_REGISTER_MANAGER 1) # See Libs/ITKFactoryRegistration/CMakeLists.txt
32 | endif()
33 | include(${ITK_USE_FILE})
34 |
35 | #-----------------------------------------------------------------------------
36 | set(MODULE_INCLUDE_DIRECTORIES
37 | ${CMAKE_CURRENT_SOURCE_DIR}/../include
38 | )
39 |
40 | set(MODULE_SRCS
41 | )
42 |
43 | set(MODULE_TARGET_LIBRARIES
44 | ${ITK_LIBRARIES}
45 | )
46 |
47 | #-----------------------------------------------------------------------------
48 | SEMMacroBuildCLI(
49 | NAME ${MODULE_NAME}
50 | TARGET_LIBRARIES ${MODULE_TARGET_LIBRARIES}
51 | INCLUDE_DIRECTORIES ${MODULE_INCLUDE_DIRECTORIES}
52 | ADDITIONAL_SRCS ${MODULE_SRCS}
53 | )
54 |
55 | #-----------------------------------------------------------------------------
56 | if(BUILD_TESTING)
57 | add_subdirectory(Testing)
58 | endif()
59 |
--------------------------------------------------------------------------------
/CreateLabelMapFromCSV/CreateLabelMapFromCSV.cxx:
--------------------------------------------------------------------------------
1 | /*=========================================================================
2 | *
3 | * Copyright Insight Software Consortium
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0.txt
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | *
17 | *=========================================================================*/
18 |
19 |
20 | // Use an anonymous namespace to keep class types and function names
21 | // from colliding when module is used as shared object module. Every
22 | // thing should be in an anonymous namespace except for the module
23 | // entry point, e.g. main()
24 | //
25 | #include
26 | #include
27 | #include "itkImageFileReader.h"
28 | #include "itkImageFileWriter.h"
29 | #include "itkFloatingPointExceptions.h"
30 | #include "itkImage.h"
31 | #include "itkVector.h"
32 | #include "itkNeighborhood.h"
33 | #include "itkMetaDataDictionary.h"
34 | #include "itkMetaDataObject.h"
35 |
36 | #include "itkVectorIndexSelectionCastImageFilter.h"
37 |
38 | #include "itkPluginUtilities.h"
39 |
40 | #include "CreateLabelMapFromCSVCLP.h"
41 |
42 | namespace
43 | {
44 |
45 | template< typename TPixel >
46 | int DoIt( int argc, char * argv[] )
47 | {
48 |
49 | PARSE_ARGS;
50 |
51 | const unsigned int Dimension = 3;
52 |
53 | typedef TPixel PixelType;
54 | typedef itk::Image< PixelType, Dimension > InputImageType;
55 | typedef itk::ImageFileReader< InputImageType > ReaderType;
56 | typedef itk::Image< unsigned int, Dimension > OutImageType;
57 | typedef itk::ImageFileWriter< OutImageType > WriterType;
58 |
59 | typename ReaderType::Pointer reader = ReaderType::New();
60 | reader->SetFileName( inputVolume );
61 | reader->Update();
62 |
63 | OutImageType::Pointer output = OutImageType::New();
64 | output->SetRegions(reader->GetOutput()->GetRequestedRegion());
65 | output->SetOrigin(reader->GetOutput()->GetOrigin());
66 | output->SetDirection(reader->GetOutput()->GetDirection());
67 | output->SetSpacing(reader->GetOutput()->GetSpacing());
68 | output->Allocate();
69 |
70 | typename OutImageType::IndexType pixelIndex;
71 |
72 | std::ifstream inputFile;
73 | inputFile.open(inputFileName.c_str(), std::ios::in);
74 |
75 | std::string line;
76 | while(std::getline(inputFile, line))
77 | {
78 |
79 | std::istringstream s(line);
80 | std::string field;
81 |
82 | getline(s, field,',');
83 | pixelIndex[0] = std::atoi(field.c_str());
84 | getline(s, field,',');
85 | pixelIndex[1] = std::atoi(field.c_str());
86 | getline(s, field,',');
87 | pixelIndex[2] = std::atoi(field.c_str());
88 | getline(s, field,',');
89 |
90 | std::string label = field.substr(0, field.size()-1);
91 |
92 | if(label == Label1.c_str())
93 | {
94 | output->SetPixel (pixelIndex, 1);
95 | }
96 | else if(label == Label2.c_str())
97 | {
98 | output->SetPixel (pixelIndex, 2);
99 | }
100 | else if(label == Label3.c_str())
101 | {
102 | output->SetPixel (pixelIndex, 3);
103 | }
104 | else if(label == Label4.c_str())
105 | {
106 | output->SetPixel (pixelIndex, 4);
107 | }
108 | else if(label == Label5.c_str())
109 | {
110 | output->SetPixel (pixelIndex, 5);
111 | }
112 | else
113 | {
114 | output->SetPixel (pixelIndex, 0);
115 | }
116 |
117 | }
118 | typename WriterType::Pointer writer = WriterType::New();
119 | writer->SetFileName( outputLabeMap );
120 | writer->SetInput( output );
121 | writer->Update();
122 |
123 | return EXIT_SUCCESS;
124 | }
125 |
126 | } // end of anonymous namespace
127 |
128 | int main( int argc, char * argv[] )
129 | {
130 | PARSE_ARGS;
131 |
132 | itk::ImageIOBase::IOPixelType inputPixelType;
133 | itk::ImageIOBase::IOComponentType inputComponentType;
134 | itk::FloatingPointExceptions::Enable();
135 | itk::FloatingPointExceptions::SetExceptionAction( itk::FloatingPointExceptions::ABORT );
136 |
137 | try
138 | {
139 |
140 | itk::GetImageType(inputVolume, inputPixelType, inputComponentType);
141 |
142 | switch( inputComponentType )
143 | {
144 | case itk::ImageIOBase::UCHAR:
145 | return DoIt< int >( argc, argv );
146 | break;
147 | case itk::ImageIOBase::USHORT:
148 | return DoIt< int >( argc, argv );
149 | break;
150 | case itk::ImageIOBase::SHORT:
151 | return DoIt< int >( argc, argv );
152 | break;
153 | case itk::ImageIOBase::FLOAT:
154 | return DoIt< float >( argc, argv );
155 | break;
156 | case itk::ImageIOBase::INT:
157 | return DoIt< int >( argc, argv );
158 | break;
159 | default:
160 | std::cerr << "Unknown input image pixel component type: "
161 | << itk::ImageIOBase::GetComponentTypeAsString( inputComponentType )
162 | << std::endl;
163 | return EXIT_FAILURE;
164 | break;
165 | }
166 | }
167 | catch( itk::ExceptionObject & excep )
168 | {
169 | std::cerr << argv[0] << ": exception caught !" << std::endl;
170 | std::cerr << excep << std::endl;
171 | return EXIT_FAILURE;
172 | }
173 | return EXIT_SUCCESS;
174 | }
175 |
--------------------------------------------------------------------------------
/CreateLabelMapFromCSV/CreateLabelMapFromCSV.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Quantification.Texture Features
4 | Create label map from CSV
5 | 1.0
6 | http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/SaveVectorImageAsCSV
7 |
8 | Jean-Baptiste Vimort, Kitware Inc.
9 | This work was supported by the National Institute of Health (NIH) National Institute for Dental and Craniofacial Research (NIDCR) R01EB021391 (Textural Biomarkers of Arthritis for the Subchondral Bone in the Temporomandibular Joint)
10 |
11 |
12 | Input/output parameters
13 |
14 | inputVolume
15 |
16 | input
17 | 0
18 | Input Volume
19 |
20 |
21 | inputFileName
22 |
23 | input
24 | 1
25 | Input File Name
26 |
27 |
28 | outputLabeMap
29 |
30 | output
31 | 2
32 | Label Map created from the CSV
33 |
34 |
35 | Label1
36 |
37 | input
38 | 3
39 | 1
40 |
41 |
42 | Label2
43 |
44 | input
45 | L2
46 |
47 |
48 |
49 | Label3
50 |
51 | input
52 | L3
53 |
54 |
55 |
56 | Label4
57 |
58 | input
59 | L4
60 |
61 |
62 |
63 | Label5
64 |
65 | input
66 | L5
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/CreateLabelMapFromCSV/Testing/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(Cxx)
2 |
--------------------------------------------------------------------------------
/CreateLabelMapFromCSV/Testing/Cxx/CMakeLists.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kitware/BoneTextureExtension/3410506efaa404131f7b02aa70769f537b1f2b3d/CreateLabelMapFromCSV/Testing/Cxx/CMakeLists.txt
--------------------------------------------------------------------------------
/Docs/BoneTextureExtensionTutorial_2017.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kitware/BoneTextureExtension/3410506efaa404131f7b02aa70769f537b1f2b3d/Docs/BoneTextureExtensionTutorial_2017.pdf
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Bone Texture
2 |
3 | This slicer extension uses work contributed as external modules for ITK.
4 |
5 | ### ITKBoneMorphometry
6 | - Module: [ITKBoneMorphometry](https://github.com/InsightSoftwareConsortium/ITKBoneMorphometry)
7 | - Insight Journal: [Computing Bone Morphometric Feature Maps from 3-Dimensional Images](http://www.insight-journal.org/browse/publication/988)
8 |
9 | ### ITKTextureFeatures
10 | - Module: [ITKTextureFeatures](https://github.com/InsightSoftwareConsortium/ITKTextureFeatures)
11 | - Insight Journal: [Computing Textural Feature Maps for N-Dimensional images](http://www.insight-journal.org/browse/publication/985)
12 |
13 | A tutorial of how to use this module can be found in [pdf](./Docs/BoneTextureExtensionTutorial_2017.pdf).
14 |
15 |
16 |
--------------------------------------------------------------------------------
/SaveVectorImageAsCSV/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #-----------------------------------------------------------------------------
2 | set(MODULE_NAME SaveVectorImageAsCSV)
3 |
4 | #-----------------------------------------------------------------------------
5 |
6 | #
7 | # SlicerExecutionModel
8 | #
9 | find_package(SlicerExecutionModel REQUIRED)
10 | include(${SlicerExecutionModel_USE_FILE})
11 |
12 | #
13 | # ITK
14 | #
15 | set(${PROJECT_NAME}_ITK_COMPONENTS
16 | ITKIOImageBase
17 | ITKCommon
18 | ITKStatistics
19 | ITKImageGrid
20 | ITKImageSources
21 | ITKTestKernel
22 | ITKMetaIO
23 | ITKImageIntensity
24 | )
25 | find_package(ITK 4.9 COMPONENTS ${${PROJECT_NAME}_ITK_COMPONENTS} REQUIRED)
26 | if(ITK_VERSION VERSION_GREATER_EQUAL "5.3")
27 | foreach(factory_uc IN ITEMS "IMAGEIO" "MESHIO" "TRANSFORMIO")
28 | set(ITK_NO_${factory_uc}_FACTORY_REGISTER_MANAGER 1)
29 | endforeach()
30 | else()
31 | set(ITK_NO_IO_FACTORY_REGISTER_MANAGER 1) # See Libs/ITKFactoryRegistration/CMakeLists.txt
32 | endif()
33 | include(${ITK_USE_FILE})
34 |
35 | #-----------------------------------------------------------------------------
36 | set(MODULE_INCLUDE_DIRECTORIES
37 | ${CMAKE_CURRENT_SOURCE_DIR}/../include
38 | )
39 |
40 | set(MODULE_SRCS
41 | )
42 |
43 | set(MODULE_TARGET_LIBRARIES
44 | ${ITK_LIBRARIES}
45 | )
46 |
47 | #-----------------------------------------------------------------------------
48 | SEMMacroBuildCLI(
49 | NAME ${MODULE_NAME}
50 | TARGET_LIBRARIES ${MODULE_TARGET_LIBRARIES}
51 | INCLUDE_DIRECTORIES ${MODULE_INCLUDE_DIRECTORIES}
52 | ADDITIONAL_SRCS ${MODULE_SRCS}
53 | )
54 |
55 | #-----------------------------------------------------------------------------
56 | if(BUILD_TESTING)
57 | add_subdirectory(Testing)
58 | endif()
59 |
--------------------------------------------------------------------------------
/SaveVectorImageAsCSV/SaveVectorImageAsCSV.cxx:
--------------------------------------------------------------------------------
1 | /*=========================================================================
2 | *
3 | * Copyright Insight Software Consortium
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0.txt
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | *
17 | *=========================================================================*/
18 |
19 |
20 | // Use an anonymous namespace to keep class types and function names
21 | // from colliding when module is used as shared object module. Every
22 | // thing should be in an anonymous namespace except for the module
23 | // entry point, e.g. main()
24 | //
25 | #include
26 | #include "itkImageFileReader.h"
27 | #include "itkImageFileWriter.h"
28 | #include "itkFloatingPointExceptions.h"
29 | #include "itkImage.h"
30 | #include "itkVector.h"
31 | #include "itkNeighborhood.h"
32 | #include "itkMetaDataDictionary.h"
33 | #include "itkMetaDataObject.h"
34 |
35 | #include "itkVectorIndexSelectionCastImageFilter.h"
36 |
37 | #include "itkPluginUtilities.h"
38 |
39 | #include "SaveVectorImageAsCSVCLP.h"
40 |
41 | namespace
42 | {
43 |
44 | template< typename TPixel >
45 | int DoIt( int argc, char * argv[] )
46 | {
47 |
48 | PARSE_ARGS;
49 |
50 | const unsigned int Dimension = 3;
51 |
52 | typedef TPixel PixelType;
53 | typedef itk::VectorImage< PixelType, Dimension > InputImageType;
54 | typedef itk::Image< PixelType, Dimension > InputMaskType;
55 | typedef itk::ImageFileReader< InputImageType > ReaderType;
56 | typedef itk::ImageFileReader< InputMaskType > MaskReaderType;
57 |
58 | typename ReaderType::Pointer reader = ReaderType::New();
59 | reader->SetFileName( inputVolume );
60 | reader->Update();
61 |
62 | std::ofstream outputFile;
63 | const char *outputFilename = outputFileBaseName.c_str();
64 | outputFile.open(outputFilename, std::ios::out);
65 |
66 | if(predefineTitle)
67 | {
68 | outputFile<<"X"<<",";
69 | outputFile<<"Y"<<",";
70 | outputFile<<"Z"<<",";
71 | outputFile<<"Energy"<<",";
72 | outputFile<<"Entropy"<<",";
73 | outputFile<<"Correlation"<<",";
74 | outputFile<<"InverseDifferenceMoment"<<",";
75 | outputFile<<"Inertia"<<",";
76 | outputFile<<"ClusterShade"<<",";
77 | outputFile<<"ClusterProminence"<<",";
78 | outputFile<<"HarralickCorrelation"<<",";
79 | outputFile<<"ShortRunEmphasis"<<",";
80 | outputFile<<"LongRunEmpasis"<<",";
81 | outputFile<<"GreyLevelNonUniformity"<<",";
82 | outputFile<<"RunLengthNonUniformity"<<",";
83 | outputFile<<"LowGreyLevelRunEmphasis"<<",";
84 | outputFile<<"HighGreyLevelRunEmphasis"<<",";
85 | outputFile<<"ShortRunLowGreyLevelEmphasis"<<",";
86 | outputFile<<"ShortRunHighGreyLevelEmphasis"<<",";
87 | outputFile<<"LongRunLowGreyLevelEmphasis"<<",";
88 | outputFile<<"LongRunHighGreyLevelEmphasis"<<",";
89 | outputFile<<"BVTV"<<",";
90 | outputFile<<"TbN"<<",";
91 | outputFile<<"TbTh"<<",";
92 | outputFile<<"TbSp"<<",";
93 | outputFile<<"BSBV"<<",";
94 |
95 |
96 | outputFile< inIt( reader->GetOutput(), reader->GetOutput()->GetRequestedRegion());
100 | inIt.GoToBegin ();
101 | typename InputImageType::PixelType inputPixel;
102 | typename InputImageType::IndexType inputIndex;
103 | const unsigned int VectorComponentDimension = reader->GetOutput()->GetNumberOfComponentsPerPixel();
104 |
105 | if(inputMask != "")
106 | {
107 | typename MaskReaderType::Pointer maskReader = MaskReaderType::New();
108 | maskReader->SetFileName( inputMask );
109 | maskReader->Update();
110 | typename itk::ImageRegionConstIterator< InputMaskType > maskIt( maskReader->GetOutput(), maskReader->GetOutput()->GetRequestedRegion());
111 | maskIt.GoToBegin ();
112 | if(secondInputVolume != "")
113 | {
114 | typename ReaderType::Pointer secondReader = ReaderType::New();
115 | secondReader->SetFileName( secondInputVolume );
116 | secondReader->Update();
117 | typename itk::ImageRegionConstIterator< InputImageType > secInIt( secondReader->GetOutput(), secondReader->GetOutput()->GetRequestedRegion());
118 | secInIt.GoToBegin ();
119 | const unsigned int SecondVectorComponentDimension = secondReader->GetOutput()->GetNumberOfComponentsPerPixel();
120 |
121 | if(thirdInputVolume != "")
122 | {
123 | typename ReaderType::Pointer thirdReader = ReaderType::New();
124 | thirdReader->SetFileName( thirdInputVolume );
125 | thirdReader->Update();
126 | typename itk::ImageRegionConstIterator< InputImageType > thirdInIt( thirdReader->GetOutput(), thirdReader->GetOutput()->GetRequestedRegion());
127 | thirdInIt.GoToBegin ();
128 | const unsigned int ThirdVectorComponentDimension = thirdReader->GetOutput()->GetNumberOfComponentsPerPixel();
129 |
130 | /// Mask + Input Volume + second and third Input Volume ///
131 | while ( !inIt.IsAtEnd() )
132 | {
133 | if(maskIt.Get() != 0)
134 | {
135 | inputIndex = inIt.GetIndex();
136 | for( unsigned int i = 0; i < Dimension; i++ )
137 | {
138 | outputFile<SetFileName( secondInputVolume );
231 | secondReader->Update();
232 | typename itk::ImageRegionConstIterator< InputImageType > secInIt( secondReader->GetOutput(), secondReader->GetOutput()->GetRequestedRegion());
233 | secInIt.GoToBegin ();
234 | const unsigned int SecondVectorComponentDimension = reader->GetOutput()->GetNumberOfComponentsPerPixel();
235 |
236 | if(thirdInputVolume != "")
237 | {
238 | typename ReaderType::Pointer thirdReader = ReaderType::New();
239 | thirdReader->SetFileName( thirdInputVolume );
240 | thirdReader->Update();
241 | typename itk::ImageRegionConstIterator< InputImageType > thirdInIt( thirdReader->GetOutput(), thirdReader->GetOutput()->GetRequestedRegion());
242 | thirdInIt.GoToBegin ();
243 | const unsigned int ThirdVectorComponentDimension = thirdReader->GetOutput()->GetNumberOfComponentsPerPixel();
244 |
245 | /// Input Volume + second and third Input Volume ///
246 | while ( !inIt.IsAtEnd() )
247 | {
248 | inputIndex = inIt.GetIndex();
249 | for( unsigned int i = 0; i < Dimension; i++ )
250 | {
251 | outputFile<( argc, argv );
357 | break;
358 | case itk::ImageIOBase::USHORT:
359 | return DoIt< int >( argc, argv );
360 | break;
361 | case itk::ImageIOBase::SHORT:
362 | return DoIt< int >( argc, argv );
363 | break;
364 | case itk::ImageIOBase::FLOAT:
365 | return DoIt< float >( argc, argv );
366 | break;
367 | case itk::ImageIOBase::INT:
368 | return DoIt< int >( argc, argv );
369 | break;
370 | default:
371 | std::cerr << "Unknown input image pixel component type: "
372 | << itk::ImageIOBase::GetComponentTypeAsString( inputComponentType )
373 | << std::endl;
374 | return EXIT_FAILURE;
375 | break;
376 | }
377 | }
378 | catch( itk::ExceptionObject & excep )
379 | {
380 | std::cerr << argv[0] << ": exception caught !" << std::endl;
381 | std::cerr << excep << std::endl;
382 | return EXIT_FAILURE;
383 | }
384 | return EXIT_SUCCESS;
385 | }
386 |
--------------------------------------------------------------------------------
/SaveVectorImageAsCSV/SaveVectorImageAsCSV.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Quantification.Texture Features
4 | Save Vector Image As CSV
5 | 1.0
6 | http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/SaveVectorImageAsCSV
7 |
8 | Jean-Baptiste Vimort, Kitware Inc.
9 | This work was supported by the National Institute of Health (NIH) National Institute for Dental and Craniofacial Research (NIDCR) R01EB021391 (Textural Biomarkers of Arthritis for the Subchondral Bone in the Temporomandibular Joint)
10 |
11 |
12 | Input/output parameters
13 |
14 | inputVolume
15 |
16 | input
17 | 0
18 | Input Volume
19 |
20 |
21 | secondInputVolume
22 |
23 | input
24 | secondInputVolume
25 | a
26 | 2nd Input Volume (Optional)
27 |
28 |
29 | thirdInputVolume
30 |
31 | input
32 | thirdInputVolume
33 | b
34 | Third Input Volume (Optional)
35 |
36 |
37 | inputMask
38 |
39 | inputMask
40 | input
41 | s
42 | A mask defining the region over which texture features will be calculated
43 |
44 |
45 |
46 | predefineTitle
47 |
48 | predefineTitle
49 | input
50 | p
51 | Add the names of the features computed in BoneTextureExtension (GLCM the GLRLM)
52 |
53 |
54 |
55 | outputFileBaseName
56 |
57 | output
58 | 1
59 | Output File Base Name
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/SaveVectorImageAsCSV/Testing/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(Cxx)
2 |
--------------------------------------------------------------------------------
/SaveVectorImageAsCSV/Testing/Cxx/CMakeLists.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kitware/BoneTextureExtension/3410506efaa404131f7b02aa70769f537b1f2b3d/SaveVectorImageAsCSV/Testing/Cxx/CMakeLists.txt
--------------------------------------------------------------------------------
/SeparateVectorImage/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #-----------------------------------------------------------------------------
2 | set(MODULE_NAME SeparateVectorImage)
3 |
4 | #-----------------------------------------------------------------------------
5 |
6 | #
7 | # SlicerExecutionModel
8 | #
9 | find_package(SlicerExecutionModel REQUIRED)
10 | include(${SlicerExecutionModel_USE_FILE})
11 |
12 | #
13 | # ITK
14 | #
15 | set(${PROJECT_NAME}_ITK_COMPONENTS
16 | ITKIOImageBase
17 | ITKCommon
18 | ITKStatistics
19 | ITKImageGrid
20 | ITKImageSources
21 | ITKTestKernel
22 | ITKMetaIO
23 | ITKImageIntensity
24 | )
25 | find_package(ITK 4.9 COMPONENTS ${${PROJECT_NAME}_ITK_COMPONENTS} REQUIRED)
26 | if(ITK_VERSION VERSION_GREATER_EQUAL "5.3")
27 | foreach(factory_uc IN ITEMS "IMAGEIO" "MESHIO" "TRANSFORMIO")
28 | set(ITK_NO_${factory_uc}_FACTORY_REGISTER_MANAGER 1)
29 | endforeach()
30 | else()
31 | set(ITK_NO_IO_FACTORY_REGISTER_MANAGER 1) # See Libs/ITKFactoryRegistration/CMakeLists.txt
32 | endif()
33 | include(${ITK_USE_FILE})
34 |
35 | #-----------------------------------------------------------------------------
36 | set(MODULE_INCLUDE_DIRECTORIES
37 | ${CMAKE_CURRENT_SOURCE_DIR}/../include
38 | )
39 |
40 | set(MODULE_SRCS
41 | )
42 |
43 | set(MODULE_TARGET_LIBRARIES
44 | ${ITK_LIBRARIES}
45 | )
46 |
47 | #-----------------------------------------------------------------------------
48 | SEMMacroBuildCLI(
49 | NAME ${MODULE_NAME}
50 | TARGET_LIBRARIES ${MODULE_TARGET_LIBRARIES}
51 | INCLUDE_DIRECTORIES ${MODULE_INCLUDE_DIRECTORIES}
52 | ADDITIONAL_SRCS ${MODULE_SRCS}
53 | )
54 |
55 | #-----------------------------------------------------------------------------
56 | if(BUILD_TESTING)
57 | add_subdirectory(Testing)
58 | endif()
59 |
--------------------------------------------------------------------------------
/SeparateVectorImage/SeparateVectorImage.cxx:
--------------------------------------------------------------------------------
1 | /*=========================================================================
2 | *
3 | * Copyright Insight Software Consortium
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0.txt
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | *
17 | *=========================================================================*/
18 |
19 |
20 | // Use an anonymous namespace to keep class types and function names
21 | // from colliding when module is used as shared object module. Every
22 | // thing should be in an anonymous namespace except for the module
23 | // entry point, e.g. main()
24 | //
25 |
26 | #include "itkImageFileReader.h"
27 | #include "itkImageFileWriter.h"
28 | #include "itkFloatingPointExceptions.h"
29 | #include "itkImage.h"
30 | #include "itkVector.h"
31 | #include "itkNeighborhood.h"
32 | #include "itkMetaDataDictionary.h"
33 | #include "itkMetaDataObject.h"
34 |
35 | #include "itkVectorIndexSelectionCastImageFilter.h"
36 |
37 | #include "itkPluginUtilities.h"
38 |
39 | #include "SeparateVectorImageCLP.h"
40 |
41 | // Feature name lists for GLCM, GLRM, and BM
42 | std::vector GLCMFeatures = {"Energy", "Entropy", "Correlation", "InverseDifferenceMoment",
43 | "Inertia", "ClusterShade", "ClusterProminence", "HaralickCorrelation"};
44 |
45 | std::vector RLFeatures = {"ShortRunEmphasis", "LongRunEmphasis",
46 | "GreyLevelNonuniformity", "RunLengthNonuniformity",
47 | "LowGreyLevelRunEmphasis", "HighGreyLevelRunEmphasis",
48 | "ShortRunLowGreyLevelEmphasis", "ShortRunHighGreyLevelEmphasis",
49 | "LongRunLowGreyLevelEmphasis", "LongRunHighGreyLevelEmphasis"};
50 |
51 | std::vector BMFeatures = {"BoneVolumeDensity", "TrabecularThickness",
52 | "TrabecularSeparation", "TrabecularNumber", "BoneSurfaceDensity"};
53 |
54 | namespace
55 | {
56 |
57 | template< typename TPixel >
58 | int DoIt( int argc, char * argv[] )
59 | {
60 | PARSE_ARGS;
61 |
62 | const unsigned int Dimension = 3;
63 |
64 | typedef TPixel PixelType;
65 | typedef itk::VectorImage< PixelType, Dimension > InputImageType;
66 | typedef itk::Image< PixelType, Dimension > OutputImageType;
67 |
68 | typedef itk::ImageFileReader< InputImageType > ReaderType;
69 | typename ReaderType::Pointer reader = ReaderType::New();
70 | reader->SetFileName( inputVolume );
71 | reader->Update();
72 |
73 | unsigned int VectorComponentDimension = reader->GetOutput()->GetNumberOfComponentsPerPixel();
74 |
75 | typedef itk::VectorIndexSelectionCastImageFilter< InputImageType, OutputImageType > IndexSelectionType;
76 | typename IndexSelectionType::Pointer indexSelectionFilter = IndexSelectionType::New();
77 | indexSelectionFilter->SetInput( reader->GetOutput() );
78 |
79 | // Select the appropriate feature name list based on VectorComponentDimension
80 | std::vector featureNames;
81 |
82 | if (VectorComponentDimension == 8) {
83 | featureNames = GLCMFeatures;
84 | } else if (VectorComponentDimension == 10) {
85 | featureNames = RLFeatures;
86 | } else if (VectorComponentDimension == 5) {
87 | featureNames = BMFeatures;
88 | } else {
89 | for (unsigned int i = 1; i <= VectorComponentDimension; ++i) {
90 | std::ostringstream ss;
91 | ss << i;
92 | featureNames.push_back(ss.str());
93 | }
94 | }
95 |
96 | for( unsigned int i = 0; i < VectorComponentDimension; i++ )
97 | {
98 | indexSelectionFilter->SetIndex(i);
99 |
100 | // Create and set up a writer
101 | typedef itk::ImageFileWriter< OutputImageType > WriterType;
102 | typename WriterType::Pointer writer = WriterType::New();
103 | std::string outputFilename = outputFileBaseName.c_str();;
104 | std::string suffix = featureNames[i];
105 | writer->SetFileName( outputFilename + "_" + suffix + ".nrrd" );
106 | writer->SetInput( indexSelectionFilter->GetOutput() );
107 |
108 | writer->Update();
109 | }
110 |
111 |
112 |
113 | return EXIT_SUCCESS;
114 | }
115 |
116 | } // end of anonymous namespace
117 |
118 | int main( int argc, char * argv[] )
119 | {
120 | PARSE_ARGS;
121 |
122 | itk::ImageIOBase::IOPixelType inputPixelType;
123 | itk::ImageIOBase::IOComponentType inputComponentType;
124 | itk::FloatingPointExceptions::Enable();
125 | itk::FloatingPointExceptions::SetExceptionAction( itk::FloatingPointExceptions::ABORT );
126 |
127 | try
128 | {
129 |
130 | itk::GetImageType(inputVolume, inputPixelType, inputComponentType);
131 |
132 | switch( inputComponentType )
133 | {
134 | case itk::ImageIOBase::UCHAR:
135 | return DoIt< int >( argc, argv );
136 | break;
137 | case itk::ImageIOBase::USHORT:
138 | return DoIt< int >( argc, argv );
139 | break;
140 | case itk::ImageIOBase::SHORT:
141 | return DoIt< int >( argc, argv );
142 | break;
143 | case itk::ImageIOBase::FLOAT:
144 | return DoIt< float >( argc, argv );
145 | break;
146 | case itk::ImageIOBase::INT:
147 | return DoIt< int >( argc, argv );
148 | break;
149 | default:
150 | std::cerr << "Unknown input image pixel component type: "
151 | << itk::ImageIOBase::GetComponentTypeAsString( inputComponentType )
152 | << std::endl;
153 | return EXIT_FAILURE;
154 | break;
155 | }
156 | }
157 | catch( itk::ExceptionObject & excep )
158 | {
159 | std::cerr << argv[0] << ": exception caught !" << std::endl;
160 | std::cerr << excep << std::endl;
161 | return EXIT_FAILURE;
162 | }
163 | return EXIT_SUCCESS;
164 | }
165 |
--------------------------------------------------------------------------------
/SeparateVectorImage/SeparateVectorImage.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Quantification.Texture Features
4 | Separate Vector Image
5 | 1.0
6 | http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/SeparateVectorImage
7 |
8 | Jean-Baptiste Vimort, Kitware Inc.
9 | This work was supported by the National Institute of Health (NIH) National Institute for Dental and Craniofacial Research (NIDCR) R01EB021391 (Textural Biomarkers of Arthritis for the Subchondral Bone in the Temporomandibular Joint)
10 |
11 |
12 | Input/output parameters
13 |
14 | inputVolume
15 |
16 | input
17 | 0
18 | Input Volume
19 |
20 |
21 | outputFileBaseName
22 |
23 | output
24 | 1
25 | Output File Base Name
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/SeparateVectorImage/Testing/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(Cxx)
2 |
--------------------------------------------------------------------------------
/SeparateVectorImage/Testing/Cxx/CMakeLists.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kitware/BoneTextureExtension/3410506efaa404131f7b02aa70769f537b1f2b3d/SeparateVectorImage/Testing/Cxx/CMakeLists.txt
--------------------------------------------------------------------------------
/SuperBuild.cmake:
--------------------------------------------------------------------------------
1 | #-----------------------------------------------------------------------------
2 | # Enable and setup External project global properties
3 | #-----------------------------------------------------------------------------
4 |
5 | set(ep_common_c_flags "${CMAKE_C_FLAGS_INIT} ${ADDITIONAL_C_FLAGS}")
6 | set(ep_common_cxx_flags "${CMAKE_CXX_FLAGS_INIT} ${ADDITIONAL_CXX_FLAGS}")
7 |
8 | #-----------------------------------------------------------------------------
9 | # Project dependencies
10 | #-----------------------------------------------------------------------------
11 |
12 | # Extension dependencies
13 | foreach(dep ${EXTENSION_DEPENDS})
14 | mark_as_superbuild(${dep}_DIR)
15 | endforeach()
16 |
17 | set(proj ${SUPERBUILD_TOPLEVEL_PROJECT})
18 |
19 | # Project dependencies
20 | set(${proj}_DEPENDS
21 | ITKBoneMorphometry
22 | ITKTextureFeature
23 | )
24 |
25 | ExternalProject_Include_Dependencies(${proj}
26 | PROJECT_VAR proj
27 | SUPERBUILD_VAR ${EXTENSION_NAME}_SUPERBUILD
28 | )
29 |
30 | ExternalProject_Add(${proj}
31 | ${${proj}_EP_ARGS}
32 | DOWNLOAD_COMMAND ""
33 | INSTALL_COMMAND ""
34 | SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
35 | BINARY_DIR ${EXTENSION_BUILD_SUBDIRECTORY}
36 | BUILD_ALWAYS 1
37 | CMAKE_CACHE_ARGS
38 | # Compiler settings
39 | -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
40 | -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags}
41 | -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
42 | -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags}
43 | -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD}
44 | -DCMAKE_CXX_STANDARD_REQUIRED:BOOL=${CMAKE_CXX_STANDARD_REQUIRED}
45 | -DCMAKE_CXX_EXTENSIONS:BOOL=${CMAKE_CXX_EXTENSIONS}
46 | # Output directories
47 | -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
48 | -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
49 | -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
50 | # Packaging
51 | -DMIDAS_PACKAGE_EMAIL:STRING=${MIDAS_PACKAGE_EMAIL}
52 | -DMIDAS_PACKAGE_API_KEY:STRING=${MIDAS_PACKAGE_API_KEY}
53 | # Superbuild
54 | -D${EXTENSION_NAME}_SUPERBUILD:BOOL=OFF
55 | -DEXTENSION_SUPERBUILD_BINARY_DIR:PATH=${${EXTENSION_NAME}_BINARY_DIR}
56 | DEPENDS
57 | ${${proj}_DEPENDS}
58 | )
59 |
60 |
--------------------------------------------------------------------------------
/SuperBuild/External_ITKBoneMorphometry.cmake:
--------------------------------------------------------------------------------
1 |
2 | set(proj ITKBoneMorphometry)
3 |
4 | # Set dependency list
5 | set(${proj}_DEPENDS
6 | ""
7 | )
8 |
9 | # Include dependent projects if any
10 | ExternalProject_Include_Dependencies(${proj} PROJECT_VAR proj DEPENDS_VAR ${proj}_DEPENDENCIES)
11 |
12 | if(${SUPERBUILD_TOPLEVEL_PROJECT}_USE_SYSTEM_${proj})
13 | message(FATAL_ERROR "Enabling ${SUPERBUILD_TOPLEVEL_PROJECT}_USE_SYSTEM_${proj} is not supported !")
14 | endif()
15 |
16 | # Sanity checks
17 | if(DEFINED ITKBoneMorphometry_DIR AND NOT EXISTS ${ITKBoneMorphometry_DIR})
18 | message(FATAL_ERROR "ITKBoneMorphometry_DIR [${ITKBoneMorphometry_DIR}] variable is defined but corresponds to nonexistent directory")
19 | endif()
20 |
21 |
22 | if(NOT DEFINED ${proj}_DIR AND NOT ${SUPERBUILD_TOPLEVEL_PROJECT}_USE_SYSTEM_${proj})
23 |
24 | ExternalProject_SetIfNotDefined(
25 | ${SUPERBUILD_TOPLEVEL_PROJECT}_${proj}_GIT_REPOSITORY
26 | "${EP_GIT_PROTOCOL}://github.com/InsightSoftwareConsortium/ITKBoneMorphometry.git"
27 | QUIET
28 | )
29 |
30 | ExternalProject_SetIfNotDefined(
31 | ${SUPERBUILD_TOPLEVEL_PROJECT}_${proj}_GIT_TAG
32 | "7d4314f12a4682b2d995a628610eb7986d2e55de"
33 | QUIET
34 | )
35 |
36 | set(EP_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj})
37 | set(EP_BINARY_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
38 |
39 | ExternalProject_Add(${proj}
40 | ${${proj}_EP_ARGS}
41 | GIT_REPOSITORY "${${SUPERBUILD_TOPLEVEL_PROJECT}_${proj}_GIT_REPOSITORY}"
42 | GIT_TAG "${${SUPERBUILD_TOPLEVEL_PROJECT}_${proj}_GIT_TAG}"
43 | SOURCE_DIR ${EP_SOURCE_DIR}
44 | BINARY_DIR ${EP_BINARY_DIR}
45 | CMAKE_CACHE_ARGS
46 | # Compiler settings
47 | -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
48 | -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags}
49 | -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
50 | -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags}
51 | -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD}
52 | -DCMAKE_CXX_STANDARD_REQUIRED:BOOL=${CMAKE_CXX_STANDARD_REQUIRED}
53 | -DCMAKE_CXX_EXTENSIONS:BOOL=${CMAKE_CXX_EXTENSIONS}
54 | # Output directories
55 | -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_BINARY_DIR}/${Slicer_THIRDPARTY_BIN_DIR}
56 | -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_BINARY_DIR}/${Slicer_THIRDPARTY_LIB_DIR}
57 | # Install directories
58 | -DITK_INSTALL_RUNTIME_DIR:STRING=${Slicer_INSTALL_THIRDPARTY_LIB_DIR}
59 | -DITK_INSTALL_LIBRARY_DIR:STRING=${Slicer_INSTALL_THIRDPARTY_LIB_DIR}
60 | # Options
61 | -DBUILD_TESTING:BOOL=OFF
62 | # Dependencies
63 | -DITK_DIR:PATH=${ITK_DIR}
64 | -DPYTHON_EXECUTABLE:FILEPATH=${PYTHON_EXECUTABLE}
65 | -DPYTHON_INCLUDE_DIR:PATH=${PYTHON_INCLUDE_DIR}
66 | -DPYTHON_LIBRARY:FILEPATH=${PYTHON_LIBRARY}
67 | INSTALL_COMMAND ""
68 | DEPENDS
69 | ${${proj}_DEPENDS}
70 | )
71 | set(${proj}_DIR ${EP_BINARY_DIR})
72 |
73 | else()
74 | ExternalProject_Add_Empty(${proj} DEPENDS ${${proj}_DEPENDS})
75 | endif()
76 |
77 | mark_as_superbuild(${proj}_DIR:PATH)
78 | ExternalProject_Message(${proj} "${proj}_DIR:${${proj}_DIR}")
79 |
--------------------------------------------------------------------------------
/SuperBuild/External_ITKTextureFeature.cmake:
--------------------------------------------------------------------------------
1 |
2 | set(proj ITKTextureFeature)
3 |
4 | # Set dependency list
5 | set(${proj}_DEPENDS
6 | ""
7 | )
8 |
9 | # Include dependent projects if any
10 | ExternalProject_Include_Dependencies(${proj} PROJECT_VAR proj DEPENDS_VAR ${proj}_DEPENDENCIES)
11 |
12 | if(${SUPERBUILD_TOPLEVEL_PROJECT}_USE_SYSTEM_${proj})
13 | message(FATAL_ERROR "Enabling ${SUPERBUILD_TOPLEVEL_PROJECT}_USE_SYSTEM_${proj} is not supported !")
14 | endif()
15 |
16 | # Sanity checks
17 | if(DEFINED ITKTextureFeature_DIR AND NOT EXISTS ${ITKTextureFeature_DIR})
18 | message(FATAL_ERROR "ITKTextureFeature_DIR [${ITKTextureFeature_DIR}] variable is defined but corresponds to nonexistent directory")
19 | endif()
20 |
21 |
22 | if(NOT DEFINED ${proj}_DIR AND NOT ${SUPERBUILD_TOPLEVEL_PROJECT}_USE_SYSTEM_${proj})
23 |
24 | ExternalProject_SetIfNotDefined(
25 | ${SUPERBUILD_TOPLEVEL_PROJECT}_${proj}_GIT_REPOSITORY
26 | "${EP_GIT_PROTOCOL}://github.com/InsightSoftwareConsortium/ITKTextureFeatures.git"
27 | QUIET
28 | )
29 |
30 | ExternalProject_SetIfNotDefined(
31 | ${SUPERBUILD_TOPLEVEL_PROJECT}_${proj}_GIT_TAG
32 | "7643fb34ced0b40ad7eb0f2a28d56a3a2941cc0f"
33 | QUIET
34 | )
35 |
36 | set(EP_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj})
37 | set(EP_BINARY_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
38 |
39 | ExternalProject_Add(${proj}
40 | ${${proj}_EP_ARGS}
41 | GIT_REPOSITORY "${${SUPERBUILD_TOPLEVEL_PROJECT}_${proj}_GIT_REPOSITORY}"
42 | GIT_TAG "${${SUPERBUILD_TOPLEVEL_PROJECT}_${proj}_GIT_TAG}"
43 | SOURCE_DIR ${EP_SOURCE_DIR}
44 | BINARY_DIR ${EP_BINARY_DIR}
45 | CMAKE_CACHE_ARGS
46 | # Compiler settings
47 | -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
48 | -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags}
49 | -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
50 | -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags}
51 | -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD}
52 | -DCMAKE_CXX_STANDARD_REQUIRED:BOOL=${CMAKE_CXX_STANDARD_REQUIRED}
53 | -DCMAKE_CXX_EXTENSIONS:BOOL=${CMAKE_CXX_EXTENSIONS}
54 | # Install directories
55 | -DITK_INSTALL_RUNTIME_DIR:STRING=${Slicer_INSTALL_LIB_DIR}
56 | -DITK_INSTALL_LIBRARY_DIR:STRING=${Slicer_INSTALL_LIB_DIR}
57 | # Options
58 | -DBUILD_TESTING:BOOL=OFF
59 | # Dependencies
60 | -DITK_DIR:PATH=${ITK_DIR}
61 | -DPYTHON_EXECUTABLE:FILEPATH=${PYTHON_EXECUTABLE}
62 | -DPYTHON_INCLUDE_DIR:PATH=${PYTHON_INCLUDE_DIR}
63 | -DPYTHON_LIBRARY:FILEPATH=${PYTHON_LIBRARY}
64 | INSTALL_COMMAND ""
65 | DEPENDS
66 | ${${proj}_DEPENDS}
67 | )
68 | set(${proj}_DIR ${EP_BINARY_DIR})
69 |
70 | else()
71 | ExternalProject_Add_Empty(${proj} DEPENDS ${${proj}_DEPENDS})
72 | endif()
73 |
74 | mark_as_superbuild(${proj}_DIR:PATH)
75 | ExternalProject_Message(${proj} "${proj}_DIR:${${proj}_DIR}")
76 |
--------------------------------------------------------------------------------