Loading...
Searching...
No Matches
DicomROIContour.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26#include "DicomROIContour.hh"
27
28//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32
33//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34void DicomROIContour::SetData( std::vector<G4ThreeVector> data )
35{
36 thePoints = data;
37 if( theGeomType == "CLOSED_PLANAR" ){
38 //add a last point to close the circle
39 thePoints.push_back( thePoints[0] );
40 for( size_t ii = 1; ii < thePoints.size(); ii++ ){
41 theDirections.push_back( thePoints[ii] - thePoints[ii-1] );
42 }
43 theDirections.push_back( thePoints[0] - thePoints[thePoints.size()-1] ); // (0,0)
44 }
45}
46
47//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
49{
50 if( thePoints.size() == 0 ) {
51 G4Exception("DicomROIContour::GetZ",
52 "DRC001",
53 FatalException,
54 "No Point in contour");
55 Print(G4cout);
56 return DBL_MAX;
57 }
58 return thePoints[0].z();
59}
60
61//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
62void DicomROIContour::AddPoints( std::vector<G4ThreeVector> points )
63{
64 points.push_back( points[0] );
65 size_t npold = thePoints.size();
66 for( size_t ii = 0; ii < points.size(); ii++ ) {
67 thePoints.push_back( points[ii] );
68 }
69
70 for( size_t ii = npold+1; ii < thePoints.size(); ii++ ){
71 theDirections.push_back( thePoints[ii] - thePoints[ii-1] );
72 }
73 theDirections.push_back( thePoints[npold] - thePoints[thePoints.size()-1] );
74
75}
76
77//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
78void DicomROIContour::Print( std::ostream& out )
79{
80
81 out << this << "@@@ NUMBER OF ContourImageSequences " << theImageIUIDs.size() << G4endl;
82 for( size_t ii = 0; ii < theImageIUIDs.size(); ii++ ) {
83 out << "ContourImageSequence I= " << theImageIUIDs[ii] << G4endl;
84 }
85 out << "@@@ GeomType " << theGeomType << " NPOINTS " << thePoints.size() << G4endl;
86 for( size_t ii = 0; ii < thePoints.size(); ii++ ) {
87 out << "(" << thePoints[ii].x()<< "," << thePoints[ii].y()<< "," << thePoints[ii].z()
88 << ")" << G4endl;
89 }
90
91}
std::vector< OFString > theImageIUIDs
std::vector< G4ThreeVector > theDirections
void SetData(std::vector< G4ThreeVector > data)
void Print(std::ostream &out)
void AddPoints(std::vector< G4ThreeVector > points)
std::vector< G4ThreeVector > thePoints

Applications | User Support | Publications | Collaboration