├── CMakeLists.txt ├── DRRGenerator.png ├── DRRGeneratorModule ├── CMakeLists.txt ├── Logic │ ├── CMakeLists.txt │ ├── vtkSlicerDRRGeneratorModuleLogic.cxx │ └── vtkSlicerDRRGeneratorModuleLogic.h ├── Resources │ ├── Icons │ │ └── DRRGeneratorModule.png │ ├── UI │ │ ├── qSlicerDRRGeneratorModuleFooBarWidget.ui │ │ └── qSlicerDRRGeneratorModuleModuleWidget.ui │ └── qSlicerDRRGeneratorModuleModule.qrc ├── Testing │ ├── CMakeLists.txt │ └── Cxx │ │ └── CMakeLists.txt ├── Widgets │ ├── CMakeLists.txt │ ├── qSlicerDRRGeneratorModuleFooBarWidget.cxx │ └── qSlicerDRRGeneratorModuleFooBarWidget.h ├── qSlicerDRRGeneratorModuleModule.cxx ├── qSlicerDRRGeneratorModuleModule.h ├── qSlicerDRRGeneratorModuleModuleWidget.cxx └── qSlicerDRRGeneratorModuleModuleWidget.h └── README.md /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | 3 | project(DRRGenerator) 4 | 5 | #----------------------------------------------------------------------------- 6 | # Extension meta-information 7 | set(EXTENSION_HOMEPAGE "https://slicerdrrregistration.000webhostapp.com/drrgenerator") 8 | set(EXTENSION_CATEGORY "Filtering") 9 | set(EXTENSION_CONTRIBUTORS "Lance Levine") 10 | set(EXTENSION_DESCRIPTION "This extension allows the user to generate DRRs via a highly customizable GUI") 11 | set(EXTENSION_ICONURL "https://slicerdrrregistration.000webhostapp.com/wp-content/uploads/2020/01/DRRGenerator.png") 12 | set(EXTENSION_SCREENSHOTURLS "https://slicerdrrregistration.000webhostapp.com/wp-content/uploads/2020/01/screenshot-1024x556.png") 13 | set(EXTENSION_DEPENDS "NA") # Specified as a space separated string, a list or 'NA' if any 14 | 15 | #----------------------------------------------------------------------------- 16 | # Extension dependencies 17 | find_package(Slicer REQUIRED) 18 | include(${Slicer_USE_FILE}) 19 | 20 | #----------------------------------------------------------------------------- 21 | # Extension modules 22 | add_subdirectory(DRRGeneratorModule) 23 | ## NEXT_MODULE 24 | 25 | #----------------------------------------------------------------------------- 26 | include(${Slicer_EXTENSION_GENERATE_CONFIG}) 27 | include(${Slicer_EXTENSION_CPACK}) 28 | -------------------------------------------------------------------------------- /DRRGenerator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lancelevine/SlicerDRRGenerator/6ac5f40e0655dfd34437055d8c3bc98b278053a0/DRRGenerator.png -------------------------------------------------------------------------------- /DRRGeneratorModule/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | #----------------------------------------------------------------------------- 3 | set(MODULE_NAME DRRGeneratorModule) 4 | set(MODULE_TITLE ${MODULE_NAME}) 5 | 6 | string(TOUPPER ${MODULE_NAME} MODULE_NAME_UPPER) 7 | 8 | #----------------------------------------------------------------------------- 9 | add_subdirectory(Logic) 10 | add_subdirectory(Widgets) 11 | 12 | #----------------------------------------------------------------------------- 13 | set(MODULE_EXPORT_DIRECTIVE "Q_SLICER_QTMODULES_${MODULE_NAME_UPPER}_EXPORT") 14 | 15 | # Current_{source,binary} and Slicer_{Libs,Base} already included 16 | set(MODULE_INCLUDE_DIRECTORIES 17 | ${CMAKE_CURRENT_SOURCE_DIR}/Logic 18 | ${CMAKE_CURRENT_BINARY_DIR}/Logic 19 | ${CMAKE_CURRENT_SOURCE_DIR}/Widgets 20 | ${CMAKE_CURRENT_BINARY_DIR}/Widgets 21 | ) 22 | 23 | set(MODULE_SRCS 24 | qSlicer${MODULE_NAME}Module.cxx 25 | qSlicer${MODULE_NAME}Module.h 26 | qSlicer${MODULE_NAME}ModuleWidget.cxx 27 | qSlicer${MODULE_NAME}ModuleWidget.h 28 | ) 29 | 30 | set(MODULE_MOC_SRCS 31 | qSlicer${MODULE_NAME}Module.h 32 | qSlicer${MODULE_NAME}ModuleWidget.h 33 | ) 34 | 35 | set(MODULE_UI_SRCS 36 | Resources/UI/qSlicer${MODULE_NAME}ModuleWidget.ui 37 | ) 38 | 39 | set(MODULE_TARGET_LIBRARIES 40 | vtkSlicer${MODULE_NAME}ModuleLogic 41 | qSlicer${MODULE_NAME}ModuleWidgets 42 | ) 43 | 44 | set(MODULE_RESOURCES 45 | Resources/qSlicer${MODULE_NAME}Module.qrc 46 | ) 47 | 48 | #----------------------------------------------------------------------------- 49 | slicerMacroBuildLoadableModule( 50 | NAME ${MODULE_NAME} 51 | TITLE ${MODULE_TITLE} 52 | EXPORT_DIRECTIVE ${MODULE_EXPORT_DIRECTIVE} 53 | INCLUDE_DIRECTORIES ${MODULE_INCLUDE_DIRECTORIES} 54 | SRCS ${MODULE_SRCS} 55 | MOC_SRCS ${MODULE_MOC_SRCS} 56 | UI_SRCS ${MODULE_UI_SRCS} 57 | TARGET_LIBRARIES ${MODULE_TARGET_LIBRARIES} 58 | RESOURCES ${MODULE_RESOURCES} 59 | WITH_GENERIC_TESTS 60 | ) 61 | 62 | #----------------------------------------------------------------------------- 63 | if(BUILD_TESTING) 64 | add_subdirectory(Testing) 65 | endif() 66 | -------------------------------------------------------------------------------- /DRRGeneratorModule/Logic/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(vtkSlicer${MODULE_NAME}ModuleLogic) 2 | 3 | set(KIT ${PROJECT_NAME}) 4 | 5 | set(${KIT}_EXPORT_DIRECTIVE "VTK_SLICER_${MODULE_NAME_UPPER}_MODULE_LOGIC_EXPORT") 6 | 7 | set(${KIT}_INCLUDE_DIRECTORIES 8 | ) 9 | 10 | set(${KIT}_SRCS 11 | vtkSlicer${MODULE_NAME}Logic.cxx 12 | vtkSlicer${MODULE_NAME}Logic.h 13 | ) 14 | 15 | set(${KIT}_TARGET_LIBRARIES 16 | ${ITK_LIBRARIES} 17 | ) 18 | 19 | #----------------------------------------------------------------------------- 20 | SlicerMacroBuildModuleLogic( 21 | NAME ${KIT} 22 | EXPORT_DIRECTIVE ${${KIT}_EXPORT_DIRECTIVE} 23 | INCLUDE_DIRECTORIES ${${KIT}_INCLUDE_DIRECTORIES} 24 | SRCS ${${KIT}_SRCS} 25 | TARGET_LIBRARIES ${${KIT}_TARGET_LIBRARIES} 26 | ) 27 | -------------------------------------------------------------------------------- /DRRGeneratorModule/Logic/vtkSlicerDRRGeneratorModuleLogic.cxx: -------------------------------------------------------------------------------- 1 | /*============================================================================== 2 | 3 | Program: 3D Slicer 4 | 5 | Portions (c) Copyright Brigham and Women's Hospital (BWH) All Rights Reserved. 6 | 7 | See COPYRIGHT.txt 8 | or http://www.slicer.org/copyright/copyright.txt for details. 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | ==============================================================================*/ 17 | 18 | // DRRGeneratorModule Logic includes 19 | #include "vtkSlicerDRRGeneratorModuleLogic.h" 20 | 21 | // MRML includes 22 | #include 23 | 24 | // VTK includes 25 | #include 26 | #include 27 | #include 28 | 29 | // STD includes 30 | #include 31 | 32 | //---------------------------------------------------------------------------- 33 | vtkStandardNewMacro(vtkSlicerDRRGeneratorModuleLogic); 34 | 35 | //---------------------------------------------------------------------------- 36 | vtkSlicerDRRGeneratorModuleLogic::vtkSlicerDRRGeneratorModuleLogic() 37 | { 38 | } 39 | 40 | //---------------------------------------------------------------------------- 41 | vtkSlicerDRRGeneratorModuleLogic::~vtkSlicerDRRGeneratorModuleLogic() 42 | { 43 | } 44 | 45 | //---------------------------------------------------------------------------- 46 | void vtkSlicerDRRGeneratorModuleLogic::PrintSelf(ostream& os, vtkIndent indent) 47 | { 48 | this->Superclass::PrintSelf(os, indent); 49 | } 50 | 51 | //--------------------------------------------------------------------------- 52 | void vtkSlicerDRRGeneratorModuleLogic::SetMRMLSceneInternal(vtkMRMLScene * newScene) 53 | { 54 | vtkNew events; 55 | events->InsertNextValue(vtkMRMLScene::NodeAddedEvent); 56 | events->InsertNextValue(vtkMRMLScene::NodeRemovedEvent); 57 | events->InsertNextValue(vtkMRMLScene::EndBatchProcessEvent); 58 | this->SetAndObserveMRMLSceneEventsInternal(newScene, events.GetPointer()); 59 | } 60 | 61 | //----------------------------------------------------------------------------- 62 | void vtkSlicerDRRGeneratorModuleLogic::RegisterNodes() 63 | { 64 | assert(this->GetMRMLScene() != 0); 65 | } 66 | 67 | //--------------------------------------------------------------------------- 68 | void vtkSlicerDRRGeneratorModuleLogic::UpdateFromMRMLScene() 69 | { 70 | assert(this->GetMRMLScene() != 0); 71 | } 72 | 73 | //--------------------------------------------------------------------------- 74 | void vtkSlicerDRRGeneratorModuleLogic 75 | ::OnMRMLSceneNodeAdded(vtkMRMLNode* vtkNotUsed(node)) 76 | { 77 | } 78 | 79 | //--------------------------------------------------------------------------- 80 | void vtkSlicerDRRGeneratorModuleLogic 81 | ::OnMRMLSceneNodeRemoved(vtkMRMLNode* vtkNotUsed(node)) 82 | { 83 | } 84 | -------------------------------------------------------------------------------- /DRRGeneratorModule/Logic/vtkSlicerDRRGeneratorModuleLogic.h: -------------------------------------------------------------------------------- 1 | /*============================================================================== 2 | 3 | Program: 3D Slicer 4 | 5 | Portions (c) Copyright Brigham and Women's Hospital (BWH) All Rights Reserved. 6 | 7 | See COPYRIGHT.txt 8 | or http://www.slicer.org/copyright/copyright.txt for details. 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | ==============================================================================*/ 17 | 18 | // .NAME vtkSlicerDRRGeneratorModuleLogic - slicer logic class for volumes manipulation 19 | // .SECTION Description 20 | // This class manages the logic associated with reading, saving, 21 | // and changing propertied of the volumes 22 | 23 | 24 | #ifndef __vtkSlicerDRRGeneratorModuleLogic_h 25 | #define __vtkSlicerDRRGeneratorModuleLogic_h 26 | 27 | // Slicer includes 28 | #include "vtkSlicerModuleLogic.h" 29 | 30 | // MRML includes 31 | 32 | // STD includes 33 | #include 34 | 35 | #include "vtkSlicerDRRGeneratorModuleModuleLogicExport.h" 36 | 37 | 38 | /// \ingroup Slicer_QtModules_ExtensionTemplate 39 | class VTK_SLICER_DRRGENERATORMODULE_MODULE_LOGIC_EXPORT vtkSlicerDRRGeneratorModuleLogic : 40 | public vtkSlicerModuleLogic 41 | { 42 | public: 43 | 44 | static vtkSlicerDRRGeneratorModuleLogic *New(); 45 | vtkTypeMacro(vtkSlicerDRRGeneratorModuleLogic, vtkSlicerModuleLogic); 46 | void PrintSelf(ostream& os, vtkIndent indent); 47 | 48 | protected: 49 | vtkSlicerDRRGeneratorModuleLogic(); 50 | virtual ~vtkSlicerDRRGeneratorModuleLogic(); 51 | 52 | virtual void SetMRMLSceneInternal(vtkMRMLScene* newScene); 53 | /// Register MRML Node classes to Scene. Gets called automatically when the MRMLScene is attached to this logic class. 54 | virtual void RegisterNodes(); 55 | virtual void UpdateFromMRMLScene(); 56 | virtual void OnMRMLSceneNodeAdded(vtkMRMLNode* node); 57 | virtual void OnMRMLSceneNodeRemoved(vtkMRMLNode* node); 58 | private: 59 | 60 | vtkSlicerDRRGeneratorModuleLogic(const vtkSlicerDRRGeneratorModuleLogic&); // Not implemented 61 | void operator=(const vtkSlicerDRRGeneratorModuleLogic&); // Not implemented 62 | }; 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /DRRGeneratorModule/Resources/Icons/DRRGeneratorModule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lancelevine/SlicerDRRGenerator/6ac5f40e0655dfd34437055d8c3bc98b278053a0/DRRGeneratorModule/Resources/Icons/DRRGeneratorModule.png -------------------------------------------------------------------------------- /DRRGeneratorModule/Resources/UI/qSlicerDRRGeneratorModuleFooBarWidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | qSlicerDRRGeneratorModuleFooBarWidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 103 10 | 27 11 | 12 | 13 | 14 | Foo bar 15 | 16 | 17 | 18 | 0 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /DRRGeneratorModule/Resources/UI/qSlicerDRRGeneratorModuleModuleWidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | qSlicerDRRGeneratorModuleModuleWidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 525 10 | 319 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 19 | 20 | 21 | 0 22 | 0 23 | 24 | 25 | 26 | IO 27 | 28 | 29 | 30 | QFormLayout::AllNonFixedFieldsGrow 31 | 32 | 33 | 6 34 | 35 | 36 | 4 37 | 38 | 39 | 40 | 41 | Input volume: 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 0 50 | 0 51 | 52 | 53 | 54 | 55 | vtkMRMLScalarVolumeNode 56 | 57 | 58 | 59 | false 60 | 61 | 62 | false 63 | 64 | 65 | true 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Output volume: 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 0 84 | 0 85 | 86 | 87 | 88 | 89 | vtkMRMLScalarVolumeNode 90 | 91 | 92 | 93 | false 94 | 95 | 96 | true 97 | 98 | 99 | true 100 | 101 | 102 | false 103 | 104 | 105 | true 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 0 121 | 0 122 | 123 | 124 | 125 | DRR Generator 126 | 127 | 128 | 129 | QFormLayout::AllNonFixedFieldsGrow 130 | 131 | 132 | 6 133 | 134 | 135 | 4 136 | 137 | 138 | 139 | 140 | 141 | Rotation: 142 | 143 | 144 | 145 | 146 | 147 | 148 | 0 149 | 150 | 151 | 4 152 | 153 | 154 | 155 | 156 | X: 157 | 158 | 159 | 160 | 161 | 162 | 163 | true 164 | 165 | 166 | 167 | 1 168 | 0 169 | 170 | 171 | 172 | -359 173 | 174 | 175 | 359 176 | 177 | 178 | 90.00 179 | 180 | 181 | 182 | 183 | 184 | 185 | Y: 186 | 187 | 188 | 189 | 190 | 191 | 192 | true 193 | 194 | 195 | 196 | 1 197 | 0 198 | 199 | 200 | 201 | -359 202 | 203 | 204 | 359 205 | 206 | 207 | 208 | 209 | 210 | 211 | Z: 212 | 213 | 214 | 215 | 216 | 217 | 218 | true 219 | 220 | 221 | 222 | 1 223 | 0 224 | 225 | 226 | 227 | -359 228 | 229 | 230 | 359 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | Translation: 241 | 242 | 243 | 244 | 245 | 246 | 247 | 0 248 | 249 | 250 | 4 251 | 252 | 253 | 254 | 255 | X: 256 | 257 | 258 | 259 | 260 | 261 | 262 | true 263 | 264 | 265 | 266 | 1 267 | 0 268 | 269 | 270 | 271 | -1000 272 | 273 | 274 | 1000 275 | 276 | 277 | 278 | 279 | 280 | 281 | Y: 282 | 283 | 284 | 285 | 286 | 287 | 288 | true 289 | 290 | 291 | 292 | 1 293 | 0 294 | 295 | 296 | 297 | -1000 298 | 299 | 300 | 1000 301 | 302 | 303 | 200 304 | 305 | 306 | 307 | 308 | 309 | 310 | Z: 311 | 312 | 313 | 314 | 315 | 316 | 317 | true 318 | 319 | 320 | 321 | 1 322 | 0 323 | 324 | 325 | 326 | -1000 327 | 328 | 329 | 1000 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | Center: 340 | 341 | 342 | 343 | 344 | 345 | 346 | 0 347 | 348 | 349 | 4 350 | 351 | 352 | 353 | 354 | X: 355 | 356 | 357 | 358 | 359 | 360 | 361 | true 362 | 363 | 364 | 365 | 1 366 | 0 367 | 368 | 369 | 370 | -359 371 | 372 | 373 | 359 374 | 375 | 376 | 377 | 378 | 379 | 380 | Y: 381 | 382 | 383 | 384 | 385 | 386 | 387 | true 388 | 389 | 390 | 391 | 1 392 | 0 393 | 394 | 395 | 396 | -359 397 | 398 | 399 | 359 400 | 401 | 402 | 403 | 404 | 405 | 406 | Z: 407 | 408 | 409 | 410 | 411 | 412 | 413 | true 414 | 415 | 416 | 417 | 1 418 | 0 419 | 420 | 421 | 422 | -359 423 | 424 | 425 | 359 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | Parameters: 436 | 437 | 438 | 439 | 440 | 441 | 442 | 0 443 | 444 | 445 | 4 446 | 447 | 448 | 449 | 450 | Focal Point: 451 | 452 | 453 | 454 | 455 | 456 | 457 | true 458 | 459 | 460 | 461 | 1 462 | 0 463 | 464 | 465 | 466 | -1000 467 | 468 | 469 | 1000 470 | 471 | 472 | 400 473 | " 474 | 475 | 476 | 477 | 478 | 479 | Threshold: 480 | 481 | 482 | 483 | 484 | 485 | 486 | true 487 | 488 | 489 | 490 | 1 491 | 0 492 | 493 | 494 | 495 | -1000 496 | 497 | 498 | 1000 499 | 500 | 501 | 0 502 | " 503 | 504 | 505 | 506 | 507 | 508 | Direction: 509 | 510 | 511 | 512 | 513 | 514 | 515 | true 516 | 517 | 518 | 519 | 1 520 | 0 521 | 522 | 523 | 524 | 0 525 | 526 | 527 | 2 528 | 529 | 530 | 2 531 | " 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | DRR Size: 541 | 542 | 543 | 544 | 545 | 546 | 547 | 0 548 | 549 | 550 | 4 551 | 552 | 553 | 554 | 555 | X: 556 | 557 | 558 | 559 | 560 | 561 | 562 | true 563 | 564 | 565 | 566 | 1 567 | 0 568 | 569 | 570 | 571 | 0 572 | 573 | 574 | 1000 575 | 576 | 577 | 512 578 | " 579 | 580 | 581 | 582 | 583 | 584 | Y: 585 | 586 | 587 | 588 | 589 | 590 | 591 | true 592 | 593 | 594 | 595 | 1 596 | 0 597 | 598 | 599 | 600 | 0 601 | 602 | 603 | 1000 604 | 605 | 606 | 494 607 | " 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 0 622 | 0 623 | 624 | 625 | 626 | Generate DRR 627 | 628 | 629 | 630 | 631 | 632 | 633 | Qt::Vertical 634 | 635 | 636 | 637 | 0 638 | 0 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | qSlicerWidget 648 | QWidget 649 |
qSlicerWidget.h
650 | 1 651 |
652 | 653 | ctkCollapsibleButton 654 | QWidget 655 |
ctkCollapsibleButton.h
656 | 1 657 |
658 | 659 | ctkDoubleSpinBox 660 | QWidget 661 |
ctkDoubleSpinBox.h
662 |
663 | 664 | qSlicerDRRGeneratorModuleFooBarWidget 665 | QWidget 666 |
qSlicerDRRGeneratorModuleFooBarWidget.h
667 | 1 668 |
669 |
670 | 671 | 672 | 673 | qSlicerDRRGeneratorModuleModuleWidget 674 | mrmlSceneChanged(vtkMRMLScene*) 675 | InputVolumeComboBox 676 | setMRMLScene(vtkMRMLScene*) 677 | 678 | 679 | 245 680 | 4 681 | 682 | 683 | 279 684 | 103 685 | 686 | 687 | 688 | 689 | qSlicerDRRGeneratorModuleModuleWidget 690 | mrmlSceneChanged(vtkMRMLScene*) 691 | ProjectionComboBox 692 | setMRMLScene(vtkMRMLScene*) 693 | 694 | 695 | 245 696 | 4 697 | 698 | 699 | 279 700 | 103 701 | 702 | 703 | 704 | 705 |
706 | -------------------------------------------------------------------------------- /DRRGeneratorModule/Resources/qSlicerDRRGeneratorModuleModule.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | Icons/DRRGeneratorModule.png 4 | 5 | 6 | -------------------------------------------------------------------------------- /DRRGeneratorModule/Testing/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(Cxx) 2 | -------------------------------------------------------------------------------- /DRRGeneratorModule/Testing/Cxx/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(KIT qSlicer${MODULE_NAME}Module) 2 | 3 | #----------------------------------------------------------------------------- 4 | set(KIT_TEST_SRCS 5 | #qSlicer${MODULE_NAME}ModuleTest.cxx 6 | ) 7 | 8 | #----------------------------------------------------------------------------- 9 | slicerMacroConfigureModuleCxxTestDriver( 10 | NAME ${KIT} 11 | SOURCES ${KIT_TEST_SRCS} 12 | WITH_VTK_DEBUG_LEAKS_CHECK 13 | WITH_VTK_ERROR_OUTPUT_CHECK 14 | ) 15 | 16 | #----------------------------------------------------------------------------- 17 | #simple_test(qSlicer${MODULE_NAME}ModuleTest) 18 | -------------------------------------------------------------------------------- /DRRGeneratorModule/Widgets/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(qSlicer${MODULE_NAME}ModuleWidgets) 2 | 3 | set(KIT ${PROJECT_NAME}) 4 | 5 | set(${KIT}_EXPORT_DIRECTIVE "Q_SLICER_MODULE_${MODULE_NAME_UPPER}_WIDGETS_EXPORT") 6 | 7 | set(${KIT}_INCLUDE_DIRECTORIES 8 | ) 9 | 10 | set(${KIT}_SRCS 11 | qSlicer${MODULE_NAME}FooBarWidget.cxx 12 | qSlicer${MODULE_NAME}FooBarWidget.h 13 | ) 14 | 15 | set(${KIT}_MOC_SRCS 16 | qSlicer${MODULE_NAME}FooBarWidget.h 17 | ) 18 | 19 | set(${KIT}_UI_SRCS 20 | ../Resources/UI/qSlicer${MODULE_NAME}FooBarWidget.ui 21 | ) 22 | 23 | set(${KIT}_RESOURCES 24 | ../Resources/qSlicer${MODULE_NAME}Module.qrc 25 | ) 26 | 27 | set(${KIT}_TARGET_LIBRARIES 28 | vtkSlicer${MODULE_NAME}ModuleLogic 29 | ) 30 | 31 | #----------------------------------------------------------------------------- 32 | SlicerMacroBuildModuleWidgets( 33 | NAME ${KIT} 34 | EXPORT_DIRECTIVE ${${KIT}_EXPORT_DIRECTIVE} 35 | INCLUDE_DIRECTORIES ${${KIT}_INCLUDE_DIRECTORIES} 36 | SRCS ${${KIT}_SRCS} 37 | MOC_SRCS ${${KIT}_MOC_SRCS} 38 | UI_SRCS ${${KIT}_UI_SRCS} 39 | TARGET_LIBRARIES ${${KIT}_TARGET_LIBRARIES} 40 | RESOURCES ${${KIT}_RESOURCES} 41 | WRAP_PYTHONQT 42 | ) 43 | -------------------------------------------------------------------------------- /DRRGeneratorModule/Widgets/qSlicerDRRGeneratorModuleFooBarWidget.cxx: -------------------------------------------------------------------------------- 1 | /*============================================================================== 2 | 3 | Program: 3D Slicer 4 | 5 | Copyright (c) Kitware Inc. 6 | 7 | See COPYRIGHT.txt 8 | or http://www.slicer.org/copyright/copyright.txt for details. 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc. 17 | and was partially funded by NIH grant 3P41RR013218-12S1 18 | 19 | ==============================================================================*/ 20 | 21 | // FooBar Widgets includes 22 | #include "qSlicerDRRGeneratorModuleFooBarWidget.h" 23 | #include "ui_qSlicerDRRGeneratorModuleFooBarWidget.h" 24 | 25 | //----------------------------------------------------------------------------- 26 | /// \ingroup Slicer_QtModules_DRRGeneratorModule 27 | class qSlicerDRRGeneratorModuleFooBarWidgetPrivate 28 | : public Ui_qSlicerDRRGeneratorModuleFooBarWidget 29 | { 30 | Q_DECLARE_PUBLIC(qSlicerDRRGeneratorModuleFooBarWidget); 31 | protected: 32 | qSlicerDRRGeneratorModuleFooBarWidget* const q_ptr; 33 | 34 | public: 35 | qSlicerDRRGeneratorModuleFooBarWidgetPrivate( 36 | qSlicerDRRGeneratorModuleFooBarWidget& object); 37 | virtual void setupUi(qSlicerDRRGeneratorModuleFooBarWidget*); 38 | }; 39 | 40 | // -------------------------------------------------------------------------- 41 | qSlicerDRRGeneratorModuleFooBarWidgetPrivate 42 | ::qSlicerDRRGeneratorModuleFooBarWidgetPrivate( 43 | qSlicerDRRGeneratorModuleFooBarWidget& object) 44 | : q_ptr(&object) 45 | { 46 | } 47 | 48 | // -------------------------------------------------------------------------- 49 | void qSlicerDRRGeneratorModuleFooBarWidgetPrivate 50 | ::setupUi(qSlicerDRRGeneratorModuleFooBarWidget* widget) 51 | { 52 | this->Ui_qSlicerDRRGeneratorModuleFooBarWidget::setupUi(widget); 53 | } 54 | 55 | //----------------------------------------------------------------------------- 56 | // qSlicerDRRGeneratorModuleFooBarWidget methods 57 | 58 | //----------------------------------------------------------------------------- 59 | qSlicerDRRGeneratorModuleFooBarWidget 60 | ::qSlicerDRRGeneratorModuleFooBarWidget(QWidget* parentWidget) 61 | : Superclass( parentWidget ) 62 | , d_ptr( new qSlicerDRRGeneratorModuleFooBarWidgetPrivate(*this) ) 63 | { 64 | Q_D(qSlicerDRRGeneratorModuleFooBarWidget); 65 | d->setupUi(this); 66 | } 67 | 68 | //----------------------------------------------------------------------------- 69 | qSlicerDRRGeneratorModuleFooBarWidget 70 | ::~qSlicerDRRGeneratorModuleFooBarWidget() 71 | { 72 | } 73 | 74 | //----------------------------------------------------------------------------- 75 | void qSlicerDRRGeneratorModuleFooBarWidget 76 | ::setMRMLScene(vtkMRMLScene* scene) 77 | { 78 | //this->Superclass::setMRMLScene(scene); 79 | } -------------------------------------------------------------------------------- /DRRGeneratorModule/Widgets/qSlicerDRRGeneratorModuleFooBarWidget.h: -------------------------------------------------------------------------------- 1 | /*============================================================================== 2 | 3 | Program: 3D Slicer 4 | 5 | Copyright (c) Kitware Inc. 6 | 7 | See COPYRIGHT.txt 8 | or http://www.slicer.org/copyright/copyright.txt for details. 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc. 17 | and was partially funded by NIH grant 3P41RR013218-12S1 18 | 19 | ==============================================================================*/ 20 | 21 | #ifndef __qSlicerDRRGeneratorModuleFooBarWidget_h 22 | #define __qSlicerDRRGeneratorModuleFooBarWidget_h 23 | 24 | // Qt includes 25 | #include 26 | 27 | // FooBar Widgets includes 28 | #include "qSlicerDRRGeneratorModuleModuleWidgetsExport.h" 29 | 30 | #include "vtkMRMLScene.h" 31 | 32 | class qSlicerDRRGeneratorModuleFooBarWidgetPrivate; 33 | 34 | /// \ingroup Slicer_QtModules_DRRGeneratorModule 35 | class Q_SLICER_MODULE_DRRGENERATORMODULE_WIDGETS_EXPORT qSlicerDRRGeneratorModuleFooBarWidget 36 | : public QWidget 37 | { 38 | Q_OBJECT 39 | public: 40 | typedef QWidget Superclass; 41 | qSlicerDRRGeneratorModuleFooBarWidget(QWidget *parent=0); 42 | virtual ~qSlicerDRRGeneratorModuleFooBarWidget(); 43 | 44 | public slots: 45 | 46 | void setMRMLScene(vtkMRMLScene* scene); 47 | 48 | protected slots: 49 | 50 | protected: 51 | QScopedPointer d_ptr; 52 | 53 | private: 54 | Q_DECLARE_PRIVATE(qSlicerDRRGeneratorModuleFooBarWidget); 55 | Q_DISABLE_COPY(qSlicerDRRGeneratorModuleFooBarWidget); 56 | }; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /DRRGeneratorModule/qSlicerDRRGeneratorModuleModule.cxx: -------------------------------------------------------------------------------- 1 | /*============================================================================== 2 | 3 | Program: 3D Slicer 4 | 5 | Portions (c) Copyright Brigham and Women's Hospital (BWH) All Rights Reserved. 6 | 7 | See COPYRIGHT.txt 8 | or http://www.slicer.org/copyright/copyright.txt for details. 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | ==============================================================================*/ 17 | 18 | // DRRGeneratorModule Logic includes 19 | #include 20 | 21 | // DRRGeneratorModule includes 22 | #include "qSlicerDRRGeneratorModuleModule.h" 23 | #include "qSlicerDRRGeneratorModuleModuleWidget.h" 24 | 25 | //----------------------------------------------------------------------------- 26 | #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) 27 | #include 28 | Q_EXPORT_PLUGIN2(qSlicerDRRGeneratorModuleModule, qSlicerDRRGeneratorModuleModule); 29 | #endif 30 | 31 | //----------------------------------------------------------------------------- 32 | /// \ingroup Slicer_QtModules_ExtensionTemplate 33 | class qSlicerDRRGeneratorModuleModulePrivate 34 | { 35 | public: 36 | qSlicerDRRGeneratorModuleModulePrivate(); 37 | }; 38 | 39 | //----------------------------------------------------------------------------- 40 | // qSlicerDRRGeneratorModuleModulePrivate methods 41 | 42 | //----------------------------------------------------------------------------- 43 | qSlicerDRRGeneratorModuleModulePrivate::qSlicerDRRGeneratorModuleModulePrivate() 44 | { 45 | } 46 | 47 | //----------------------------------------------------------------------------- 48 | // qSlicerDRRGeneratorModuleModule methods 49 | 50 | //----------------------------------------------------------------------------- 51 | qSlicerDRRGeneratorModuleModule::qSlicerDRRGeneratorModuleModule(QObject* _parent) 52 | : Superclass(_parent) 53 | , d_ptr(new qSlicerDRRGeneratorModuleModulePrivate) 54 | { 55 | } 56 | 57 | //----------------------------------------------------------------------------- 58 | qSlicerDRRGeneratorModuleModule::~qSlicerDRRGeneratorModuleModule() 59 | { 60 | } 61 | 62 | //----------------------------------------------------------------------------- 63 | QString qSlicerDRRGeneratorModuleModule::helpText() const 64 | { 65 | return "This module can generate a Digitally Reconstructed Radiograph."; 66 | } 67 | 68 | //----------------------------------------------------------------------------- 69 | QString qSlicerDRRGeneratorModuleModule::acknowledgementText() const 70 | { 71 | return "This work was created by a medical student. I apologize for any errors."; 72 | } 73 | 74 | //----------------------------------------------------------------------------- 75 | QStringList qSlicerDRRGeneratorModuleModule::contributors() const 76 | { 77 | QStringList moduleContributors; 78 | moduleContributors << QString("Lance Levine"); 79 | return moduleContributors; 80 | } 81 | 82 | //----------------------------------------------------------------------------- 83 | QIcon qSlicerDRRGeneratorModuleModule::icon() const 84 | { 85 | return QIcon(":/Icons/DRRGeneratorModule.png"); 86 | } 87 | 88 | //----------------------------------------------------------------------------- 89 | QStringList qSlicerDRRGeneratorModuleModule::categories() const 90 | { 91 | return QStringList() << "Filtering"; 92 | } 93 | 94 | //----------------------------------------------------------------------------- 95 | QStringList qSlicerDRRGeneratorModuleModule::dependencies() const 96 | { 97 | return QStringList(); 98 | } 99 | 100 | //----------------------------------------------------------------------------- 101 | void qSlicerDRRGeneratorModuleModule::setup() 102 | { 103 | this->Superclass::setup(); 104 | } 105 | 106 | //----------------------------------------------------------------------------- 107 | qSlicerAbstractModuleRepresentation* qSlicerDRRGeneratorModuleModule 108 | ::createWidgetRepresentation() 109 | { 110 | return new qSlicerDRRGeneratorModuleModuleWidget; 111 | } 112 | 113 | //----------------------------------------------------------------------------- 114 | vtkMRMLAbstractLogic* qSlicerDRRGeneratorModuleModule::createLogic() 115 | { 116 | return vtkSlicerDRRGeneratorModuleLogic::New(); 117 | } 118 | -------------------------------------------------------------------------------- /DRRGeneratorModule/qSlicerDRRGeneratorModuleModule.h: -------------------------------------------------------------------------------- 1 | /*============================================================================== 2 | 3 | Program: 3D Slicer 4 | 5 | Portions (c) Copyright Brigham and Women's Hospital (BWH) All Rights Reserved. 6 | 7 | See COPYRIGHT.txt 8 | or http://www.slicer.org/copyright/copyright.txt for details. 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | ==============================================================================*/ 17 | 18 | #ifndef __qSlicerDRRGeneratorModuleModule_h 19 | #define __qSlicerDRRGeneratorModuleModule_h 20 | 21 | // SlicerQt includes 22 | #include "qSlicerLoadableModule.h" 23 | 24 | #include "qSlicerDRRGeneratorModuleModuleExport.h" 25 | 26 | class qSlicerDRRGeneratorModuleModulePrivate; 27 | 28 | /// \ingroup Slicer_QtModules_ExtensionTemplate 29 | class Q_SLICER_QTMODULES_DRRGENERATORMODULE_EXPORT 30 | qSlicerDRRGeneratorModuleModule 31 | : public qSlicerLoadableModule 32 | { 33 | Q_OBJECT 34 | #ifdef Slicer_HAVE_QT5 35 | Q_PLUGIN_METADATA(IID "org.slicer.modules.loadable.qSlicerLoadableModule/1.0"); 36 | #endif 37 | Q_INTERFACES(qSlicerLoadableModule); 38 | 39 | public: 40 | 41 | typedef qSlicerLoadableModule Superclass; 42 | explicit qSlicerDRRGeneratorModuleModule(QObject *parent=0); 43 | virtual ~qSlicerDRRGeneratorModuleModule(); 44 | 45 | qSlicerGetTitleMacro(QTMODULE_TITLE); 46 | 47 | virtual QString helpText()const; 48 | virtual QString acknowledgementText()const; 49 | virtual QStringList contributors()const; 50 | 51 | virtual QIcon icon()const; 52 | 53 | virtual QStringList categories()const; 54 | virtual QStringList dependencies() const; 55 | 56 | protected: 57 | 58 | /// Initialize the module. Register the volumes reader/writer 59 | virtual void setup(); 60 | 61 | /// Create and return the widget representation associated to this module 62 | virtual qSlicerAbstractModuleRepresentation * createWidgetRepresentation(); 63 | 64 | /// Create and return the logic associated to this module 65 | virtual vtkMRMLAbstractLogic* createLogic(); 66 | 67 | protected: 68 | QScopedPointer d_ptr; 69 | 70 | private: 71 | Q_DECLARE_PRIVATE(qSlicerDRRGeneratorModuleModule); 72 | Q_DISABLE_COPY(qSlicerDRRGeneratorModuleModule); 73 | 74 | }; 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /DRRGeneratorModule/qSlicerDRRGeneratorModuleModuleWidget.cxx: -------------------------------------------------------------------------------- 1 | /*============================================================================== 2 | 3 | Program: 3D Slicer 4 | 5 | Portions (c) Copyright Brigham and Women's Hospital (BWH) All Rights Reserved. 6 | 7 | See COPYRIGHT.txt 8 | or http://www.slicer.org/copyright/copyright.txt for details. 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | ==============================================================================*/ 17 | 18 | // Qt includes 19 | #include 20 | 21 | // SlicerQt includes 22 | #include "qSlicerDRRGeneratorModuleModuleWidget.h" 23 | #include "ui_qSlicerDRRGeneratorModuleModuleWidget.h" 24 | 25 | #include "qSlicerCoreIOManager.h" 26 | 27 | #include "vtkSlicerApplicationLogic.h" 28 | #include "vtkMRMLSegmentationNode.h" 29 | 30 | #include "itkImageFileReader.h" 31 | #include "itkImageFileWriter.h" 32 | #include "itkCommand.h" 33 | #include "itkSimpleFilterWatcher.h" 34 | 35 | #include "itkMeanProjectionImageFilter.h" 36 | #include "itkProjectionImageFilter.h" 37 | 38 | 39 | #include "itkMRMLIDImageIO.h" 40 | #include "itkMRMLIDImageIOFactory.h" 41 | #include "itkVTKImageToImageFilter.h" 42 | #include "itkImageToVTKImageFilter.h" 43 | 44 | #include "itkVTKImageIO.h" 45 | 46 | #include "vtkMatrix4x4.h" 47 | #include "itkFlipImageFilter.h" 48 | 49 | #include "vtkRenderer.h" 50 | #include "vtkImageActor.h" 51 | #include "vtkJPEGReader.h" 52 | 53 | #include "itkResampleImageFilter.h" 54 | #include "itkCenteredEuler3DTransform.h" 55 | #include "itkRayCastInterpolateImageFunction.h" 56 | #include "itkRescaleIntensityImageFilter.h" 57 | #include "vtkImageReslice.h" 58 | 59 | #include "vtkImageWriter.h" 60 | #include "vtkNrrdReader.h" 61 | #include "itkExtractImageFilter.h" 62 | #include "itkMedianImageFilter.h" 63 | #include "itkPasteImageFilter.h" 64 | #include "itkMultiplyImageFilter.h" 65 | #include "itkThresholdImageFilter.h" 66 | #include "itkNrrdImageIO.h" 67 | #include "itkVTKImageIO.h" 68 | 69 | #include "vtkImageCast.h" 70 | #include "vtkPNGWriter.h" 71 | #include "vtkImageShiftScale.h" 72 | 73 | #include "itkCenteredAffineTransform.h" 74 | 75 | #include "itkEuler2DTransform.h" 76 | #include "itkExhaustiveOptimizerv4.h" 77 | #include "itkMeanSquaresImageToImageMetricv4.h" 78 | #include "itkCenteredTransformInitializer.h" 79 | #include "itkImageRegistrationMethodv4.h" 80 | 81 | #include "itkVersorRigid3DTransformOptimizer.h" 82 | #include "itkVersorRigid3DTransform.h" 83 | #include "itkCenteredTransformInitializer.h" 84 | #include "itkImageRegistrationMethod.h" 85 | #include "itkMeanSquaresImageToImageMetric.h" 86 | #include "itkCommand.h" 87 | 88 | #include "itkRescaleIntensityImageFilter.h" 89 | #include "itkIdentityTransform.h" 90 | #include "itkImageRegistrationMethodv4.h" 91 | #include "itkMeanSquaresImageToImageMetricv4.h" 92 | #include "itkRegularStepGradientDescentOptimizerv4.h" 93 | #include "itkCenteredTransformInitializer.h" 94 | #include "itkSimilarity2DTransform.h" 95 | 96 | #include 97 | #include "itkSubtractImageFilter.h" 98 | 99 | #include 100 | 101 | class vtkMRMLNode; 102 | 103 | //----------------------------------------------------------------------------- 104 | /// \ingroup Slicer_QtModules_ExtensionTemplate 105 | class qSlicerDRRGeneratorModuleModuleWidgetPrivate: public Ui_qSlicerDRRGeneratorModuleModuleWidget 106 | { 107 | public: 108 | qSlicerDRRGeneratorModuleModuleWidgetPrivate(); 109 | 110 | vtkWeakPointer InputVolumeNode; 111 | vtkWeakPointer OutputVolumeNode; 112 | double rx; 113 | double ry; 114 | double rz; 115 | double tx; 116 | double ty; 117 | double tz; 118 | double cx; 119 | double cy; 120 | double cz; 121 | double sid; 122 | double drrthreshold; 123 | int drrsizex; 124 | int drrsizey; 125 | int direction; 126 | }; 127 | 128 | //----------------------------------------------------------------------------- 129 | // qSlicerDRRGeneratorModuleModuleWidgetPrivate methods 130 | 131 | //----------------------------------------------------------------------------- 132 | qSlicerDRRGeneratorModuleModuleWidgetPrivate::qSlicerDRRGeneratorModuleModuleWidgetPrivate() 133 | { 134 | } 135 | 136 | //----------------------------------------------------------------------------- 137 | // qSlicerDRRGeneratorModuleModuleWidget methods 138 | 139 | //----------------------------------------------------------------------------- 140 | qSlicerDRRGeneratorModuleModuleWidget::qSlicerDRRGeneratorModuleModuleWidget(QWidget* _parent) 141 | : Superclass( _parent ) 142 | , d_ptr( new qSlicerDRRGeneratorModuleModuleWidgetPrivate ) 143 | { 144 | } 145 | 146 | //----------------------------------------------------------------------------- 147 | qSlicerDRRGeneratorModuleModuleWidget::~qSlicerDRRGeneratorModuleModuleWidget() 148 | { 149 | } 150 | 151 | //----------------------------------------------------------------------------- 152 | void qSlicerDRRGeneratorModuleModuleWidget::setup() 153 | { 154 | Q_D(qSlicerDRRGeneratorModuleModuleWidget); 155 | d->setupUi(this); 156 | this->Superclass::setup(); 157 | 158 | connect(d->InputVolumeComboBox, SIGNAL(currentNodeChanged(vtkMRMLNode*)), 159 | this, SLOT(setInputVolume(vtkMRMLNode*))); 160 | 161 | connect(d->ProjectionComboBox, SIGNAL(currentNodeChanged(vtkMRMLNode*)), 162 | this, SLOT(setOutputVolume(vtkMRMLNode*))); 163 | 164 | connect(d->rotationXSpinBox, SIGNAL(valueChanged(double)), 165 | this, SLOT(setRotationX(double))); 166 | 167 | connect(d->rotationYSpinBox, SIGNAL(valueChanged(double)), 168 | this, SLOT(setRotationY(double))); 169 | 170 | connect(d->rotationZSpinBox, SIGNAL(valueChanged(double)), 171 | this, SLOT(setRotationZ(double))); 172 | 173 | connect(d->translationXSpinBox, SIGNAL(valueChanged(double)), 174 | this, SLOT(setTranslationX(double))); 175 | 176 | connect(d->translationYSpinBox, SIGNAL(valueChanged(double)), 177 | this, SLOT(setTranslationY(double))); 178 | 179 | connect(d->translationZSpinBox, SIGNAL(valueChanged(double)), 180 | this, SLOT(setTranslationZ(double))); 181 | 182 | connect(d->centerXSpinBox, SIGNAL(valueChanged(double)), 183 | this, SLOT(setCenterX(double))); 184 | 185 | connect(d->centerYSpinBox, SIGNAL(valueChanged(double)), 186 | this, SLOT(setCenterY(double))); 187 | 188 | connect(d->centerZSpinBox, SIGNAL(valueChanged(double)), 189 | this, SLOT(setCenterZ(double))); 190 | 191 | connect(d->focalPointSpinBox, SIGNAL(valueChanged(double)), 192 | this, SLOT(setFocalPoint(double))); 193 | 194 | connect(d->thresholdSpinBox, SIGNAL(valueChanged(double)), 195 | this, SLOT(setThreshold(double))); 196 | 197 | connect(d->sizeXSpinBox, SIGNAL(valueChanged(int)), 198 | this, SLOT(setDRRSizeX(int))); 199 | 200 | connect(d->sizeYSpinBox, SIGNAL(valueChanged(int)), 201 | this, SLOT(setDRRSizeY(int))); 202 | 203 | connect(d->directionSpinBox, SIGNAL(valueChanged(int)), 204 | this, SLOT(setDirection(int))); 205 | 206 | connect(d->GenerateDRRButton, SIGNAL(clicked()), 207 | this, SLOT(GenerateDRR())); 208 | 209 | d->rx = 90.00; 210 | d->ty = 200.00; 211 | d->sid = 400.00; 212 | d->drrsizex = 512; 213 | d->drrsizey = 494; 214 | d->direction = 2; 215 | } 216 | 217 | //----------------------------------------------------------------------------- 218 | /*void qSlicerDRRGeneratorModuleModuleWidget::updateWidgetFromMRML() 219 | { 220 | 221 | }*/ 222 | //----------------------------------------------------------------------------- 223 | void qSlicerDRRGeneratorModuleModuleWidget::setInputVolume(vtkMRMLNode* volumeNode) 224 | { 225 | Q_D(qSlicerDRRGeneratorModuleModuleWidget); 226 | qDebug() << "function::setInputVolume"; 227 | 228 | //qvtkReconnect(d->InputVolumeNode, volumeNode, vtkCommand::ModifiedEvent, this, SLOT(updateVolumeInfo())); 229 | d->InputVolumeNode = volumeNode; 230 | //qDebug() << volumeNode->GetID(); 231 | } 232 | 233 | //----------------------------------------------------------------------------- 234 | void qSlicerDRRGeneratorModuleModuleWidget::setOutputVolume(vtkMRMLNode* volumeNode) 235 | { 236 | Q_D(qSlicerDRRGeneratorModuleModuleWidget); 237 | qDebug() << "function::setOutputVolume"; 238 | 239 | //qvtkReconnect(d->InputVolumeNode, volumeNode, vtkCommand::ModifiedEvent, this, SLOT(updateVolumeInfo())); 240 | d->OutputVolumeNode = volumeNode; 241 | //qDebug() << volumeNode->GetID(); 242 | } 243 | 244 | class CommandIterationUpdate : public itk::Command 245 | { 246 | public: 247 | using Self = CommandIterationUpdate; 248 | using Superclass = itk::Command; 249 | using Pointer = itk::SmartPointer; 250 | itkNewMacro(Self); 251 | protected: 252 | CommandIterationUpdate() = default; 253 | public: 254 | using OptimizerType = itk::RegularStepGradientDescentOptimizerv4; 255 | using OptimizerPointer = const OptimizerType *; 256 | void Execute(itk::Object *caller, const itk::EventObject & event) override 257 | { 258 | Execute((const itk::Object *)caller, event); 259 | } 260 | void Execute(const itk::Object * object, const itk::EventObject & event) override 261 | { 262 | auto optimizer = static_cast< OptimizerPointer >(object); 263 | if (!itk::IterationEvent().CheckEvent(&event)) 264 | { 265 | return; 266 | } 267 | std::cout << optimizer->GetCurrentIteration() << " "; 268 | std::cout << optimizer->GetValue() << " "; 269 | std::cout << optimizer->GetCurrentPosition() << std::endl; 270 | } 271 | }; 272 | 273 | void qSlicerDRRGeneratorModuleModuleWidget::GenerateDRR() 274 | { 275 | Q_D(qSlicerDRRGeneratorModuleModuleWidget); 276 | 277 | using clock = std::chrono::system_clock; 278 | using ms = std::chrono::milliseconds; 279 | 280 | const auto before = clock::now(); 281 | 282 | qDebug() << "function::GenerateDRR()"; 283 | std::cout << "rotation :" << d->rx << " " << d->ry << " " << d->rz << "\n"; 284 | std::cout << "translation :" << d->tx << " " << d->ty << " " << d->tz << "\n"; 285 | std::cout << "center :" << d->cx << " " << d->cy << " " << d->cz << "\n"; 286 | std::cout << "size :" << d->drrsizex << " " << d->drrsizey << "\n"; 287 | std::cout << "sid :" << d->sid << "\n"; 288 | 289 | 290 | const int dim = 3; 291 | 292 | typedef short PType; 293 | typedef itk::Image< PType, dim > InputImageType; 294 | typedef itk::Image< PType, 2 > OutputImageType; 295 | 296 | 297 | vtkSmartPointer inputVTK = vtkSmartPointer::New(); 298 | inputVTK = d->InputVolumeNode->GetImageData(); 299 | 300 | //vtkNew matr; 301 | //d->InputVolumeNode->GetIJKToRASMatrix(matr); 302 | //d->OutputVolumeNode->SetIJKToRASMatrix(matr); 303 | 304 | double bounds29[6]; 305 | inputVTK->GetBounds(bounds29); 306 | 307 | // Rotate about the center of the image 308 | vtkSmartPointer transform29 = 309 | vtkSmartPointer::New(); 310 | 311 | // Compute the center of the image 312 | double center29[3]; 313 | center29[0] = (bounds29[1] + bounds29[0]) / 2.0; 314 | center29[1] = (bounds29[3] + bounds29[2]) / 2.0; 315 | center29[2] = (bounds29[5] + bounds29[4]) / 2.0; 316 | 317 | // Rotate about the center 318 | transform29->Translate(center29[0], center29[1], center29[2]); 319 | if (d->direction == 0) { 320 | transform29->RotateWXYZ((180), 1, 0, 0); 321 | } 322 | else if (d->direction == 1) { 323 | transform29->RotateWXYZ((180), 0, 1, 0); 324 | } 325 | else { 326 | transform29->RotateWXYZ((180), 0, 0, 1); 327 | } 328 | //transform29->RotateWXYZ((180), 0, 0, 1); 329 | transform29->Translate(-center29[0], -center29[1], -center29[2]); 330 | 331 | // Reslice does all of the work 332 | vtkSmartPointer reslice29 = 333 | vtkSmartPointer::New(); 334 | reslice29->SetInputData(inputVTK); 335 | reslice29->SetResliceTransform(transform29); 336 | reslice29->SetInterpolationModeToCubic(); 337 | reslice29->SetOutputSpacing( 338 | inputVTK->GetSpacing()[0], 339 | inputVTK->GetSpacing()[1], 340 | inputVTK->GetSpacing()[2]); 341 | reslice29->SetOutputOrigin( 342 | inputVTK->GetOrigin()[0], 343 | inputVTK->GetOrigin()[1], 344 | inputVTK->GetOrigin()[2]); 345 | reslice29->SetOutputExtent(inputVTK->GetExtent()); // Use a larger extent than the original image's to prevent clipping 346 | reslice29->Update(); 347 | 348 | // Convert VTK -> ITK 349 | typedef itk::VTKImageToImageFilter< InputImageType > VTKtoITKFilterType; 350 | VTKtoITKFilterType::Pointer vtkToItkFilter = VTKtoITKFilterType::New(); 351 | //vtkToItkFilter->SetInput(inputVTK); 352 | vtkToItkFilter->SetInput(reslice29->GetOutput()); 353 | vtkToItkFilter->Update(); 354 | InputImageType::Pointer image = vtkToItkFilter->GetOutput(); 355 | 356 | // Software Guide : BeginLatex 357 | // 358 | // Creation of a \code{ResampleImageFilter} enables coordinates for 359 | // each of the pixels in the DRR image to be generated. These 360 | // coordinates are used by the \code{RayCastInterpolateImageFunction} 361 | // to determine the equation of each corresponding ray which is cast 362 | // through the input volume. 363 | // 364 | // Software Guide : EndLatex 365 | // Software Guide : BeginCodeSnippet 366 | using FilterType = itk::ResampleImageFilter; 367 | FilterType::Pointer filter = FilterType::New(); 368 | filter->SetInput(image); 369 | filter->SetDefaultPixelValue(0); 370 | //qDebug() << "function::projectVolume2()::ResampleImageFilter"; 371 | 372 | // Software Guide : EndCodeSnippet 373 | // Software Guide : BeginLatex 374 | // 375 | // An Euler transformation is defined to position the input volume. 376 | // The \code{ResampleImageFilter} uses this transform to position the 377 | // output DRR image for the desired view. 378 | // 379 | // Software Guide : EndLatex 380 | // Software Guide : BeginCodeSnippet 381 | using TransformType = itk::CenteredEuler3DTransform< double >; 382 | TransformType::Pointer transform = TransformType::New(); 383 | transform->SetComputeZYX(true); 384 | TransformType::OutputVectorType translation; 385 | translation[0] = d->tx; //left -right Increasing this moves the model right 386 | translation[1] = d->ty; //THIS WAS ORIGINALLY 0 CHANGED TO 200 Increasing this zooms out further 387 | translation[2] = d->tz;// tz; up -down Increasing this moves the model downwards 388 | // constant for converting degrees into radians 389 | const double dtr = (std::atan(1.0) * 4.0) / 180.0; 390 | transform->SetTranslation(translation); 391 | transform->SetRotation(dtr*d->rx, dtr*d->ry, dtr*d->rz); 392 | //transform->SetRotation(dtr*0., dtr*0., dtr*0.); 393 | //transform->SetRotation(dtr*90., dtr*0., dtr*0.); //TODO change 3rd coordinate to 20 394 | //transform->SetRotation(dtr*(90.+x), dtr*y, dtr*z); 395 | //forward-back, clockwise-ccw, 396 | 397 | 398 | InputImageType::PointType imOrigin = image->GetOrigin(); 399 | InputImageType::SpacingType imRes = image->GetSpacing(); 400 | using InputImageRegionType = InputImageType::RegionType; 401 | using InputImageSizeType = InputImageRegionType::SizeType; 402 | InputImageRegionType imRegion = image->GetBufferedRegion(); 403 | InputImageSizeType imSize = imRegion.GetSize(); 404 | imOrigin[0] += imRes[0] * static_cast(imSize[0]) / 2.0; 405 | imOrigin[1] += imRes[1] * static_cast(imSize[1]) / 2.0; 406 | imOrigin[2] += imRes[2] * static_cast(imSize[2]) / 2.0; 407 | TransformType::InputPointType center; 408 | center[0] = d->cx + imOrigin[0]; 409 | center[1] = d->cy + imOrigin[1]; 410 | center[2] = d->cz + imOrigin[2]; 411 | transform->SetCenter(center); 412 | /*center[0] = 0 + imOrigin[0]; 413 | center[1] = 0 + imOrigin[1]; 414 | center[2] = 0 + imOrigin[2]; 415 | transform->SetCenter(center);*/ 416 | // Software Guide : EndCodeSnippet 417 | // Software Guide : BeginLatex 418 | // 419 | // The \code{RayCastInterpolateImageFunction} is instantiated and passed the transform 420 | // object. The \code{RayCastInterpolateImageFunction} uses this 421 | // transform to reposition the x-ray source such that the DRR image 422 | // and x-ray source move as one around the input volume. This coupling 423 | // mimics the rigid geometry of the x-ray gantry. 424 | // 425 | // Software Guide : EndLatex 426 | // Software Guide : BeginCodeSnippet 427 | using InterpolatorType = 428 | itk::RayCastInterpolateImageFunction; 429 | InterpolatorType::Pointer interpolator = InterpolatorType::New(); 430 | interpolator->SetTransform(transform); 431 | // Software Guide : EndCodeSnippet 432 | // Software Guide : BeginLatex 433 | // 434 | // We can then specify a threshold above which the volume's 435 | // intensities will be integrated. 436 | // 437 | // Software Guide : EndLatex 438 | // Software Guide : BeginCodeSnippet 439 | 440 | interpolator->SetThreshold(d->drrthreshold); 441 | 442 | // Software Guide : EndCodeSnippet 443 | // Software Guide : BeginLatex 444 | // 445 | // The ray-cast interpolator needs to know the initial position of the 446 | // ray source or focal point. In this example we place the input 447 | // volume at the origin and halfway between the ray source and the 448 | // screen. The distance between the ray source and the screen 449 | // is the "source to image distance" \code{sid} and is specified by 450 | // the user. 451 | // 452 | // Software Guide : EndLatex 453 | // Software Guide : BeginCodeSnippet 454 | InterpolatorType::InputPointType focalpoint; 455 | focalpoint[0] = imOrigin[0]; 456 | focalpoint[1] = imOrigin[1]; 457 | focalpoint[2] = imOrigin[2] - d->sid / 2.; 458 | interpolator->SetFocalPoint(focalpoint); 459 | // Software Guide : EndCodeSnippet 460 | // Software Guide : BeginLatex 461 | // 462 | // Having initialised the interpolator we pass the object to the 463 | // resample filter. 464 | // 465 | // Software Guide : EndLatex 466 | // Software Guide : BeginCodeSnippet 467 | //interpolator->Print(std::cout); 468 | filter->SetInterpolator(interpolator); 469 | filter->SetTransform(transform); 470 | // Software Guide : EndCodeSnippet 471 | // Software Guide : BeginLatex 472 | // 473 | // The size and resolution of the output DRR image is specified via the 474 | // resample filter. 475 | // 476 | // Software Guide : EndLatex 477 | // Software Guide : BeginCodeSnippet 478 | // setup the scene 479 | InputImageType::SizeType size; 480 | size[0] = d->drrsizex;//512;//dx; // number of pixels along X of the 2D DRR image 481 | size[1] = d->drrsizey;// dy; // number of pixels along Y of the 2D DRR image 482 | size[2] = 1; // only one slice 483 | filter->SetSize(size); 484 | InputImageType::SpacingType spacing; 485 | spacing[0] = 1;// sx; // pixel spacing along X of the 2D DRR image [mm] 486 | spacing[1] = 1;// sy; // pixel spacing along Y of the 2D DRR image [mm] 487 | spacing[2] = 1; // slice thickness of the 2D DRR image [mm] 488 | filter->SetOutputSpacing(spacing); 489 | // Software Guide : EndCodeSnippet 490 | 491 | // Software Guide : BeginLatex 492 | // 493 | // In addition the position of the DRR is specified. The default 494 | // position of the input volume, prior to its transformation is 495 | // half-way between the ray source and screen and unless specified 496 | // otherwise the normal from the "screen" to the ray source passes 497 | // directly through the centre of the DRR. 498 | // 499 | // Software Guide : EndLatex 500 | // Software Guide : BeginCodeSnippet 501 | double origin[dim]; 502 | origin[0] = imOrigin[0] + 0 - 1.*((double)d->drrsizex - 1.) / 2.;//o2Dx - sx*((double)dx - 1.) / 2.; 503 | origin[1] = imOrigin[1] + 0 - 1.*((double)d->drrsizey - 1.) / 2.;//o2Dy - sy*((double)dy - 1.) / 2.; 504 | origin[2] = imOrigin[2] + d->sid / 2.; 505 | filter->SetOutputOrigin(origin); 506 | // Software Guide : EndCodeSnippet 507 | // create writer 508 | //qDebug() << "function::projectVolume2()::RayCastImageFilter"; 509 | 510 | // Software Guide : BeginLatex 511 | // 512 | // The output of the resample filter can then be passed to a writer to 513 | // save the DRR image to a file. 514 | // 515 | // Software Guide : EndLatex 516 | // Software Guide : BeginCodeSnippet 517 | using RescaleFilterType = itk::RescaleIntensityImageFilter< 518 | InputImageType, InputImageType >; 519 | RescaleFilterType::Pointer rescaler = RescaleFilterType::New(); 520 | rescaler->SetOutputMinimum(0); 521 | rescaler->SetOutputMaximum(255); //TODO USED TO BE 255 522 | rescaler->SetInput(filter->GetOutput()); 523 | rescaler->Update(); 524 | 525 | typedef itk::ImageFileWriter< InputImageType > WriterType; 526 | WriterType::Pointer writer9 = WriterType::New(); 527 | writer9->SetFileName("output_fixed.nrrd"); 528 | writer9->SetInput(rescaler->GetOutput()); 529 | writer9->Update(); 530 | 531 | typedef itk::ExtractImageFilter< InputImageType, OutputImageType > SliceType3; 532 | SliceType3::Pointer slice3 = SliceType3::New(); 533 | slice3->InPlaceOn(); 534 | slice3->SetDirectionCollapseToSubmatrix(); 535 | InputImageType::RegionType inputRegion3 = 536 | rescaler->GetOutput()->GetLargestPossibleRegion(); 537 | InputImageType::SizeType size3 = inputRegion3.GetSize(); 538 | size3[2] = 0; 539 | InputImageType::IndexType start3 = inputRegion3.GetIndex(); 540 | const unsigned int sliceNumber3 = 0; 541 | start3[2] = sliceNumber3; 542 | InputImageType::RegionType desiredRegion3; 543 | desiredRegion3.SetSize(size3); 544 | desiredRegion3.SetIndex(start3); 545 | slice3->SetExtractionRegion(desiredRegion3); 546 | //qDebug() << "function::projectVolume2()::" << size3[0] << " " << size3[1] << " ~ " << start3[0] << " " << start3[1]; 547 | slice3->SetInput(rescaler->GetOutput()); 548 | slice3->Update(); 549 | 550 | /*WriterType::Pointer writer4 = WriterType::New(); 551 | writer4->SetFileName("output4.jpeg"); 552 | 553 | using ExtractFilterType = itk::ExtractImageFilter< OutputImageType, OutputImageType >; 554 | ExtractFilterType::Pointer extractFilter = ExtractFilterType::New(); 555 | extractFilter->SetDirectionCollapseToSubmatrix(); 556 | 557 | // set up the extraction region [one slice] 558 | const OutputImageType * inputImage = rescaler->GetOutput(); 559 | OutputImageType::RegionType inputRegion = inputImage->GetBufferedRegion(); 560 | OutputImageType::SizeType size1 = inputRegion.GetSize(); 561 | size1[2] = 1; // we extract along z direction 562 | OutputImageType::IndexType start = inputRegion.GetIndex(); 563 | const unsigned int sliceNumber = 0;//atoi(argv[3]); 564 | start[2] = sliceNumber; 565 | OutputImageType::RegionType desiredRegion; 566 | desiredRegion.SetSize(size); 567 | desiredRegion.SetIndex(start); 568 | 569 | extractFilter->SetExtractionRegion(desiredRegion); 570 | using PasteFilterType = itk::PasteImageFilter< OutputImageType >; 571 | PasteFilterType::Pointer pasteFilter = PasteFilterType::New(); 572 | using MedianFilterType = itk::MedianImageFilter< OutputImageType, 573 | OutputImageType >; 574 | MedianFilterType::Pointer medianFilter = MedianFilterType::New(); 575 | extractFilter->SetInput(inputImage); 576 | medianFilter->SetInput(extractFilter->GetOutput()); 577 | pasteFilter->SetSourceImage(medianFilter->GetOutput()); 578 | pasteFilter->SetDestinationImage(inputImage); 579 | pasteFilter->SetDestinationIndex(start); 580 | 581 | OutputImageType::SizeType indexRadius; 582 | indexRadius[0] = 1; // radius along x 583 | indexRadius[1] = 1; // radius along y 584 | indexRadius[2] = 0; // radius along z 585 | medianFilter->SetRadius(indexRadius); 586 | medianFilter->UpdateLargestPossibleRegion(); 587 | const OutputImageType * medianImage = medianFilter->GetOutput(); 588 | pasteFilter->SetSourceRegion(medianImage->GetBufferedRegion()); 589 | writer4->SetInput(pasteFilter->GetOutput()); 590 | writer4->Update();*/ 591 | 592 | /*OutputImageType::IndexType start1; 593 | start1[0] = 0; // first index on X 594 | start1[1] = 0; // first index on Y 595 | start1[2] = 0; // first index on Z 596 | OutputImageType::SizeType size1; 597 | size1[0] = 490; // size along X 598 | size1[1] = 490; // size along Y 599 | size1[2] = 1; // size along Z 600 | OutputImageType::RegionType region; 601 | region.SetSize(size1); 602 | region.SetIndex(start1); 603 | 604 | typedef itk::ExtractImageFilter< OutputImageType, OutputImageType2 > ExtractImageFilterType; 605 | ExtractImageFilterType::Pointer extract = ExtractImageFilterType::New(); 606 | extract->SetInput(rescaler->GetOutput()); 607 | extract->SetDirectionCollapseToIdentity(); 608 | extract->SetExtractionRegion(region); 609 | extract->Update(); 610 | using WriterType4 = itk::ImageFileWriter< OutputImageType2 >; 611 | WriterType4::Pointer writer4 = WriterType4::New(); 612 | writer4->SetFileName("output4.jpeg"); 613 | writer4->SetInput(extract->GetOutput());*/ 614 | 615 | using WriterType11 = itk::ImageFileWriter< OutputImageType >; 616 | WriterType11::Pointer writer11 = WriterType11::New(); 617 | writer11->SetFileName("output_fixed2.nrrd"); 618 | writer11->SetInput(slice3->GetOutput()); 619 | writer11->Update(); 620 | 621 | 622 | using ITKtoVTKFilterType = itk::ImageToVTKImageFilter< OutputImageType >; 623 | ITKtoVTKFilterType::Pointer itktovtkfilter = ITKtoVTKFilterType::New(); 624 | itktovtkfilter->SetInput(slice3->GetOutput()); 625 | itktovtkfilter->Update(); 626 | vtkImageData * outputVTK = itktovtkfilter->GetOutput(); 627 | 628 | /*vtkSmartPointer reslice = 629 | vtkSmartPointer::New(); 630 | reslice->SetOutputExtent(0, 9, 0, 100, 0, 0); 631 | reslice->SetInputData(outputVTK); 632 | reslice->Update();*/ 633 | 634 | /*vtkSmartPointer writer5 = 635 | vtkSmartPointer::New(); 636 | writer5->SetInputData(outputVTK); 637 | writer5->SetFileName("output3.vtk"); 638 | writer5->Write();*/ 639 | 640 | vtkSmartPointer castFilter = 641 | vtkSmartPointer::New(); 642 | castFilter->SetOutputScalarTypeToUnsignedChar(); 643 | castFilter->SetInputData(outputVTK); 644 | castFilter->Update(); 645 | 646 | d->OutputVolumeNode->SetAndObserveImageData(castFilter->GetOutput()); 647 | 648 | const auto duration = std::chrono::duration_cast(clock::now() - before); 649 | 650 | std::cout << "It took " << duration.count() / 1000.0 << "s" << std::endl; 651 | } 652 | 653 | void qSlicerDRRGeneratorModuleModuleWidget::setRotationX(double rotationX) 654 | { 655 | Q_D(qSlicerDRRGeneratorModuleModuleWidget); 656 | d->rx = rotationX; 657 | } 658 | 659 | void qSlicerDRRGeneratorModuleModuleWidget::setRotationY(double rotationY) 660 | { 661 | Q_D(qSlicerDRRGeneratorModuleModuleWidget); 662 | d->ry = rotationY; 663 | } 664 | 665 | void qSlicerDRRGeneratorModuleModuleWidget::setRotationZ(double rotationZ) 666 | { 667 | Q_D(qSlicerDRRGeneratorModuleModuleWidget); 668 | d->rz = rotationZ; 669 | } 670 | 671 | void qSlicerDRRGeneratorModuleModuleWidget::setTranslationX(double translationX) 672 | { 673 | Q_D(qSlicerDRRGeneratorModuleModuleWidget); 674 | d->tx = translationX; 675 | } 676 | 677 | void qSlicerDRRGeneratorModuleModuleWidget::setTranslationY(double translationY) 678 | { 679 | Q_D(qSlicerDRRGeneratorModuleModuleWidget); 680 | d->ty = translationY; 681 | } 682 | 683 | void qSlicerDRRGeneratorModuleModuleWidget::setTranslationZ(double translationZ) 684 | { 685 | Q_D(qSlicerDRRGeneratorModuleModuleWidget); 686 | d->tz = translationZ; 687 | } 688 | 689 | void qSlicerDRRGeneratorModuleModuleWidget::setCenterX(double centerX) 690 | { 691 | Q_D(qSlicerDRRGeneratorModuleModuleWidget); 692 | d->cx = centerX; 693 | } 694 | 695 | void qSlicerDRRGeneratorModuleModuleWidget::setCenterY(double centerY) 696 | { 697 | Q_D(qSlicerDRRGeneratorModuleModuleWidget); 698 | d->cy = centerY; 699 | } 700 | 701 | void qSlicerDRRGeneratorModuleModuleWidget::setCenterZ(double centerZ) 702 | { 703 | Q_D(qSlicerDRRGeneratorModuleModuleWidget); 704 | d->cz = centerZ; 705 | } 706 | 707 | void qSlicerDRRGeneratorModuleModuleWidget::setFocalPoint(double focalPoint) 708 | { 709 | Q_D(qSlicerDRRGeneratorModuleModuleWidget); 710 | d->sid = focalPoint; 711 | } 712 | 713 | void qSlicerDRRGeneratorModuleModuleWidget::setThreshold(double threshold) 714 | { 715 | Q_D(qSlicerDRRGeneratorModuleModuleWidget); 716 | d->drrthreshold = threshold; 717 | } 718 | 719 | void qSlicerDRRGeneratorModuleModuleWidget::setDRRSizeX(int sizeX) 720 | { 721 | Q_D(qSlicerDRRGeneratorModuleModuleWidget); 722 | d->drrsizex = sizeX; 723 | } 724 | 725 | void qSlicerDRRGeneratorModuleModuleWidget::setDRRSizeY(int sizeY) 726 | { 727 | Q_D(qSlicerDRRGeneratorModuleModuleWidget); 728 | d->drrsizey = sizeY; 729 | } 730 | 731 | void qSlicerDRRGeneratorModuleModuleWidget::setDirection(int direction) 732 | { 733 | Q_D(qSlicerDRRGeneratorModuleModuleWidget); 734 | d->direction = direction; 735 | } 736 | -------------------------------------------------------------------------------- /DRRGeneratorModule/qSlicerDRRGeneratorModuleModuleWidget.h: -------------------------------------------------------------------------------- 1 | /*============================================================================== 2 | 3 | Program: 3D Slicer 4 | 5 | Portions (c) Copyright Brigham and Women's Hospital (BWH) All Rights Reserved. 6 | 7 | See COPYRIGHT.txt 8 | or http://www.slicer.org/copyright/copyright.txt for details. 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | ==============================================================================*/ 17 | 18 | #ifndef __qSlicerDRRGeneratorModuleModuleWidget_h 19 | #define __qSlicerDRRGeneratorModuleModuleWidget_h 20 | 21 | // SlicerQt includes 22 | #include "qSlicerAbstractModuleWidget.h" 23 | 24 | #include "qSlicerDRRGeneratorModuleModuleExport.h" 25 | 26 | #include 27 | 28 | class qSlicerDRRGeneratorModuleModuleWidgetPrivate; 29 | 30 | /// \ingroup Slicer_QtModules_ExtensionTemplate 31 | class Q_SLICER_QTMODULES_DRRGENERATORMODULE_EXPORT qSlicerDRRGeneratorModuleModuleWidget : 32 | public qSlicerAbstractModuleWidget 33 | { 34 | Q_OBJECT 35 | 36 | public: 37 | 38 | typedef qSlicerAbstractModuleWidget Superclass; 39 | qSlicerDRRGeneratorModuleModuleWidget(QWidget *parent=0); 40 | virtual ~qSlicerDRRGeneratorModuleModuleWidget(); 41 | 42 | public slots: 43 | 44 | void setRotationX(double); 45 | void setRotationY(double); 46 | void setRotationZ(double); 47 | void setTranslationX(double); 48 | void setTranslationY(double); 49 | void setTranslationZ(double); 50 | void setCenterX(double); 51 | void setCenterY(double); 52 | void setCenterZ(double); 53 | void setFocalPoint(double); 54 | void setThreshold(double); 55 | void setDRRSizeX(int); 56 | void setDRRSizeY(int); 57 | void setDirection(int); 58 | 59 | protected slots : 60 | 61 | void setInputVolume(vtkMRMLNode * volumeNode); 62 | void setOutputVolume(vtkMRMLNode * volumeNode); 63 | /*void projectVolume(); 64 | void rotateAndProjectVolume(int x, int y, int z); 65 | void rotateAndProjectVolume0(); 66 | void rotateAndProjectVolume5(); 67 | void rotateAndProjectVolume15(); 68 | void rotateAndProjectVolume25(); 69 | void projectVolumeDRR3backup(int x, int y, int z); 70 | void projectVolumeDRR3(int x, int y, int z); 71 | void projectVolumeDRR0(); 72 | void projectVolumeDRR5(); 73 | void projectVolumeDRR15(); 74 | void projectVolumeDRR25(); 75 | void projectVolumeFilter(); 76 | void cropVolume(); 77 | void rotateVolume();*/ 78 | //void registerVolume3d(); 79 | /*void registerVolumeOld(); 80 | double registerVolume2dSimilarity(); 81 | double registerVolume2dEuler(); 82 | void automaticRegistration();*/ 83 | void GenerateDRR(); 84 | 85 | protected: 86 | QScopedPointer d_ptr; 87 | 88 | virtual void setup(); 89 | 90 | bool debug; 91 | 92 | private: 93 | Q_DECLARE_PRIVATE(qSlicerDRRGeneratorModuleModuleWidget); 94 | Q_DISABLE_COPY(qSlicerDRRGeneratorModuleModuleWidget); 95 | }; 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SlicerDRRGenerator 2 | A 3D Slicer extension that generates Digitally Reconstructed Radiographs 3 | --------------------------------------------------------------------------------