From 0f41173383ece2736e285fb44e8b06569bd8d201 Mon Sep 17 00:00:00 2001 From: dsarrut Date: Thu, 27 May 2010 09:21:10 +0000 Subject: [PATCH] - remove comments and add reload capabilities --- common/clitkDicomRT_ROI.cxx | 22 ++++++++++++++++++++-- common/clitkDicomRT_ROI.h | 7 ++++++- common/clitkDicomRT_StructureSet.cxx | 23 ++++++++++------------- 3 files changed, 36 insertions(+), 16 deletions(-) diff --git a/common/clitkDicomRT_ROI.cxx b/common/clitkDicomRT_ROI.cxx index 119b638..fb7b0ca 100644 --- a/common/clitkDicomRT_ROI.cxx +++ b/common/clitkDicomRT_ROI.cxx @@ -68,6 +68,14 @@ const std::string & clitk::DicomRT_ROI::GetName() const //-------------------------------------------------------------------- +//-------------------------------------------------------------------- +const std::string & clitk::DicomRT_ROI::GetFilename() const +{ + return mFilename; +} +//-------------------------------------------------------------------- + + //-------------------------------------------------------------------- const std::vector & clitk::DicomRT_ROI::GetDisplayColor() const { @@ -130,6 +138,14 @@ void clitk::DicomRT_ROI::Read(std::map & rois, gdcm::SQItem * //-------------------------------------------------------------------- +//-------------------------------------------------------------------- +void clitk::DicomRT_ROI::SetImage(vvImage * image) +{ + mImage = image; +} +//-------------------------------------------------------------------- + + //-------------------------------------------------------------------- vtkPolyData * clitk::DicomRT_ROI::GetMesh() { @@ -157,8 +173,9 @@ void clitk::DicomRT_ROI::ComputeMesh() //-------------------------------------------------------------------- void clitk::DicomRT_ROI::SetFromBinaryImage(vvImage::Pointer image, int n, - std::string name, - std::vector color) + std::string name, + std::vector color, + std::string filename) { // ROI number [Referenced ROI Number] @@ -166,6 +183,7 @@ void clitk::DicomRT_ROI::SetFromBinaryImage(vvImage::Pointer image, int n, // ROI Name mName = name; + mFilename = filename; // ROI Color [ROI Display Color] mColor = color; diff --git a/common/clitkDicomRT_ROI.h b/common/clitkDicomRT_ROI.h index b16b7a1..5a30df8 100644 --- a/common/clitkDicomRT_ROI.h +++ b/common/clitkDicomRT_ROI.h @@ -36,10 +36,12 @@ namespace clitk { void Read(std::map & rois, gdcm::SQItem * item); void SetFromBinaryImage(vvImage::Pointer image, int n, std::string name, - std::vector color); + std::vector color, + std::string filename); int GetROINumber() const; const std::string & GetName() const; + const std::string & GetFilename() const; const std::vector & GetDisplayColor() const; vtkPolyData * GetMesh(); const vvImage::Pointer GetImage() const; @@ -50,9 +52,12 @@ namespace clitk { double GetBackgroundValueLabelImage() const; void SetBackgroundValueLabelImage(double bg); + void SetImage(vvImage * im); + protected: void ComputeMesh(); std::string mName; + std::string mFilename; int mNumber; std::vector mColor; std::vector mListOfContours; diff --git a/common/clitkDicomRT_StructureSet.cxx b/common/clitkDicomRT_StructureSet.cxx index fb23570..c377157 100644 --- a/common/clitkDicomRT_StructureSet.cxx +++ b/common/clitkDicomRT_StructureSet.cxx @@ -113,8 +113,8 @@ clitk::DicomRT_ROI* clitk::DicomRT_StructureSet::GetROI(int n) std::cerr << "No ROI number " << n << std::endl; return NULL; } - DD(mListOfROI[mMapOfROIIndex[n]]->GetName()); - DD(mListOfROI[mMapOfROIIndex[n]]->GetROINumber()); + // DD(mListOfROI[mMapOfROIIndex[n]]->GetName()); + //DD(mListOfROI[mMapOfROIIndex[n]]->GetROINumber()); return mListOfROI[mMapOfROIIndex[n]]; } //-------------------------------------------------------------------- @@ -213,22 +213,22 @@ void clitk::DicomRT_StructureSet::Read(const std::string & filename) //-------------------------------------------------------------------- int clitk::DicomRT_StructureSet::AddBinaryImageAsNewROI(vvImage::Pointer im, std::string n) { - DD("AddBinaryImageAsNewROI"); + //DD("AddBinaryImageAsNewROI"); // Search max ROI number int max = -1; for(unsigned int i=0; iGetROINumber() > max) max = mListOfROI[i]->GetROINumber(); } - DD(max); + // DD(max); ++max; - DD(max); + //DD(max); // Compute name std::ostringstream oss; - oss << vtksys::SystemTools::GetFilenameName(vtksys::SystemTools::GetFilenameWithoutLastExtension(n)) - << "_roi_" << max << vtksys::SystemTools::GetFilenameLastExtension(n); - DD(oss.str()); + oss << vtksys::SystemTools::GetFilenameName(vtksys::SystemTools::GetFilenameWithoutLastExtension(n)); + // << "_roi_" << max << vtksys::SystemTools::GetFilenameLastExtension(n); + //DD(oss.str()); mMapOfROIName[max] = oss.str(); // Set color @@ -239,13 +239,10 @@ int clitk::DicomRT_StructureSet::AddBinaryImageAsNewROI(vvImage::Pointer im, std // Create ROI DicomRT_ROI * roi = new DicomRT_ROI; - roi->SetFromBinaryImage(im, - max, - oss.str(), - color); + roi->SetFromBinaryImage(im, max, oss.str(), color, n); mListOfROI.push_back(roi); mMapOfROIIndex[mListOfROI.size()-1] = max; - DD(mMapOfROIIndex[mListOfROI.size()-1]); + //DD(mMapOfROIIndex[mListOfROI.size()-1]); return max; } //-------------------------------------------------------------------- -- 2.47.1