diff --git a/app/cbDimensionalityReductionTrainer.cxx b/app/cbDimensionalityReductionTrainer.cxx index cde3bfd6d7ab1d3a774aea585b6feafcbc1dac01..55232ef871b527a00e5e3664737eb2bb4c9bdb1f 100644 --- a/app/cbDimensionalityReductionTrainer.cxx +++ b/app/cbDimensionalityReductionTrainer.cxx @@ -81,8 +81,6 @@ private: void DoExecute() { - std::cout << "Appli Training!" << std::endl; - std::string shapefile = GetParameterString("io.vd"); otb::ogr::DataSource::Pointer source = otb::ogr::DataSource::New(shapefile, otb::ogr::DataSource::Modes::Read); @@ -103,9 +101,7 @@ private: } input->PushBack(mv); } - std::cout << GetParameterStringList("feat")[0] << std::endl; - std::cout << input->GetMeasurementVector(0) << std::endl; - + MeasurementType meanMeasurementVector; MeasurementType stddevMeasurementVector; diff --git a/app/cbDimensionalityReductionVector.cxx b/app/cbDimensionalityReductionVector.cxx index ec11ba8adc6e7bcfdf62e902f023857415d039dc..cf2caed54850b84703a3a5d34670438f9c5c3a5f 100644 --- a/app/cbDimensionalityReductionVector.cxx +++ b/app/cbDimensionalityReductionVector.cxx @@ -151,14 +151,18 @@ class CbDimensionalityReductionVector : public Application { std::string item = layerDefn.GetFieldDefn(iField)->GetNameRef(); std::string key(item); + std::string::iterator end = std::remove_if( key.begin(), key.end(), IsNotAlphaNum ); + std::transform( key.begin(), end, key.begin(), tolower ); + /* key.erase( std::remove_if(key.begin(),key.end(),IsNotAlphaNum), key.end()); - std::transform(key.begin(), key.end(), key.begin(), tolower); + std::transform(key.begin(), key.end(), key.begin(), tolower);*/ OGRFieldType fieldType = layerDefn.GetFieldDefn(iField)->GetType(); - /*if(fieldType == OFTInteger || ogr::version_proxy::IsOFTInteger64(fieldType) || fieldType == OFTReal) + /* if(fieldType == OFTInteger || ogr::version_proxy::IsOFTInteger64(fieldType) || fieldType == OFTReal) {*/ - std::string tmpKey="feat."+key; + //std::string tmpKey="feat."+key; + std::string tmpKey = "feat." + key.substr( 0, static_cast<unsigned long>( end - key.begin() ) ); AddChoice(tmpKey,item); - //} + //} // this is the same as in otbVectorClassifier, but it doesnt work } } @@ -170,16 +174,6 @@ class CbDimensionalityReductionVector : public Application clock_t tic = clock(); - std::cout << GetChoiceKeys("feat")[0] << std::endl; - std::cout << GetChoiceKeys("feat")[1] << std::endl; - std::cout << GetChoiceKeys("feat")[2] << std::endl; - std::cout << GetChoiceKeys("feat")[3] << std::endl; - std::cout << GetChoiceKeys("feat")[4] << std::endl; - std::cout << GetChoiceKeys("feat")[5] << std::endl; - std::cout << GetChoiceKeys("feat")[6] << std::endl; - std::cout << GetChoiceKeys("feat")[7] << std::endl; - std::cout << GetChoiceKeys("feat")[8] << std::endl; - std::string shapefile = GetParameterString("in"); otb::ogr::DataSource::Pointer source = otb::ogr::DataSource::New(shapefile, otb::ogr::DataSource::Modes::Read); otb::ogr::Layer layer = source->GetLayer(0); @@ -189,7 +183,7 @@ class CbDimensionalityReductionVector : public Application input->SetMeasurementVectorSize(nbFeatures); otb::ogr::Layer::const_iterator it = layer.cbegin(); otb::ogr::Layer::const_iterator itEnd = layer.cend(); - std::cout << (*it)[GetSelectedItems("feat")[0]].GetValue<double>() << std::endl; + for( ; it!=itEnd ; ++it) { MeasurementType mv; @@ -203,17 +197,8 @@ class CbDimensionalityReductionVector : public Application input->PushBack(mv); } - std::cout << GetSelectedItems("feat")[0] << std::endl; - std::cout << input->GetMeasurementVector(0) << std::endl; - - - - - - - /** Statistics for shift/scale */ MeasurementType meanMeasurementVector; @@ -267,9 +252,7 @@ class CbDimensionalityReductionVector : public Application ListSampleType::Pointer listSample = trainingShiftScaleFilter->GetOutput(); ListSampleType::Pointer target = m_Model->PredictBatch(listSample); - target = input; - std::cout << target->GetMeasurementVector(0) << std::endl; - std::cout << input->GetMeasurementVector(0) << std::endl; + /** Create/Update Output Shape file */ std::cout << GetParameterStringList("featout").size() << std::endl; diff --git a/include/ImageDimensionalityReductionFilter.txx b/include/ImageDimensionalityReductionFilter.txx index 7f7b70284c8a4d92cb7ddb155a032e8e4c96cf68..e98a0b79f753624246d732d01e60a47b43f2595a 100644 --- a/include/ImageDimensionalityReductionFilter.txx +++ b/include/ImageDimensionalityReductionFilter.txx @@ -189,7 +189,7 @@ ImageDimensionalityReductionFilter<TInputImage, TOutputImage, TMaskImage> // This call is threadsafe labels = m_Model->PredictBatch(samples); - labels = samples; + // Set the output values typename TargetListSampleType::ConstIterator labIt = labels->Begin();