[Insight-users] Local Image Filter (adaptative threshold)
Mathieu Malaterre
malat@free.fr
Tue, 11 Feb 2003 20:04:03 +0100
Luis,
Thanks for pointing me out this filter but I am sorry I didn't manage
to get it to work:
Here is my code:
#include "itkPlaheImageFilter.h"
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
#include "itkImage.h"
int main( int argc, char ** argv )
{
// Verify the number of parameters in the command line
if( argc < 3 )
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " inputImageFile outputImageFile " <<
std::endl;
return -1;
}
typedef unsigned short PixelType;
const unsigned int Dimension = 2;
typedef itk::Image<PixelType, Dimension> ImageType;
typedef itk::PlaheImageFilter< ImageType > PlaheType;
typedef itk::ImageFileReader< ImageType > ReaderType;
typedef itk::ImageFileWriter< ImageType > WriterType;
PlaheType::Pointer plahe = PlaheType::New();
ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
const char * inputFilename = argv[1];
const char * outputFilename = argv[2];
reader->SetFileName( inputFilename );
writer->SetFileName( outputFilename );
plahe->SetInput( reader->GetOutput() );
writer->SetInput( plahe->GetOutput() );
try {
// window[] is a neighborhood of a evaluated pixel
unsigned int window[Dimension];
window[0] = 9;
window[1] = 9;
// Set window, alpha, and beta which are parameters for Plahe algorithm
std::cout << "Set Plahe parameters" << endl;
plahe->SetWindow(window);
plahe->SetAlpha(0.3);
plahe->SetBeta(0.3);
writer->Update();
}
catch( itk::ExceptionObject & err ) {
std::cout << "ExceptionObject caught !" << std::endl;
std::cout << err << std::endl;
return -1;
}
return 0;
}
And here is the error:
/home/malat/Kitware/Insight/Code/BasicFilters/itkPlaheImageFilter.txx:
In method `void
itk::PlaheImageFilter<TImageType>::GenerateData () [with TImageType =
main (int, char **)::ImageType]':
/home/malat/Kitware/Insight/Code/Numerics/vxl/vnl/vnl_matrix_fixed_ref.h:50:
instantiated from here
/home/malat/Kitware/Insight/Code/BasicFilters/itkPlaheImageFilter.txx:103:
no matching function for
call to `itk::ImageRegionIterator<main (int, char
**)::ImageType>::ImageRegionIterator
(itk::SmartPointer<itk::Image<float, 2> > &, itk::ImageRegion<2> &)'
/home/malat/Kitware/Insight/Code/Common/itkImageRegionIterator.txx:30:
candidates are:
itk::ImageRegionIterator<TImage>::ImageRegionIterator () [with TImage =
main (int, char **)::ImageType]
/home/malat/Kitware/Insight/Code/Common/itkImageRegionIterator.txx:40:
itk::ImageRegionIterator<TImage>::ImageRegionIterator (typename
itk::ImageRegionConstIterator<TImage>::ImageType *, typename
itk::ImageRegionConstIterator<TImage>::RegionType &) [with TImage = main
(int, char **)::ImageType]
/home/malat/Kitware/Insight/Code/Common/itkImageRegionIterator.txx:51:
itk::ImageRegionIterator<TImage>::ImageRegionIterator (const
itk::ImageIteratorWithIndex<TImage> &)
[with TImage = main (int, char **)::ImageType]
/home/malat/Kitware/Insight/Code/Common/itkImageRegionIterator.txx:59:
itk::ImageRegionIterator<TImage>::ImageRegionIterator (const
itk::ImageRegionConstIterator<TImage> &)
[with TImage = main (int, char **)::ImageType]
/home/malat/Kitware/Insight/Code/Common/itkImageRegionIterator.h:46:
itk::ImageRegionIterator<main (int, char
**)::ImageType>::ImageRegionIterator (const
itk::ImageRegionIterator<main (int, char **)::ImageType> &)
/home/malat/Kitware/Insight/Code/Numerics/vxl/vnl/vnl_matrix_fixed_ref.h:50:
instantiated from here
/home/malat/Kitware/Insight/Code/BasicFilters/itkPlaheImageFilter.txx:113:
warning: passing `double'
for argument 1 of `itk::ImageRegionIterator<TImage>::Set (typename
itk::ImageRegionConstIterator<TImage>::PixelType &) const [with TImage =
main (int, char
**)::ImageType]'
/home/malat/Kitware/Insight/Code/Numerics/vxl/vnl/vnl_matrix_fixed_ref.h:50:
instantiated from here
/home/malat/Kitware/Insight/Code/BasicFilters/itkPlaheImageFilter.txx:224:
no matching function for
call to `itk::ImageRegionIterator<main (int, char
**)::ImageType>::ImageRegionIterator
(itk::SmartPointer<itk::Image<float, 2> > &, itk::ImageRegion<2> &)'
/home/malat/Kitware/Insight/Code/Common/itkImageRegionIterator.txx:30:
candidates are:
itk::ImageRegionIterator<TImage>::ImageRegionIterator () [with TImage =
main (int, char **)::ImageType]
/home/malat/Kitware/Insight/Code/Common/itkImageRegionIterator.txx:40:
itk::ImageRegionIterator<TImage>::ImageRegionIterator (typename
itk::ImageRegionConstIterator<TImage>::ImageType *, typename
itk::ImageRegionConstIterator<TImage>::RegionType &) [with TImage = main
(int, char **)::ImageType]
/home/malat/Kitware/Insight/Code/Common/itkImageRegionIterator.txx:51:
itk::ImageRegionIterator<TImage>::ImageRegionIterator (const
itk::ImageIteratorWithIndex<TImage> &)
[with TImage = main (int, char **)::ImageType]
/home/malat/Kitware/Insight/Code/Common/itkImageRegionIterator.txx:59:
itk::ImageRegionIterator<TImage>::ImageRegionIterator (const
itk::ImageRegionConstIterator<TImage> &)
[with TImage = main (int, char **)::ImageType]
/home/malat/Kitware/Insight/Code/Common/itkImageRegionIterator.h:46:
itk::ImageRegionIterator<main (int, char
**)::ImageType>::ImageRegionIterator (const
itk::ImageRegionIterator<main (int, char **)::ImageType> &)
make[1]: *** [PlaheTest.o] Erreur 1
make[1]: Quitte le répertoire
`/home/malat/Kitware/InsightBin/Applications/LocalRegionGrowingSegmentation'
make: *** [default_target] Erreur 2
What have done wrong ?
Thanks for any clue,
mathieu
Luis Ibanez wrote:
>
> Hi Mathieu,
>
> I'm affraid we don't have such a filter.
> However, it may be relatively easy to
> implement (an probably add to the toolkit).
>
> If you take a look at both the ConfidenceConnected
> and the Threshold connected you will see that
> most of the complexity is managed by the conditional
> flood fill iterator.
>
> The task left to the filter is basically to define
> the boolean criterion for accepting new points.
>
> --
>
> Would you like to give it a try to implement your
> suggested filter ?
>
> Whar are exactly the local rule you would like
> to see in the filter ? e.g. a piece of pseudo-code
> could help here.
>
> Updating the seed point is also possible at each
> iteration, it will be just a matter of defining
> a rule for selecting the new seed (or set of seeds
> since the FloodFill iterator accepts now a set
> of them). What rule do you have in mind ?
>
> We look forward to implement variants of the
> ConfidenceConnected and ThresholdConnected filters
> given that they have proved to be quite efficient.
>
> On the other hand, you may want to take a look
> at the adaptive enhancement filter used for
> mamograms. This is a contrast enhancement filter
> based on local properties. I wonder if you could
> use it as a preprocessing step, just before using
> one of the connectedness filters. Here is the man
> page for the Plahe filter.
> http://www.itk.org/Doxygen/html/classitk_1_1PlaheImageFilter.html
>
>
> Please let us know what you think,
>
>
> Thanks
>
>
> Luis
>
>
> -------------------------
>
> Mathieu Malaterre wrote:
>
>> Hi all,
>>
>> I am looking for an image filter that can threshold my image. It
>> should be a kind of mixture of ConnectedThresholdImageFilter but with
>> Local features. The filter would work on neightbourhood and not on a
>> global threshold. By the way I thought first that this filter would
>> be NeighborhoodConnectedImageFilter but there is only two *global*
>> thresholds.
>>
>> What I would like is filter that would update the threshold while
>> the region grows. If it possible could you point me out some filters
>> I could use.
>>
>> I also notice the filter ConfidenceConnectedImageFilter but I would
>> like to update the seed point (not a fixed one) while the region grows.
>>
>> Thanks,
>> mathieu
>>
>>
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users@public.kitware.com
>> http://public.kitware.com/mailman/listinfo/insight-users
>>
>
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users
>
>