#include "vtkKWDICOMImporter.h" #include "vtkObjectFactory.h" #include "vtkKWApplication.h" #include "vtkKWWizardWidget.h" #include "vtkKWWizardStep.h" #include "vtkKWWizardWorkflow.h" #include "vtkKWLabel.h" #include "vtkKWIcon.h" #include #include #include #include #include #include #include //---------------------------------------------------------------------------- vtkStandardNewMacro( vtkKWDICOMImporter ); vtkCxxRevisionMacro(vtkKWDICOMImporter, "$Revision: 1.3 $"); //---------------------------------------------------------------------------- vtkKWDICOMImporter::vtkKWDICOMImporter() { this->Page1 = vtkKWDICOMImporterPage1::New(); this->Page2 = vtkKWDICOMImporterPage2::New(); this->Page1Step = vtkKWWizardStep::New(); this->Page2Step = vtkKWWizardStep::New(); } itk::GDCMImporter::Pointer vtkKWDICOMImporter::GetGDCMImporter (void) const { if (!this->Page2) return NULL; return this->Page2->GetGDCMImporter(); } //---------------------------------------------------------------------------- vtkKWDICOMImporter::~vtkKWDICOMImporter() { std::cout<<"deleting DICOM importer"<Page1->Delete(); this->Page1Step->Delete(); this->Page2->Delete(); this->Page2Step->Delete(); if (this->GetWizardWidget() && this->GetWizardWidget()->GetClientArea()) this->GetWizardWidget()->GetClientArea()->RemoveAllChildren(); } //---------------------------------------------------------------------------- void vtkKWDICOMImporter::CreatePage1() { vtkKWWizardWidget *wizard_widget = this->GetWizardWidget(); this->Page1Step->SetName("Page1Step"); this->Page1Step->SetDescription("Read this information before proceeding to the import"); this->Page1Step->SetShowUserInterfaceCommand( this, "ShowPage1UserInterfaceCallback"); this->Page1Step->SetHideUserInterfaceCommand(wizard_widget, "ClearPage"); this->Page1Step->SetValidateCommand(this, "ValidatePage1Callback"); } //---------------------------------------------------------------------------- void vtkKWDICOMImporter::CreatePage2() { vtkKWWizardWidget *wizard_widget = this->GetWizardWidget(); this->Page2Step->SetName("Page2Step"); this->Page2Step->SetDescription("Open your DICOM exam here"); this->Page2Step->SetShowUserInterfaceCommand( this, "ShowPage2UserInterfaceCallback"); this->Page2Step->SetHideUserInterfaceCommand(wizard_widget, "ClearPage"); this->Page2Step->SetValidateCommand(this, "ValidatePage2Callback"); } //---------------------------------------------------------------------------- void vtkKWDICOMImporter::CreateWidget() { // Check if already created if (this->IsCreated()) { vtkErrorMacro("class already created"); return; } // Call the superclass to create the whole widget this->Superclass::CreateWidget(); this->SetSize(600,500); this->SetTitle("DICOM Importer"); this->CreatePage1(); this->CreatePage2(); vtkKWWizardWorkflow *wizard_workflow = this->GetWizardWorkflow(); vtkKWWizardWidget *wizard_widget = this->GetWizardWidget(); wizard_widget->GetTitleIconLabel()->SetImageToPixels( image_importdicom, image_importdicom_width, image_importdicom_height, image_importdicom_pixel_size, image_importdicom_length); // ----------------------------------------------------------------- // steps wizard_workflow->AddNextStep(this->Page1Step); wizard_workflow->AddNextStep(this->Page2Step); wizard_workflow->CreateGoToTransition(this->Page1Step, this->Page2Step); // ----------------------------------------------------------------- // Initial and finish step wizard_workflow->SetInitialStep(this->Page1Step); wizard_workflow->SetFinishStep(this->Page2Step); wizard_workflow->SetNavigationStackedChangedCommand (this, "NavigationStackedChangeCallback"); } //---------------------------------------------------------------------------- void vtkKWDICOMImporter::NavigationStackedChangeCallback() { vtkKWWizardWorkflow *wizard_workflow = this->GetWizardWorkflow(); vtkKWWizardStep* current_step = wizard_workflow->GetCurrentStep(); } //---------------------------------------------------------------------------- void vtkKWDICOMImporter::ShowPage1UserInterfaceCallback() { if (!this->Page1->IsCreated()) { this->Page1->SetParent(this->GetWizardWidget()->GetClientArea()); this->Page1->Create(); } this->Script("pack %s -side top -expand y -fill both ", this->Page1->GetWidgetName()); } //---------------------------------------------------------------------------- void vtkKWDICOMImporter::ShowPage2UserInterfaceCallback() { if (!this->Page2->IsCreated()) { this->Page2->SetParent(this->GetWizardWidget()->GetClientArea()); this->Page2->Create(); } this->Script("pack %s -side top -expand y -fill both ", this->Page2->GetWidgetName()); } //---------------------------------------------------------------------------- void vtkKWDICOMImporter::ValidatePage1Callback() { vtkKWWizardWorkflow *wizard_workflow = this->GetWizardWorkflow(); wizard_workflow->PushInput(vtkKWWizardStep::GetValidationSucceededInput()); wizard_workflow->ProcessInputs(); } //---------------------------------------------------------------------------- void vtkKWDICOMImporter::ValidatePage2Callback() { } //--------------------------------------------------------------------------- void vtkKWDICOMImporter::UpdateEnableState() { this->Superclass::UpdateEnableState(); }