00001
00012
00013
00014
00015 #include "controller.h"
00016 #include "config_parser.h"
00017 #include "config_handler.h"
00018 #include "../global/global_definitions.h"
00019 #include "../global/settings.h"
00020 #include "../datasets/dataset_definitions.h"
00021 #include "../gui/config_widget.h"
00022
00023 #include "../datasets/one_byte_image_pixel_dataset.h"
00024 #include "../datasets/two_byte_image_pixel_dataset.h"
00025 #include "../datasets/four_byte_image_pixel_dataset.h"
00026 #include "../datasets/one_byte_volume_pixel_dataset.h"
00027 #include "../datasets/two_byte_volume_pixel_dataset.h"
00028 #include "../datasets/four_byte_volume_pixel_dataset.h"
00029
00030
00031 #include <boost/shared_ptr.hpp>
00032 #include <boost/lexical_cast.hpp>
00033 #include <QtXml/QXmlDefaultHandler>
00034 #include <iostream>
00035
00036 namespace imedgine
00037 {
00038
00039
00040 Controller::Controller()
00041 : algorithm_config_(new AlgorithmConfig()),
00042 gui_interaction_mode_(STANDARD_MODE)
00043 {
00044 }
00045
00046
00047
00048 Controller::~Controller()
00049 {
00050 #ifdef DEBUG
00051 std::cout << "Deleting Controller" << std::endl;
00052 #endif
00053 }
00054
00055
00056
00057 Controller& Controller::getInstance()
00058 {
00059 static Controller instance;
00060 return instance;
00061 }
00062
00063
00064
00065 std::pair<dataset_key_type, dataset_type>
00066 Controller::loadDataset(std::string filename)
00067 throw(FormatNotSupportedException, NullPointerException)
00068 {
00069 std::string extension = extractExtension(filename);
00070
00071
00072 DataIOFactory::data_io_type data_io =
00073 data_io_factory_.createDataIO(extension);
00074
00075 std::string dataset_key = generateDatasetKeyFromFilename(filename);
00076
00077 std::pair<dataset_pointer_type, dataset_type> dataset_pointer_and_type(
00078 data_io->loadDataset(filename, dataset_key));
00079
00080 if (dataset_pointer_and_type.first.get() == 0)
00081 {
00082 throw(NullPointerException("Controller::loadDataset"));
00083 }
00084
00085 dataset_pointer_map_.insert(
00086 std::make_pair(dataset_key, dataset_pointer_and_type.first));
00087
00088 dataset_filename_map_.insert(
00089 std::make_pair(dataset_key, filename));
00090
00091 return(std::make_pair(dataset_key, dataset_pointer_and_type.second));
00092 }
00093
00094
00095
00096 void Controller::writeDataset(dataset_key_type dataset_key, std::string filename)
00097 throw(DatasetNotFoundException, FormatNotSupportedException)
00098 {
00099 dataset_pointer_map_const_iterator_type dataset_iter =
00100 dataset_pointer_map_.find(dataset_key);
00101 if (dataset_iter == dataset_pointer_map_.end())
00102 {
00103 DatasetNotFoundException exc(dataset_key);
00104 throw(exc);
00105 }
00106
00107 std::string extension = extractExtension(filename);
00108
00109 DataIOFactory::data_io_type data_io =
00110 data_io_factory_.createDataIO(extension);
00111
00112 data_io->writeDataset(dataset_iter->second, filename);
00113 }
00114
00115
00116
00117 bool Controller::removeDataset(dataset_key_type dataset_key)
00118 {
00119 data_view_mediator_.removeDataset(dataset_key);
00120 dataset_filename_map_.erase(dataset_key);
00121 return(dataset_pointer_map_.erase(dataset_key) == 1);
00122 }
00123
00124 std::string const& Controller::getDatasetFilename(dataset_key_type dataset_key)
00125 throw(DatasetNotFoundException)
00126 {
00127 dataset_filename_map_const_iterator_type filename_iter =
00128 dataset_filename_map_.find(dataset_key);
00129 if (filename_iter == dataset_filename_map_.end())
00130 {
00131 DatasetNotFoundException exc(dataset_key);
00132 throw(exc);
00133 }
00134 return(filename_iter->second);
00135 }
00136
00137
00138
00139 void Controller::getLoadedDatasetKeys(std::vector<dataset_key_type>& key_container) const
00140 {
00141 for (dataset_pointer_map_const_iterator_type dataset_iter =
00142 dataset_pointer_map_.begin();
00143 dataset_iter != dataset_pointer_map_.end(); ++dataset_iter)
00144 {
00145 key_container.push_back(dataset_iter->first);
00146 }
00147 }
00148
00149
00150
00151 dataset_pointer_type Controller::getDataset(Controller::dataset_key_type dataset_key) const
00152 throw(DatasetNotFoundException)
00153 {
00154 dataset_pointer_map_const_iterator_type dataset_iter =
00155 dataset_pointer_map_.find(dataset_key);
00156 if (dataset_iter == dataset_pointer_map_.end())
00157 {
00158 DatasetNotFoundException exc(dataset_key);
00159 throw(exc);
00160 }
00161 return(dataset_iter->second);
00162 }
00163
00164
00165
00166 metadata_pointer_type Controller::getMetadataFor(dataset_key_type dataset_key) const
00167 throw(DatasetNotFoundException, NullPointerException)
00168 {
00169 dataset_pointer_map_const_iterator_type dataset_iter =
00170 dataset_pointer_map_.find(dataset_key);
00171 if (dataset_iter == dataset_pointer_map_.end())
00172 {
00173 DatasetNotFoundException exc(dataset_key);
00174 throw(exc);
00175 }
00176 if (dataset_iter->second.get() == 0)
00177 {
00178 throw(NullPointerException("Controller::getMetadataFor"));
00179 }
00180 return(dataset_iter->second->getMetadata());
00181 }
00182
00183
00184
00185
00186 void Controller::getDatasetKeysOfType(dataset_type type,
00187 dataset_key_container_type& dataset_key_container)
00188 throw(NullPointerException)
00189 {
00190 for (dataset_pointer_map_const_iterator_type dataset_iter =
00191 dataset_pointer_map_.begin();
00192 dataset_iter != dataset_pointer_map_.end(); ++dataset_iter)
00193 {
00194 if (dataset_iter->second.get() == NULL)
00195 {
00196 throw(NullPointerException("Controller::getDatasetKeysOfType"));
00197 }
00198 if (dataset_iter->second->getDatasetType() == type)
00199 {
00200 dataset_key_container.push_back(dataset_iter->first);
00201 }
00202 }
00203 }
00204
00205
00206
00207 void Controller::getDatasetKeysOfTypes(AlgorithmDefinition::accepted_datasets_type types,
00208 dataset_key_container_type& dataset_key_container)
00209 throw(NullPointerException)
00210 {
00211 for (AlgorithmDefinition::accepted_datasets_type::const_iterator types_iter =
00212 types.begin();types_iter != types.end();++types_iter)
00213 {
00214 getDatasetKeysOfType(*types_iter, dataset_key_container);
00215 }
00216 }
00217
00218
00219
00220
00221 view_pointer_type Controller::getViewOfDataset(
00222 view_type type, dataset_key_type dataset_key)
00223 throw(DatasetNotFoundException)
00224 {
00225 dataset_pointer_map_iterator_type dataset_iter =
00226 dataset_pointer_map_.find(dataset_key);
00227 if (dataset_iter == dataset_pointer_map_.end())
00228 {
00229 DatasetNotFoundException exc(dataset_key);
00230 throw(exc);
00231 }
00232
00233 return(data_view_mediator_.getViewOfDataset(dataset_iter->second, type));
00234 }
00235
00236
00237
00238 void Controller::getDependentViewIDsOfDataset(
00239 dataset_key_type dataset_key, view_id_container_type& target_container) const
00240 throw(DatasetNotFoundException, NullPointerException)
00241 {
00242 dataset_pointer_map_const_iterator_type dataset_iter =
00243 dataset_pointer_map_.find(dataset_key);
00244 if (dataset_iter == dataset_pointer_map_.end())
00245 {
00246 DatasetNotFoundException exc(dataset_key);
00247 throw(exc);
00248 }
00249 data_view_mediator_.getDependentViewIDsOfDataset(
00250 dataset_key, target_container);
00251 }
00252
00253
00254
00255 view_type Controller::getViewTypeForDatasetSlice(
00256 dataset_key_type dataset_key, slice_type slice)
00257 throw(DatasetNotFoundException)
00258 {
00259 dataset_pointer_map_iterator_type dataset_iter =
00260 dataset_pointer_map_.find(dataset_key);
00261 if (dataset_iter == dataset_pointer_map_.end())
00262 {
00263 DatasetNotFoundException exc(dataset_key);
00264 throw(exc);
00265 }
00266
00267 switch (slice)
00268 {
00269 case AXIAL_SLICE :
00270 {
00271 return(XY_SLICE_VIEW);
00272 }
00273 case CORONAL_SLICE :
00274 {
00275 return(YZ_SLICE_VIEW);
00276 }
00277 case SAGITTAL_SLICE :
00278 {
00279 return(XZ_SLICE_VIEW);
00280 }
00281 default :
00282 {
00283 return(UNDEF_VIEW);
00284 }
00285 }
00286 }
00287
00288
00289
00290 slice_type Controller::getDatasetSliceForViewType(
00291 dataset_key_type dataset_key, view_type type)
00292 throw(DatasetNotFoundException)
00293 {
00294 dataset_pointer_map_iterator_type dataset_iter =
00295 dataset_pointer_map_.find(dataset_key);
00296 if (dataset_iter == dataset_pointer_map_.end())
00297 {
00298 DatasetNotFoundException exc(dataset_key);
00299 throw(exc);
00300 }
00301
00302 switch (type)
00303 {
00304 case XY_SLICE_VIEW :
00305 {
00306 return(AXIAL_SLICE);
00307 }
00308 case YZ_SLICE_VIEW :
00309 {
00310 return(CORONAL_SLICE);
00311 }
00312 case XZ_SLICE_VIEW :
00313 {
00314 return(SAGITTAL_SLICE);
00315 }
00316 default :
00317 {
00318 return(UNDEF_SLICE);
00319 }
00320 }
00321 }
00322
00323
00324
00325 void Controller::deleteViews(view_id_container_type view_ids)
00326 throw(NullPointerException)
00327 {
00328 for (view_id_container_type::const_iterator view_id_iter = view_ids.begin();
00329 view_id_iter != view_ids.end(); ++view_id_iter)
00330 {
00331
00332 data_view_mediator_.deleteView(*view_id_iter);
00333 }
00334 }
00335
00336 void Controller::loadConfiguration(std::string config_file_name)
00337 {
00338 #ifdef DEBUG
00339 std::cout << "loading configuration" << std::endl;
00340 #endif
00341 boost::shared_ptr<ConfigHandler> config_handler(new ConfigHandler(
00342 AlgorithmConfig::algorithm_config_pointer_type(algorithm_config_)));
00343 ConfigParser::parseConfiguration(config_file_name, config_handler);
00344 algorithm_config_->setAlgorithmLibraryPath(
00345 (Settings::getInstance())->getStringValue("algorithms_path", "/"));
00346 }
00347
00348
00349
00350 algorithm_name_container_type Controller::getLoadedAlgorithmNames() const
00351 {
00352 return algorithm_config_->getLoadedAlgorithmNames();
00353 }
00354
00355
00356
00357 std::string Controller::extractExtension(std::string filename) const
00358 {
00359 if (filename.empty())
00360 {
00361
00362 return "";
00363 }
00364 std::string::size_type point_pos = filename.rfind(".");
00365 if (point_pos == std::string::npos)
00366 {
00367
00368 return "";
00369 }
00370 return filename.substr(point_pos+1, filename.size() - point_pos + 1);
00371 }
00372
00373
00374
00375 std::string Controller::generateDatasetKeyFromFilename(std::string filename) const
00376 {
00377 if (filename.empty())
00378 {
00379
00380 return "";
00381 }
00382
00383 std::string dataset_key;
00384 std::string::size_type slash_pos =
00385 filename.rfind(DIRECTORY_SEPARATOR);
00386 std::string::size_type file_name_start = slash_pos + 1;
00387
00388 if (slash_pos == std::string::npos)
00389 {
00390 file_name_start = 0;
00391 }
00392
00393 std::string::size_type point_pos = filename.rfind(".");
00394
00395 if (point_pos == std::string::npos)
00396 {
00397 dataset_key = filename.substr(file_name_start, filename.length() - file_name_start);
00398 }
00399 else
00400 {
00401 dataset_key = filename.substr(file_name_start, point_pos - file_name_start);
00402 }
00403
00404 makeDatasetKeyUnique(dataset_key);
00405
00406 return(dataset_key);
00407
00408 }
00409
00410
00411
00412 void Controller::makeDatasetKeyUnique(dataset_key_type& dataset_key) const
00413 {
00414 unsigned short dataset_number = 0;
00415 std::string original_key = dataset_key;
00416 dataset_pointer_map_const_iterator_type dataset_iter;
00417
00418 if ((dataset_iter = dataset_pointer_map_.find(dataset_key)) !=
00419 dataset_pointer_map_.end())
00420 {
00421 dataset_key.append(std::string(" ") + boost::lexical_cast<std::string>(++dataset_number));
00422 }
00423
00424 while ((dataset_iter = dataset_pointer_map_.find(dataset_key)) !=
00425 dataset_pointer_map_.end())
00426 {
00427 dataset_key = original_key;
00428 dataset_key.append(boost::lexical_cast<std::string>(++dataset_number));
00429 }
00430 }
00431
00432
00433
00434 AlgorithmConfig::algorithm_definition_pointer_type Controller::getAlgorithmDefinition(std::string name) const
00435 throw(AlgorithmNotFoundException)
00436 {
00437 return algorithm_config_->getAlgorithmDefinition(name);
00438 }
00439
00440
00441
00442 bool Controller::isAlgorithmLoaded(std::string name)
00443 {
00444 return algorithm_factory_.isAlgorithmLoaded(name);
00445 }
00446
00447
00448
00449 void Controller::loadAlgorithm(std::string name)
00450 throw(AlgorithmNotFoundException)
00451 {
00452 std::string full_path(algorithm_config_->getAlgorithmLibraryPath());
00453 std::string library_name = algorithm_config_->getAlgorithmDefinition(name)->getLibraryName();
00454 full_path.append(library_name);
00455 algorithm_factory_.loadAlgorithm(name, full_path);
00456 }
00457
00458
00459
00460 void Controller::runAlgorithm(std::string key,
00461 configuration_pointer_type algorithm_config)
00462 throw(AlgorithmNotFoundException, NullPointerException)
00463 {
00464 AlgorithmFactory::algorithm_pointer_type algorithm =
00465 algorithm_factory_.createAlgorithm(key);
00466
00467 if (algorithm.get() == 0)
00468 {
00469 throw(NullPointerException("Controller::runAlgorithm"));
00470 }
00471
00472 algorithm->setConfiguration(algorithm_config);
00473
00474 connect(algorithm.get(), SIGNAL(datasetChangedSignal(dataset_key_type const&)),
00475 this, SLOT(datasetChangedSlot(dataset_key_type const&)));
00476
00477 algorithm->run();
00478 }
00479
00480
00481
00482 config_widget_pointer_type Controller::createConfigWidget(
00483 std::string key) const
00484 throw(AlgorithmNotFoundException, NullPointerException)
00485 {
00486 config_widget_pointer_type config_widget = algorithm_factory_.createConfigWidget(key);
00487 configuration_pointer_type configuration = algorithm_factory_.createConfiguration(key);
00488 config_widget->setConfiguration(configuration);
00489 return config_widget;
00490 }
00491
00492
00493
00494 metadata_pointer_type Controller::getMetadataForDataset(std::string dataset_key) const
00495 throw(DatasetNotFoundException, NullPointerException)
00496 {
00497 dataset_pointer_map_type::const_iterator ds_iterator = dataset_pointer_map_.find(dataset_key);
00498 if (ds_iterator == dataset_pointer_map_.end())
00499 {
00500 DatasetNotFoundException exc(dataset_key);
00501 throw(exc);
00502 }
00503 else
00504 {
00505 if (ds_iterator->second.get() == 0)
00506 {
00507 throw(NullPointerException("getMetadataForDatasets"));
00508 }
00509 return ds_iterator->second->getMetadata();
00510 }
00511
00512 }
00513
00514
00515
00516
00517 void Controller::setGuiInteractionMode(gui_interaction_mode_type gui_interaction_mode)
00518 {
00519 gui_interaction_mode_ = gui_interaction_mode;
00520 }
00521
00522
00523
00524 gui_interaction_mode_type Controller::getGuiInteractionMode()
00525 {
00526 return gui_interaction_mode_;
00527 }
00528
00529
00530
00531 void Controller::setInputDatasetsInConfiguration(configuration_pointer_type configuration,
00532 config_dataset_id_to_input_map_type input_datasets,
00533 std::map<config_dataset_id_type, std::pair<dataset_key_type, dataset_type> >& new_dataset_keys_and_types)
00534 throw(NullPointerException, DatasetNotFoundException, InvalidCastException)
00535 {
00536 if (configuration.get() == 0)
00537 {
00538 throw(NullPointerException("Controller::setInputDatasetsInConfiguration"));
00539 }
00540
00541 for (config_dataset_id_to_input_map_type::const_iterator input_datasets_iter =
00542 input_datasets.begin();
00543 input_datasets_iter != input_datasets.end();
00544 ++input_datasets_iter)
00545 {
00546 dataset_key_type dataset_key(input_datasets_iter->second.dataset_key);
00547 dataset_pointer_map_const_iterator_type dataset_iter =
00548 dataset_pointer_map_.find(dataset_key);
00549 if (dataset_iter == dataset_pointer_map_.end())
00550 {
00551 DatasetNotFoundException exc(dataset_key);
00552 throw(exc);
00553 }
00554
00555 dataset_pointer_type source_dataset(dataset_iter->second);
00556
00557 if (source_dataset.get() == 0)
00558 {
00559 throw(NullPointerException("Controller::setInputDatasetsInConfiguration"));
00560 }
00561
00562 switch (input_datasets_iter->second.dataset_part)
00563 {
00564 case WHOLE_DATASET_PART :
00565 {
00566 configuration->registerDataset(
00567 input_datasets_iter->first, source_dataset);
00568 break;
00569 }
00570 case AXIAL_SLICE_PART :
00571 case CORONAL_SLICE_PART :
00572 case SAGITTAL_SLICE_PART :
00573 {
00574 volume_pixel_dataset_pointer_type volume_dataset(
00575 source_dataset, boost::detail::dynamic_cast_tag());
00576
00577 if (volume_dataset.get() == 0)
00578 {
00579 throw(InvalidCastException("Controller::setInputDatasetsInConfiguration",
00580 "dataset_pointer_type", "volume_pixel_dataset_pointer_type"));
00581 }
00582
00583
00584
00585 dataset_type type = UNDEF_DATASET;
00586 switch (volume_dataset->getDatasetType())
00587 {
00588 case ONE_BYTE_VOLUME_PIXEL_DATASET :
00589 {
00590 type = ONE_BYTE_IMAGE_PIXEL_DATASET;
00591 break;
00592 }
00593 case TWO_BYTE_VOLUME_PIXEL_DATASET :
00594 {
00595 type = TWO_BYTE_IMAGE_PIXEL_DATASET;
00596 break;
00597 }
00598 case FOUR_BYTE_VOLUME_PIXEL_DATASET :
00599 {
00600 type = FOUR_BYTE_IMAGE_PIXEL_DATASET;
00601 break;
00602 }
00603 default :
00604 {
00605 continue;
00606 }
00607 }
00608
00609 dataset_key_type image_key(input_datasets_iter->first);
00610 makeDatasetKeyUnique(image_key);
00611
00612 slice_type slice = this->datasetPartToSliceType(
00613 input_datasets_iter->second.dataset_part);
00614
00615 dataset_pointer_type image;
00616
00617
00618 switch (this->getViewTypeForDatasetSlice(volume_dataset->getDatasetKey(), slice))
00619 {
00620 case XY_SLICE_VIEW :
00621 {
00622 image = volume_dataset->getImageXY(
00623 volume_dataset->getFocusPoint()[Z_DIMENSION], image_key);
00624 configuration->registerDataset(input_datasets_iter->first, image);
00625 break;
00626 }
00627 case XZ_SLICE_VIEW :
00628 {
00629 image = volume_dataset->getImageXZ(
00630 volume_dataset->getFocusPoint()[Y_DIMENSION], image_key);
00631 configuration->registerDataset(input_datasets_iter->first, image);
00632 break;
00633 }
00634 case YZ_SLICE_VIEW :
00635 {
00636 image = volume_dataset->getImageYZ(
00637 volume_dataset->getFocusPoint()[X_DIMENSION], image_key);
00638 configuration->registerDataset(input_datasets_iter->first, image);
00639 break;
00640 }
00641 default :
00642 {
00643 return;
00644 }
00645 }
00646
00647 if (input_datasets_iter->second.is_in_place == true)
00648 {
00649 image->setDirty(true);
00650
00651 dataset_pointer_map_.insert(
00652 std::make_pair(image_key, image));
00653 dataset_filename_map_.insert(
00654 std::make_pair(image_key, std::string()));
00655
00656 std::cout << "Adding new key: " << input_datasets_iter->first << ", " << dataset_key << std::endl;
00657
00658 new_dataset_keys_and_types.insert(
00659 std::make_pair(input_datasets_iter->first,
00660 std::make_pair(image_key, type)));
00661 }
00662
00663 break;
00664 }
00665 }
00666 }
00667 }
00668
00669
00670
00671 void Controller::setOutputDatasetsInConfiguration(configuration_pointer_type configuration,
00672 config_dataset_id_to_output_map_type output_datasets,
00673 std::map<config_dataset_id_type, std::pair<dataset_key_type, dataset_type> >& new_dataset_keys_and_types)
00674 throw(NullPointerException)
00675 {
00676 if (configuration.get() == 0)
00677 {
00678 throw(NullPointerException("Controller::setInputDatasetsInConfiguration"));
00679 }
00680
00681 dataset_key_type dataset_key;
00682 dataset_pointer_type dataset;
00683
00684 for (config_dataset_id_to_output_map_type::const_iterator output_datasets_iter =
00685 output_datasets.begin();
00686 output_datasets_iter != output_datasets.end();
00687 ++output_datasets_iter)
00688 {
00689 dataset_key = output_datasets_iter->first;
00690 makeDatasetKeyUnique(dataset_key);
00691
00692 switch (output_datasets_iter->second)
00693 {
00694 case ONE_BYTE_IMAGE_PIXEL_DATASET :
00695 {
00696 dataset.reset(
00697 new OneByteImagePixelDataset(dataset_key));
00698 new_dataset_keys_and_types.insert(
00699 std::make_pair(output_datasets_iter->first,
00700 std::make_pair(dataset_key, ONE_BYTE_IMAGE_PIXEL_DATASET)));
00701 break;
00702 }
00703 case TWO_BYTE_IMAGE_PIXEL_DATASET :
00704 {
00705 dataset.reset(
00706 new TwoByteImagePixelDataset(dataset_key));
00707 new_dataset_keys_and_types.insert(
00708 std::make_pair(output_datasets_iter->first,
00709 std::make_pair(dataset_key, TWO_BYTE_IMAGE_PIXEL_DATASET)));
00710 break;
00711 }
00712 case FOUR_BYTE_IMAGE_PIXEL_DATASET :
00713 {
00714 dataset.reset(
00715 new FourByteImagePixelDataset(dataset_key));
00716 new_dataset_keys_and_types.insert(
00717 std::make_pair(output_datasets_iter->first,
00718 std::make_pair(dataset_key, FOUR_BYTE_IMAGE_PIXEL_DATASET)));
00719 break;
00720 }
00721 case ONE_BYTE_VOLUME_PIXEL_DATASET :
00722 {
00723 dataset.reset(
00724 new OneByteVolumePixelDataset(dataset_key));
00725 new_dataset_keys_and_types.insert(
00726 std::make_pair(output_datasets_iter->first,
00727 std::make_pair(dataset_key, ONE_BYTE_VOLUME_PIXEL_DATASET)));
00728 break;
00729 }
00730 case TWO_BYTE_VOLUME_PIXEL_DATASET :
00731 {
00732 dataset.reset(
00733 new TwoByteVolumePixelDataset(dataset_key));
00734 new_dataset_keys_and_types.insert(
00735 std::make_pair(output_datasets_iter->first,
00736 std::make_pair(dataset_key, TWO_BYTE_VOLUME_PIXEL_DATASET)));
00737 break;
00738 }
00739 case FOUR_BYTE_VOLUME_PIXEL_DATASET :
00740 {
00741 dataset.reset(
00742 new FourByteVolumePixelDataset(dataset_key));
00743 new_dataset_keys_and_types.insert(
00744 std::make_pair(output_datasets_iter->first,
00745 std::make_pair(dataset_key, FOUR_BYTE_VOLUME_PIXEL_DATASET)));
00746 break;
00747 }
00748 case MATRIX_DATASET :
00749 {
00750
00751 break;
00752 }
00753 default :
00754 {
00755 continue;
00756 }
00757 }
00758
00759 dataset_pointer_map_.insert(std::make_pair(dataset_key, dataset));
00760 dataset_filename_map_.insert(std::make_pair(dataset_key, std::string()));
00761
00762 configuration->registerDataset(
00763 output_datasets_iter->first, dataset);
00764 }
00765 }
00766
00767
00768
00769 slice_type Controller::datasetPartToSliceType(dataset_part_type dataset_part)
00770 {
00771 switch (dataset_part)
00772 {
00773 case AXIAL_SLICE_PART :
00774 {
00775 return(AXIAL_SLICE);
00776 }
00777 case CORONAL_SLICE_PART :
00778 {
00779 return(CORONAL_SLICE);
00780 }
00781 case SAGITTAL_SLICE_PART :
00782 {
00783 return(SAGITTAL_SLICE);
00784 }
00785 default :
00786 {
00787 return(UNDEF_SLICE);
00788 }
00789 }
00790 }
00791
00792
00793
00794
00795
00796 void Controller::datasetChangedSlot(dataset_key_type const& dataset_key)
00797 {
00798 data_view_mediator_.updateDataChanged(dataset_key, DATASET_ATTRIBUTE_DATA);
00799 }
00800
00801 }