Skip to content
Snippets Groups Projects
Commit 6ad2785a authored by Manuel Grizonnet's avatar Manuel Grizonnet
Browse files

TEST:try to investigate rx bug with roi

parent 05ac6ac4
Branches
Tags
No related merge requests found
......@@ -16,8 +16,8 @@
=========================================================================*/
#ifndef __otbLocalRxDetectorFilter_h
#define __otbLocalRxDetectorFilter_h
#ifndef __otbLocalRxDetectorNonThreadFilter_h
#define __otbLocalRxDetectorNonThreadFilter_h
#include "itkImageToImageFilter.h"
......@@ -32,20 +32,20 @@
namespace otb
{
/** \class otbLocalRxDetectorFilter
/** \class otbLocalRxDetectorNonThreadFilter
* \brief Local-RX detector algorithm with multichannel VectorImage data as input
*
*
* \ingroup ImageFilters
*/
template <class TInputImage, class TOutputImage>
class ITK_EXPORT LocalRxDetectorFilter:
class ITK_EXPORT LocalRxDetectorNonThreadFilter:
public itk::ImageToImageFilter<TInputImage,TOutputImage>
{
public:
/** Standard class typedefs. */
typedef LocalRxDetectorFilter Self;
typedef LocalRxDetectorNonThreadFilter Self;
typedef itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
......@@ -54,7 +54,7 @@ public:
itkNewMacro(Self);
/** Creation through object factory macro */
itkTypeMacro(LocalRxDetectorFilter, ImageToImageFilter);
itkTypeMacro(LocalRxDetectorNonThreadFilter, ImageToImageFilter);
/** typedef related to input and output images */
typedef TInputImage InputImageType;
......@@ -97,12 +97,12 @@ public:
protected:
LocalRxDetectorFilter();
virtual ~LocalRxDetectorFilter() {}
LocalRxDetectorNonThreadFilter();
virtual ~LocalRxDetectorNonThreadFilter() {}
void PrintSelf(std::ostream& os, itk::Indent indent) const;
private:
LocalRxDetectorFilter(const Self&); //purposely not implemented
LocalRxDetectorNonThreadFilter(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
int m_InternalRadius;
......@@ -113,7 +113,7 @@ private:
} // end namespace otb
#ifndef OTB_MANUAL_INSTANTIATION
#include "otbLocalRxDetectorFilter_nonThreaded.txx"
#include "otbLocalRxDetectorNonThreadFilter.txx"
#endif
#endif
#ifndef __otbLocalRxDetectorFilter_txx
#define __otbLocalRxDetectorFilter_txx
#ifndef __otbLocalRxDetectorNonThreadFilter_txx
#define __otbLocalRxDetectorNonThreadFilter_txx
#include "otbLocalRxDetectorFilter.h"
#include "otbLocalRxDetectorNonThreadFilter.h"
namespace otb
{
......@@ -11,8 +11,8 @@ namespace otb
*
*/
template <class TInputImage, class TOutputImage>
LocalRxDetectorFilter<TInputImage, TOutputImage>
::LocalRxDetectorFilter()
LocalRxDetectorNonThreadFilter<TInputImage, TOutputImage>
::LocalRxDetectorNonThreadFilter()
{
this->m_ExternalRadius = 0;
this->m_InternalRadius = 0;
......@@ -23,7 +23,7 @@ LocalRxDetectorFilter<TInputImage, TOutputImage>
*/
template <class TInputImage, class TOutputImage>
void
LocalRxDetectorFilter<TInputImage, TOutputImage>
LocalRxDetectorNonThreadFilter<TInputImage, TOutputImage>
::PrintSelf(std::ostream& os, itk::Indent indent) const
{
Superclass::PrintSelf(os,indent);
......@@ -37,7 +37,7 @@ LocalRxDetectorFilter<TInputImage, TOutputImage>
*/
template <class TInputImage, class TOutputImage>
void
LocalRxDetectorFilter<TInputImage, TOutputImage>
LocalRxDetectorNonThreadFilter<TInputImage, TOutputImage>
::GenerateData()
{
......@@ -82,7 +82,7 @@ LocalRxDetectorFilter<TInputImage, TOutputImage>
}
// Iterator on output region
FaceCalculatorType faceCalculator;
FaceCalculatorType faceCalculator;
typename FaceCalculatorType::FaceListType faceList;
typename FaceCalculatorType::FaceListType::iterator fit;
......@@ -107,6 +107,7 @@ LocalRxDetectorFilter<TInputImage, TOutputImage>
for (ci = inputIt.Begin(); !ci.IsAtEnd(); ++ci)
{
// Pushback element in listSample
//std::cout << "pixel of shaped iteror : " << ci.Get() << std::endl;
listSample->PushBack(ci.Get());
}
......@@ -156,7 +157,7 @@ LocalRxDetectorFilter<TInputImage, TOutputImage>
*/
template <class TInputImage, class TOutputImage>
void
LocalRxDetectorFilter<TInputImage, TOutputImage>
LocalRxDetectorNonThreadFilter<TInputImage, TOutputImage>
::GenerateInputRequestedRegion()
{
// Call the superclass' implementation of this method
......
......@@ -191,6 +191,6 @@ ADD_TEST(tvLocalRXDetectorROI
${TEMP}/localRXROICupriteSubHsi.tif
7
1
60
60
8
8
)
......@@ -2,7 +2,7 @@
#include "otbImage.h"
#include "otbVectorImage.h"
#include "otbStreamingImageFileWriter.h"
#include "otbLocalRxDetectorFilter.h"
#include "otbLocalRxDetectorNonThreadFilter.h"
#include "itkRescaleIntensityImageFilter.h"
#include "otbExtractROI.h"
......@@ -12,11 +12,11 @@ int LocalRXDetectorROITest(int argc, char * argv[])
typedef double PixelType;
typedef otb::VectorImage<PixelType, 2> VectorImageType;
typedef otb::Image<PixelType, 2> ImageType;
typedef otb::LocalRxDetectorFilter<VectorImageType, ImageType> LocalRxDetectorFilterType;
typedef otb::LocalRxDetectorNonThreadFilter<VectorImageType, ImageType> LocalRxDetectorFilterType;
typedef otb::ImageFileReader<VectorImageType> ReaderType;
typedef unsigned char WritePixelType;
typedef otb::Image<WritePixelType> WriteImageType;
typedef otb::StreamingImageFileWriter<WriteImageType> WriterType;
typedef otb::StreamingImageFileWriter<ImageType> WriterType;
typedef itk::RescaleIntensityImageFilter<ImageType, WriteImageType> RescalerType;
typedef otb::ExtractROI<ImageType::PixelType, ImageType::PixelType> ExtractRoiType;
......@@ -31,21 +31,12 @@ int LocalRXDetectorROITest(int argc, char * argv[])
const int nbCol = atoi(argv[5]);
const int nbRow = atoi(argv[6]);
const int idxCol = 0;
const int idxRow = 0;
//--------------- Read hsi file -----------------//
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(filename);
reader->UpdateOutputInformation();
std::cout << "File read : OK" << std::endl;
//------------- Anomaly detection ---------------//
LocalRxDetectorFilterType::Pointer rxDetector = LocalRxDetectorFilterType::New();
......@@ -53,37 +44,29 @@ int LocalRXDetectorROITest(int argc, char * argv[])
rxDetector->SetInternalRadius(internalRadius);
rxDetector->SetInput(reader->GetOutput());
std::cout << "Anomaly detection ok" << std::endl;
//--------------- Define the ROI ----------------//
ImageType::SizeType size;
size[0] = nbCol;
size[1] = nbRow;
ImageType::IndexType index;
index[0] = idxCol;
index[1] = idxRow;
index[0] = 0;
index[1] = 0;
ImageType::RegionType region;
region.SetSize(size);
region.SetIndex(index);
std::cout << "ROI defined OK" << std::endl;
//------------ Build extractRoiFilter -----------//
ExtractRoiType::Pointer roiExtractor = ExtractRoiType::New();
roiExtractor->SetExtractionRegion(region);
roiExtractor->SetInput(rxDetector->GetOutput());
std::cout << "build extractor ok" << std::endl;
//roiExtractor->SetExtractionRegion(region);
roiExtractor->SetStartX(0);
roiExtractor->SetStartY(0);
roiExtractor->SetSizeX(nbCol);
roiExtractor->SetSizeY(nbRow);
roiExtractor->SetInput(rxDetector->GetOutput());
//------------ rescaling and writing ------------//
......@@ -94,9 +77,7 @@ int LocalRXDetectorROITest(int argc, char * argv[])
WriterType::Pointer writer = WriterType::New();
writer->SetFileName(outputFilename);
writer->SetInput(rescaler->GetOutput());
std::cout << "Rescaling and writing ok" << std::endl;
writer->SetInput(roiExtractor->GetOutput());
//---------------- Launching pipeline ------------//
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment