<commit_before>
#include <qapplication.h>
#include <qpushbutton.h>

#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkDiscreteGaussianImageFilter.h"

#include "itkQtAdaptor.h"


int main(int argc, char **argv)
{

  typedef itk::Image< float, 2 > ImageType;

  typedef itk::DiscreteGaussianImageFilter< 
                    ImageType,
                    ImageType >  FilterType;

  typedef itk::ImageFileReader< ImageType > ReaderType;

  ReaderType::Pointer reader = ReaderType::New();
  
  FilterType::Pointer filter = FilterType::New();

  filter->SetInput( reader->GetOutput() );

  // Create Qt Application to let Qt get its 
  // parameters from the command line
  QApplication app( argc, argv );

  reader->SetFileName( argv[1] );

  QPushButton  bb( "Start", 0 );
  bb.resize( 100, 30 );

  typedef itk::QtSlotAdaptor<FilterType> SlotAdaptorType;
  SlotAdaptorType slotAdaptor;

  // Connect the adaptor to a method of the ITK filter
  slotAdaptor.SetCallbackFunction( filter, & FilterType::Update );

  // Connect the adaptor's Slot to the Qt Widget Signal
  QObject::connect( &bb, SIGNAL(clicked()), &slotAdaptor, SLOT(Slot()) );


  typedef itk::QtSignalAdaptor SignalAdaptorType;
  SignalAdaptorType signalAdaptor;

  // Connect the adaptor as an observer of a Filter's event
  filter->AddObserver( itk::StartEvent(),  signalAdaptor.GetCommand() );

  // Connect the adaptor's Signal to the Qt Widget Slot
//  QObject::connect( &signalAdaptor, SIGNAL(Signal()), &bb, SLOT(Slot()) );





  app.setMainWidget( &bb );
  bb.show();

  return app.exec();

}<commit_msg>ENH: more buttons added. Connection from a ITK event to a QT signal tested.<commit_after>
#include <qapplication.h>
#include <qpushbutton.h>
#include <qslider.h>
#include <qvbox.h>

#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkDiscreteGaussianImageFilter.h"

#include "itkQtAdaptor.h"


int main(int argc, char **argv)
{

  typedef itk::Image< float, 2 > ImageType;

  typedef itk::DiscreteGaussianImageFilter< 
                    ImageType,
                    ImageType >  FilterType;

  typedef itk::ImageFileReader< ImageType > ReaderType;

  ReaderType::Pointer reader = ReaderType::New();
  
  FilterType::Pointer filter = FilterType::New();

  filter->SetInput( reader->GetOutput() );

  // Create Qt Application to let Qt get its 
  // parameters from the command line
  QApplication app( argc, argv );

  reader->SetFileName( argv[1] );

  QVBox qb;
  qb.resize(120,200);

  QPushButton  bb( "Start", &qb );
  bb.resize( 100, 30 );

  QPushButton  cc( "State", &qb );
  cc.resize( 100, 30 );

  QPushButton  qt( "Quit", &qb );
  qt.resize( 100, 30 );

  QSlider qs( QSlider::Horizontal, &qb, "Progress");
  qs.resize( 100, 30 );
  qs.setRange(0,100);
  qs.setValue(0);
  

  typedef itk::QtSlotAdaptor<FilterType> SlotAdaptorType;
  SlotAdaptorType slotAdaptor;

  // Connect the adaptor to a method of the ITK filter
  slotAdaptor.SetCallbackFunction( filter, & FilterType::Update );

  // Connect the adaptor's Slot to the Qt Widget Signal
  QObject::connect( &bb, SIGNAL(clicked()), &slotAdaptor, SLOT(Slot()) );


  typedef itk::QtSignalAdaptor SignalAdaptorType;
  SignalAdaptorType signalAdaptor;

  // Connect the adaptor as an observer of a Filter's event
  filter->AddObserver( itk::StartEvent(),  signalAdaptor.GetCommand() );

  // Connect the adaptor's Signal to the Qt Widget Slot
  QObject::connect( &signalAdaptor, SIGNAL(Signal()), &cc, SLOT(toggle()) );



  // Connect the Quit button signal to the quit slot of the application
  QObject::connect( &qt, SIGNAL(clicked()), &app, SLOT(quit()) );




  app.setMainWidget( &qb );
  qb.show();

  return app.exec();

}
{'fraction_non_alphanumeric': 0.1278661990828163, 'fraction_numerical': 0.011060156460749933, 'mean_word_length': 3.9705093833780163, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4843484', 'n_tokens_mistral': 1340, 'n_tokens_neox': 1211, 'n_words': 331}