Medical Imaging Interaction Toolkit  2018.4.99-3e3f1a6e
Medical Imaging Interaction Toolkit
mitkUSImage.cpp
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #include "mitkUSImage.h"
14 #include <mitkStringProperty.h>
15 #include <mitkProperties.h>
16 #include <mitkImageReadAccessor.h>
17 
18 
20 {
22 }
23 
25 {
26  try
27  {
28  this->Initialize(image);
29  mitk::ImageReadAccessor imgA(image, image->GetVolumeData(0));
30  this->SetVolume(imgA.GetData());
31  }
32  catch(mitk::Exception& e)
33  {
34  mitkReThrow(e) << "Cannot access image data while constructing US image";
35  }
36 }
37 
39 {
40 
41 }
42 
43 mitk::USImageMetadata::Pointer mitk::USImage::GetMetadata() const {
44  mitk::USImageMetadata::Pointer result = mitk::USImageMetadata::New();
45 
46  result->SetDeviceManufacturer(this->GetProperty(mitk::USImageMetadata::PROP_DEV_MANUFACTURER)->GetValueAsString());
47  result->SetDeviceModel( this->GetProperty(mitk::USImageMetadata::PROP_DEV_MODEL)->GetValueAsString());
48  result->SetDeviceComment( this->GetProperty(mitk::USImageMetadata::PROP_DEV_COMMENT)->GetValueAsString());
49  result->SetDeviceIsVideoOnly( this->GetProperty(mitk::USImageMetadata::PROP_DEV_ISVIDEOONLY));
50  result->SetDeviceIsCalibrated(this->GetProperty(mitk::USImageMetadata::PROP_DEV_ISCALIBRATED));
51  result->SetProbeName( this->GetProperty(mitk::USImageMetadata::PROP_PROBE_NAME)->GetValueAsString());
52  result->SetProbeFrequency( this->GetProperty(mitk::USImageMetadata::PROP_PROBE_FREQUENCY)->GetValueAsString());
53  result->SetZoom( this->GetProperty(mitk::USImageMetadata::PROP_ZOOM)->GetValueAsString());
54 
55  return result;
56 }
57 
58 
59 void mitk::USImage::SetMetadata(mitk::USImageMetadata::Pointer metadata){
64  this->SetProperty(mitk::USImageMetadata::PROP_DEV_ISCALIBRATED, mitk::BoolProperty::New(metadata->GetDeviceIsCalibrated()));
68 }
69 
static const char * PROP_DEV_MODEL
USImage()
This constructor creates an empty USImage. The Metadata are set to default.
Definition: mitkUSImage.cpp:19
void Initialize() override
Definition: mitkImage.cpp:803
DataCollection - Class to facilitate loading/accessing structured data.
void SetMetadata(mitk::USImageMetadata::Pointer metadata)
Writes the information of the metadata object into the image&#39;s properties.
Definition: mitkUSImage.cpp:59
#define mitkReThrow(mitkexception)
void SetProperty(const std::string &propertyKey, BaseProperty *property, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
Add new or change existent property.
virtual bool SetVolume(const void *data, int t=0, int n=0)
Set data as volume at time t in channel n. It is in the responsibility of the caller to ensure that t...
Definition: mitkImage.cpp:669
static Pointer New()
static const char * PROP_PROBE_FREQUENCY
An object of this class represents an exception of MITK. Please don&#39;t instantiate exceptions manually...
Definition: mitkException.h:45
static const char * PROP_PROBE_NAME
Image class for storing images.
Definition: mitkImage.h:72
mitk::Image::Pointer image
static const char * PROP_DEV_ISVIDEOONLY
mitk::USImageMetadata::Pointer GetMetadata() const
Reads out this image&#39;s Metadata set from the properties and returns a corresponding USImageMetadata o...
Definition: mitkUSImage.cpp:43
mitk::BaseProperty::Pointer GetProperty(const char *propertyKey) const
Get the property (instance of BaseProperty) with key propertyKey from the PropertyList, and set it to this, respectively;.
~USImage() override
Definition: mitkUSImage.cpp:38
static const char * PROP_DEV_ISCALIBRATED
static const char * PROP_DEV_COMMENT
ImageReadAccessor class to get locked read access for a particular image part.
static const char * PROP_DEV_MANUFACTURER
static const char * PROP_ZOOM
static Pointer New()
static Pointer New()