clitk::ImageToImageGenericFilterBase::ImageToImageGenericFilterBase(std::string n)
:mIOVerbose(false) {
mFilterName = n;
- mListOfAllowedDimension.clear();
- mListOfAllowedPixelType.clear();
+ mListOfAllowedDimensions.clear();
+ mListOfAllowedPixelTypes.clear();
mFailOnImageTypeError = true;
}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
void clitk::ImageToImageGenericFilterBase::AddImageType(unsigned int d, std::string p) {
- // Search for dimension (to not duplicate)
- std::vector<unsigned int>::const_iterator it =
- std::find (mListOfAllowedDimension.begin(),
- mListOfAllowedDimension.end(), d);
- if (it == mListOfAllowedDimension.end()) mListOfAllowedDimension.push_back(d);
- // Search for PixelType (to not duplicate)
- std::vector<std::string>::const_iterator itt =
- std::find (mListOfAllowedPixelType.begin(),
- mListOfAllowedPixelType.end(), p);
- if (itt == mListOfAllowedPixelType.end()) mListOfAllowedPixelType.push_back(p);
+
+ mListOfAllowedDimensions.insert(d);
+ mListOfAllowedPixelTypes.insert(p);
}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
void clitk::ImageToImageGenericFilterBase::SetInputFilenames(const std::vector<std::string> & filenames) {
- mInputFilenames.resize(filenames.size());
- std::copy(filenames.begin(), filenames.end(), mInputFilenames.begin());
+ mInputFilenames=filenames;
}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
void clitk::ImageToImageGenericFilterBase::SetOutputFilenames(const std::vector<std::string> & filenames)
{
- std::copy(filenames.begin(), filenames.end(), mOutputFilenames.begin());
+ mOutputFilenames.clear();
+ std::copy(filenames.begin(),filenames.end(),mOutputFilenames.begin());
}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
bool clitk::ImageToImageGenericFilterBase::CheckDimension(unsigned int d) {
- bool b = false;
- unsigned int i=0;
- while ((!b) && (i<mListOfAllowedDimension.size())) {
- b = (mListOfAllowedDimension[i] == d);
- i++;
- }
- return b;
+ return (mListOfAllowedDimensions.find(d) != mListOfAllowedDimensions.end());
}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
bool clitk::ImageToImageGenericFilterBase::CheckPixelType(std::string pt) {
- bool b = false;
- unsigned int i=0;
- while ((!b) && (i<mListOfAllowedPixelType.size())) {
- b = (mListOfAllowedPixelType[i] == pt);
- i++;
- }
- return b;
+ return (mListOfAllowedPixelTypes.find(pt) != mListOfAllowedPixelTypes.end());
}
//--------------------------------------------------------------------
std::string clitk::ImageToImageGenericFilterBase::GetAvailableImageTypes() {
std::ostringstream oss;
oss << "The filter <" << mFilterName << "> manages ";
- for(unsigned int i=0; i<mListOfAllowedDimension.size(); i++) {
- oss << mListOfAllowedDimension[i] << "D ";
+ for(std::set<unsigned int>::const_iterator i=mListOfAllowedDimensions.begin();
+ i!=mListOfAllowedDimensions.end(); i++) {
+ oss << *i << "D ";
}
oss << "images, with pixel types: ";
- for(unsigned int i=0; i<mListOfAllowedPixelType.size(); i++) {
- oss << mListOfAllowedPixelType[i] << " ";
+ for(std::set<std::string>::const_iterator i=mListOfAllowedPixelTypes.begin();
+ i!=mListOfAllowedPixelTypes.end(); i++) {
+ oss << *i << " ";
}
oss << std::endl;
return oss.str();
<< mDim << "D images with pixel="
<< mPixelTypeName << "." << std::endl;
std::cerr << "**Error** Allowed image dim: \t";
- for(unsigned int i=0; i<mListOfAllowedDimension.size(); i++) {
- std::cerr << mListOfAllowedDimension[i] << " ";
+ for(std::set<unsigned int>::const_iterator i=mListOfAllowedDimensions.begin();
+ i!=mListOfAllowedDimensions.end(); i++) {
+ std::cerr << *i << "D ";
}
std::cerr << std::endl << "**Error** Allowed pixel types: \t";
- for(unsigned int i=0; i<mListOfAllowedPixelType.size(); i++) {
- std::cerr << mListOfAllowedPixelType[i] << " ";
+ for(std::set<std::string>::const_iterator i=mListOfAllowedPixelTypes.begin();
+ i!=mListOfAllowedPixelTypes.end(); i++) {
+ std::cerr << *i << " ";
}
std::cerr << std::endl;
exit(0);
Program: vv
Module: $RCSfile: vvToolBinarize.cxx,v $
Language: C++
- Date: $Date: 2010/02/03 10:54:08 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2010/02/03 13:08:55 $
+ Version: $Revision: 1.4 $
Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr)
Copyright (C) 2008
int slice = mCurrentSliceManager->GetSlicer(0)->GetSlice();
- int tslice = mCurrentSliceManager->GetSlicer(0)->GetTSlice();
+ //int tslice = mCurrentSliceManager->GetSlicer(0)->GetTSlice();
mClipper->SetInput(mCurrentSliceManager->GetSlicer(0)->GetInput());
int* extent = mCurrentSliceManager->GetSlicer(0)->GetImageActor()->GetDisplayExtent();
mClipper->SetOutputWholeExtent(extent[0],extent[1],extent[2],extent[3],extent[4],extent[5]);