00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision$ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 00019 #include "mitkBoundingObject.h" 00020 #include "mitkBaseProcess.h" 00021 00022 mitk::BoundingObject::BoundingObject() 00023 : Surface(), m_Positive(true) 00024 { 00025 // Initialize(1); 00026 00027 /* bounding box around the unscaled bounding object */ 00028 ScalarType bounds[6]={-1,1,-1,1,-1,1}; //{xmin,x_max, ymin,y_max,zmin,z_max} 00029 GetGeometry()->SetBounds(bounds); 00030 GetTimeSlicedGeometry()->UpdateInformation(); 00031 } 00032 00033 mitk::BoundingObject::~BoundingObject() 00034 { 00035 } 00036 00037 mitk::ScalarType mitk::BoundingObject::GetVolume() 00038 { 00039 return 0.0; 00040 } 00041 00042 void mitk::BoundingObject::FitGeometry(mitk::Geometry3D* aGeometry3D) 00043 { 00044 GetGeometry()->SetIdentity(); 00045 GetGeometry()->Compose(aGeometry3D->GetIndexToWorldTransform()); 00046 00047 if(aGeometry3D->GetImageGeometry()) 00048 { 00049 mitk::Vector3D halfSpacingStep = aGeometry3D->GetSpacing()*0.5; 00050 GetGeometry()->SetOrigin(aGeometry3D->GetCenter()-halfSpacingStep); 00051 } 00052 else 00053 { 00054 GetGeometry()->SetOrigin(aGeometry3D->GetCenter()); 00055 } 00056 00057 mitk::Vector3D size; 00058 for(unsigned int i=0; i < 3; ++i) 00059 size[i] = aGeometry3D->GetExtentInMM(i)/2.0; 00060 GetGeometry()->SetSpacing( size ); 00061 GetTimeSlicedGeometry()->UpdateInformation(); 00062 }