Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sébastien Peillet
otb
Commits
8426dd2a
Commit
8426dd2a
authored
7 years ago
by
Cédric Traizet
Browse files
Options
Downloads
Patches
Plain Diff
autoencoder dim reduc added to the dim reduc app, dummy filter added (to delete later)
parent
3c3eddd1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/dummy_filter.h
+47
-0
47 additions, 0 deletions
include/dummy_filter.h
include/dummy_filter.txx
+79
-0
79 additions, 0 deletions
include/dummy_filter.txx
with
126 additions
and
0 deletions
include/dummy_filter.h
0 → 100644
+
47
−
0
View file @
8426dd2a
#ifndef __dummy_Filter_h
#define __dummy_Filter_h
#include
"itkImageToImageFilter.h"
#include
"itkMacro.h"
template
<
class
TImage
>
class
ITK_EXPORT
DummyFilter
:
public
itk
::
ImageToImageFilter
<
TImage
,
TImage
>
{
public:
/** Standard class typedefs. */
typedef
DummyFilter
Self
;
typedef
itk
::
ImageToImageFilter
<
TImage
,
TImage
>
Superclass
;
typedef
itk
::
SmartPointer
<
Self
>
Pointer
;
/** Method for creation through the object factory. */
itkNewMacro
(
Self
);
/** Run-time type information (and related methods). */
itkTypeMacro
(
DummyFilter
,
ImageToImageFilter
);
//void SetInputImage(const TImage* image);
protected:
DummyFilter
();
~
DummyFilter
(){}
typename
TImage
::
ConstPointer
GetInputImage
();
/** Does the real work. */
virtual
void
BeforeThreadedGenerateData
();
void
ThreadedGenerateData
(
const
typename
TImage
::
RegionType
&
outputRegionForThread
,
unsigned
int
threadId
)
ITK_OVERRIDE
;
private
:
DummyFilter
(
const
Self
&
);
//purposely not implemented
void
operator
=
(
const
Self
&
);
//purposely not implemented
};
#ifndef ITK_MANUAL_INSTANTIATION
#include
"dummy_filter.txx"
#endif
#endif // __dummy_Filter_h
This diff is collapsed.
Click to expand it.
include/dummy_filter.txx
0 → 100644
+
79
−
0
View file @
8426dd2a
#ifndef __dummy_filter_txx
#define __dummy_filter_txx
#include "dummy_filter.h"
#include <fstream>
#include "itkObjectFactory.h"
#include "itkImageRegionIterator.h"
#include "itkImageRegionConstIterator.h"
#include "otbVectorImage.h"
/*
#include <shark/Data/Csv.h>
#include <shark/Data/Pgm.h> //for exporting the learned filters
#include <shark/Data/SparseData.h>//for reading in the images as sparseData/Libsvm format
#include <shark/Models/Autoencoder.h>//normal autoencoder model
#include <shark/Models/TiedAutoencoder.h>//autoencoder with tied weights
#include <shark/Models/Normalizer.h>
#include <shark/Algorithms/Trainers/NormalizeComponentsUnitVariance.h>
*/
//using namespace shark;
template< class TImage>
DummyFilter<TImage>::DummyFilter()
{
this->SetNumberOfRequiredInputs(1);
}
template< class TImage>
typename TImage::ConstPointer DummyFilter<TImage>::GetInputImage()
{
return static_cast< const TImage * >
( this->itk::ProcessObject::GetInput(0) );
}
template< class TImage>
void DummyFilter<TImage>::BeforeThreadedGenerateData()
{
#ifdef _OPENMP
// OpenMP will take care of threading
this->SetNumberOfThreads(1);
#endif
}
/*template< class TImage, class AutoencoderModel, class NormalizerModel>
void EncodeFilter<TImage, AutoencoderModel, NormalizerModel>::GenerateData()*/
template< class TImage>
void DummyFilter<TImage>::ThreadedGenerateData(const typename TImage::RegionType &outputRegionForThread, unsigned int threadId)
{
//Data_with_info info;
typename TImage::ConstPointer input = this->GetInput();
typename TImage::Pointer output = this->GetOutput();
// Image to vector
const unsigned int img_bands = input->GetNumberOfComponentsPerPixel();
itk::ImageRegionConstIterator<TImage> inputIterator(input,outputRegionForThread);
itk::ImageRegionIterator<TImage> imageIteratorOut(output,outputRegionForThread);
typename TImage::PixelType pixelValue;
while(!inputIterator.IsAtEnd()){
imageIteratorOut.Set(inputIterator.Get());
++inputIterator;
++imageIteratorOut;
}
}
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment