FANDOM


< Code

Only the most interesting 'test()' function of 'FiltersTest' Edit

-> in this function you will find a sample code for each filters

unit test;

(* ***** BEGIN LICENSE BLOCK *****
 * Copyright (C) 2004 Durand Emmanuel
 * Copyright (C) 2004 Burgel Eric
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Contact :
 *   filters@edurand.com
 *   filters@burgel.com
 * Site :
 *   http://filters.sourceforge.net/
 *
 * ***** END LICENSE BLOCK ***** *)

{
 edurand (filters@edurand.com)
 eburgel (filters@burgel.com)
}

(...)

procedure TMainForm.Test();
var
  chrono : TChronometer;
  i, count : Integer;
  timePerRun : Integer;
  images : PArrayOfPBitmap32;
  pointers : PArrayOfPointers;
  decision : Integer;
  tmpPointer : Pointer;
  tmpI : Integer;
  tmpBlob : PBlob;
  tmpSingle : Single;
  tmpBoolean : boolean;
  tmpImage : PBitmap32;
  tmpImages : ArrayOfPBitmap32;
  tmpStr : String;
  tmpStrC : array[0..1024] of Char;
  x1, y1, x2, y2 : Integer ;
begin
 if testing=false then begin
  testing := true;
  image1:=imageOut; image2:=imageOut2;
  images:=nil;
  count:=StrToInt(txtProcessCount.Text);
  chrono:=TChronometer.Create;
  timePerRun:=0;
  for i:=1 to count do begin
    if panelActif=pAdd then begin
        imageOut2:=image.eraseOrCreateImageLike(imageOut2,imageIn);
        image2:=imageOut2;
        chrono.Start;
        setParameterImage( filterArithmeticAdd, 'inImage1', imageIn );
        setParameterImage( filterArithmeticAdd, 'inImage2', imageOut );
        setParameterImage( filterArithmeticAdd, 'outImage', imageOut2 );
        setParameterString( filterArithmeticAdd, 'mode', cbAddMode.Text );
        run( filterArithmeticAdd );
        chrono.Stop;
    end else
    if panelActif=pBlobExplorer then begin
        imageOut := image.eraseOrCreateImageLike( imageOut, imageIn );
        image1 := imageOut;
        chrono.Start;
        setParameterImage( filterBlobExplorer, 'inImage', imageIn );
        setParameterImage( filterBlobExplorer, 'outImage', imageOut );
        setParameterBoolean( filterBlobExplorer, 'intensityInvert', chkBlobExplorerIntensityInvert.Checked );
        setParameterInteger( filterBlobExplorer, 'intensityBackground', sbBlobExplorerIntensityBackground.Position );
        setParameterInteger( filterBlobExplorer, 'intensityPrecision', sbBlobExplorerIntensityPrecision.Position );
        setParameterString( filterBlobExplorer, 'enableBlobArea', cbBlobExplorerEnableBlobArea.Text );
        setParameterInteger( filterBlobExplorer, 'blobAreaMin', StrToInt(txtBlobExplorerAreaMin.Text) );
        setParameterInteger( filterBlobExplorer, 'blobAreaMax', StrToInt(txtBlobExplorerAreaMax.Text) );
        setParameterBoolean( filterBlobExplorer, 'contour', chkBlobExplorerContour.Checked );
        setParameterBoolean( filterBlobExplorer, 'criticalPoints', chkBlobExplorerCriticalPoints.Checked );
        setParameterInteger( filterBlobExplorer, 'contourCriticalPointsAppoximationAccuracy', sbBlobExplorerCriticalPointsAppoximationAccuracy.Position );
        setParameterString( filterBlobExplorer, 'approximationMethod', cbBlobExplorerApproximationMethod.Text );
        setParameterBoolean( filterBlobExplorer, 'blobSurfaceInfo', chkBlobExplorerSurfaceInfo.Checked );
        setParameterBoolean( filterBlobExplorer, 'ignoreBlobsOnImageEdges', chkBlobExplorerIgnoreBlobsOnImageEdges.Checked );
        if cbBlobExplorerImageToShow.Text='blobs' then begin
          setParameterBoolean( filterBlobExplorer, 'monitoring', False );
        end else begin
          setParameterBoolean( filterBlobExplorer, 'monitoring', True );
        end;
        run( filterBlobExplorer);
        chrono.Stop;
        pointers := getOutputArrayPointers( filterBlobExplorer, 'blobs' );
        txtBlobExplorerNumberOfBlobs.Text := IntToStr( Length(pointers^) );
    end else
    if panelActif=pBlobRepositioning then begin
        // to test this filter, we need to do somethings
        preprocessSimulateAngle(imageIn,StrToFloat(txtBlobRepositioningSimulateAngle.Text)); // this function set 'imageSimulateAngle'
        chrono.Start;
          setParameterImage(filterBlobRepositioning,'inImage',imageSimulateAngle);
          setParameterBoolean(filterBlobRepositioning,'monitoring',chkBlobRepositioningMonitoring.Checked);
          setParameterInteger(filterBlobRepositioning,'margin', sbBlobRepositioningMargin.Position);
          tmpI:=360;
          if cbBlobRepositioningVectorhistogramAngleprecision.ItemIndex=1 then tmpI:=720
          else if cbBlobRepositioningVectorhistogramAngleprecision.ItemIndex=2 then tmpI:=3600
          else if cbBlobRepositioningVectorhistogramAngleprecision.ItemIndex=3 then tmpI:=36000;
          setParameterInteger(filterBlobRepositioning,'blob_ThresholdBackground',sbBlobRepositioningBlobThreshold.Position);
          setParameterInteger(filterBlobRepositioning,'blob_AreaMin',StrToInt(txtBlobRepositioningBlobAreaMin.Text));
          setParameterInteger(filterBlobRepositioning,'blob_AreaMax',StrToInt(txtBlobRepositioningBlobAreaMax.Text));
          setParameterInteger(filterBlobRepositioning,'vectorHistogram_anglePrecision', tmpI);
          setParameterInteger(filterBlobRepositioning,'vectorHistogram_smooth', sbBlobRepositioningSmooth.Position);
          run(filterBlobRepositioning);
          chrono.Stop;
          image1 := getOutputImage(filterBlobRepositioning,'outImage');
          imageOut:=image.eraseOrCreateImageLike(imageOut,image1);
          image.copyImageToImage(image1,imageOut);
          if chkBlobRepositioningMonitoring.Checked=true then begin
            images := getOutputImages(filterBlobRepositioning,'outImagesMonitoring');
            if (images<>nil) and (Length(images^)>0) then begin
              image2 := images^[cbBlobRepositioningMonitoringView.ItemIndex];
              imageOut2:=image.eraseOrCreateImageLike(imageOut2,image2);
              image.copyImageToImage(image2,imageOut2);
            end;
          end;
          tmpSingle:=getOutputFloat(filterBlobRepositioning,'angleToRestorOrientation');
          txtBlobRepositioningComputedAngle.Text := FloatToStrF(tmpSingle,ffFixed,4,1);
          tmpSingle:=calculAngleError(StrToFloat(txtBlobRepositioningSimulateAngle.Text),blobRepositioningLearnedAngle,getOutputFloat(filterBlobRepositioning,'angleToRestorOrientation'));
          txtBlobRepositioningError.Text := FloatToStrF(tmpSingle,ffFixed,4,1);
    end else
    if panelActif=pBlobRepositioning2 then begin
        // to test this filter, we need to do somethings
        preprocessSimulateAngle( imageIn, StrToFloat(txtBlobRepositioning2SimulateAngle.Text) ); // this function set 'imageSimulateAngle'
        chrono.Start;
          setParameterImage( filterBlobRepositioning2, 'inImage', imageSimulateAngle );
          setParameterBoolean( filterBlobRepositioning2, 'monitoring', chkBlobRepositioningMonitoring.Checked );
          setParameterInteger( filterBlobRepositioning2, 'margin', sbBlobRepositioning2Margin.Position );
          setParameterInteger( filterBlobRepositioning2, 'blob_ThresholdBackground', sbBlobRepositioning2BlobThreshold.Position );
          setParameterInteger( filterBlobRepositioning2, 'blob_AreaMin', StrToInt(txtBlobRepositioning2BlobAreaMin.Text) );
          setParameterInteger( filterBlobRepositioning2, 'blob_AreaMax', StrToInt(txtBlobRepositioning2BlobAreaMax.Text) );
          setParameterBoolean( filterBlobRepositioning2, 'backgroundColorBlack', chkBlobRepositioning2BackgroundColor.Checked );
          setParameterInteger( filterBlobRepositioning2, 'rotation_InterpolationMode', rdgBlobRepositioning2RotationInterpolation.ItemIndex );
          run( filterBlobRepositioning2 );
          chrono.Stop;
          image1 := getOutputImage( filterBlobRepositioning2, 'outImage' );
          imageOut := image.eraseOrCreateImageLike( imageOut, image1 );
          image.copyImageToImage( image1, imageOut );
          if chkBlobRepositioning2Monitoring.Checked=true then begin
            images := getOutputImages( filterBlobRepositioning2, 'outImagesMonitoring' );
            if (images<>nil) and (Length(images^)>0) then begin
              image2 := images^[cbBlobRepositioning2MonitoringView.ItemIndex];
              if image2<>nil then begin
                imageOut2 := image.eraseOrCreateImageLike( imageOut2, image2 );
                image.copyImageToImage( image2, imageOut2 );
              end;
            end;
          end;
          tmpSingle := getOutputFloat( filterBlobRepositioning2, 'angleToRestorOrientation' );
          txtBlobRepositioning2ComputedAngle.Text := FloatToStrF( tmpSingle, ffFixed, 4, 1 );
          tmpSingle := calculAngleError( StrToFloat(txtBlobRepositioning2SimulateAngle.Text), blobRepositioning2LearnedAngle, getOutputFloat(filterBlobRepositioning2, 'angleToRestorOrientation') );
          txtBlobRepositioning2Error.Text := FloatToStrF( tmpSingle, ffFixed, 6, 3 );
    end else
    if panelActif=pBlur then begin
        imageOut := image.eraseOrCreateImageLike(imageOut,imageIn);
        image1 := imageOut;
        chrono.Start;
        setParameterImage( filterBlur, 'inImage', imageIn );
        setParameterImage( filterBlur, 'outImage', imageOut );
        setParameterInteger( filterBlur, 'mode', rdgBlurMode.ItemIndex );
        setParameterInteger( filterBlur, 'radius', sbBlurRadius.position );
        if chkUseROI.Checked=true then begin
          setRegionOfInterest( filterBlur, @roi );
        end else begin
          unsetRegionOfInterest( filterBlur );
        end;
        run( filterBlur );
        chrono.Stop;
    end else
    if panelActif=pCellOnOff then begin
        imageOut:=image.eraseOrCreateImageLike(imageOut,imageIn);
        image1:=imageOut;
        imageOut2:=image.eraseOrCreateImageLike(imageOut2,imageIn);
        image2:=imageOut2;
        chrono.Start;
        setParameterImage(filterOnOffCell,'inImage',imageIn);
        setParameterImage(filterOnOffCell,'outImageON',imageOut);
        setParameterImage(filterOnOffCell,'outImageOFF',imageOut2);
        run(filterOnOffCell);
        chrono.Stop;
    end else
    if panelActif=pConstantAdd then begin
        preprocessMask(); // for imageMask
        imageOut := image.eraseOrCreateImageLike( imageOut, imageIn );
        image1 := imageOut;
        chrono.Start;
        setParameterImage( filterArithmeticConstantAdd, 'inImage', imageIn );
        setParameterImage( filterArithmeticConstantAdd, 'outImage', imageOut );
        setParameterInteger( filterArithmeticConstantAdd, 'constant', sbConstantAdd.Position );
        setParameterString( filterArithmeticConstantAdd, 'overflowingMode', cbConstantAddOverflowingMode.Text );
        setParameterImage( filterArithmeticConstantAdd, 'mask', imageMask );
        if chkUseROI.Checked=true then begin
          setRegionOfInterest( filterArithmeticConstantAdd, @roi );
        end else begin
          unsetRegionOfInterest( filterArithmeticConstantAdd );
        end;
        run( filterArithmeticConstantAdd );
        chrono.Stop;
    end else
    if panelActif=pRGB then begin
        preprocessMask(); // for imageMask
        imageOut := image.eraseOrCreateImageLike( imageOut, imageIn );
        image1 := imageOut;
        chrono.Start;
        setParameterImage( filterRGB, 'inImage', imageIn );
        setParameterImage( filterRGB, 'outImage', imageOut );
        setParameterInteger( filterRGB, 'constant_R', sbRGBConstantR.Position );
        setParameterInteger( filterRGB, 'constant_G', sbRGBConstantG.Position );
        setParameterInteger( filterRGB, 'constant_B', sbRGBConstantB.Position );
        setParameterString( filterRGB, 'overflowingMode', cbRGBOverflowingMode.Text );
        setParameterImage( filterRGB, 'mask', imageMask );
        if chkUseROI.Checked=true then begin
          setRegionOfInterest( filterRGB, @roi );
        end else begin
          unsetRegionOfInterest( filterRGB );
        end;
        run( filterRGB );
        chrono.Stop;
    end else
    if panelActif=pCorrelation then begin
        chrono.Start;
        setParameterImage(filterCorrelation,'inImage1',imageIn);
        setParameterImage(filterCorrelation,'inImage2',imageOut);
        setParameterInteger(filterCorrelation,'X',Floor(selectedPoint.x));
        setParameterInteger(filterCorrelation,'Y',Floor(selectedPoint.y));
        setParameterInteger(filterCorrelation,'rangeMin',sbCorrelationRangeMin.Position);
        setParameterInteger(filterCorrelation,'rangeMax',sbCorrelationRangeMax.Position);
        setParameterBoolean(filterCorrelation,'monitoring',chkCorrelationMonitoring.Checked);
        run(filterCorrelation);
        chrono.Stop;
        txtCorrelationCorrelation.Text:=FloatToStr(getOutputFloat(filterCorrelation,'correlation'));
        image2:=getOutputImage(filterCorrelation,'outImageMonitoring');
        imageOut2:=image.eraseOrCreateImageLike(imageOut2,image2);
        image.copyImageToImage(image2,imageOut2);
    end else
    if panelActif=pContrastExplorer then begin
        imageOut := image.eraseOrCreateImageLike(imageOut,imageIn);
        image1 := imageOut;
        chrono.Start;
        setParameterImage( filterContrastExplorer, 'inImage', imageIn );
        setParameterImage( filterContrastExplorer, 'outImage', imageOut );
        setParameterInteger( filterContrastExplorer, 'precision', sbContrastExplorerPrecision.Position );
        setParameterString( filterContrastExplorer, 'mode', cbContrastExplorerMode.Text );
        run( filterContrastExplorer );
        chrono.Stop;
    end else
    if panelActif=pConvolutions then begin
        imageOut:=image.eraseOrCreateImageLike(imageOut,imageIn);
        image1:=imageOut;
        chrono.Start;
        setParameterImage(filterConvolution,'inImage',imageIn);
        setParameterImage(filterConvolution,'outImage',imageOut);
        if lstConvType.ItemIndex>=0 then begin
          setParameterString(filterConvolution,'convType',lstConvType.items[lstConvType.ItemIndex]);
        end;
        run(filterConvolution);
        chrono.Stop;
    end else
    if panelActif=pCopy then begin
        preprocessMask(); // for imageMask
        chrono.Start;
        setParameterImage( filterCopy, 'inImage', imageIn );
        setParameterString( filterCopy, 'outputColor', cbCopyOutputColor.Text );
        setParameterImage( filterCopy, 'mask', imageMask );
        if chkUseROI.Checked=true then begin
          setRegionOfInterest( filterCopy, @roi );
        end else begin
          unsetRegionOfInterest( filterCopy );
        end;
        run( filterCopy );
        chrono.Stop;
        image1 := getOutputImage( filterCopy, 'outImage' );
        imageOut := image.eraseOrCreateImageLike( imageOut, image1 );
        image.copyImageToImage( image1, imageOut );
    end else
    if panelActif=pCutter then begin
        imageOut2:=image.eraseOrCreateImageLike(imageOut2,imageIn);
        image2:=imageOut2;
        chrono.Start;
        txtCutterOutimageIndex.Text:='';
        setParameterImage(filterCutter,'inImage',imageIn);
        setParameterImage(filterCutter,'outImageMonitoring',imageOut2);
        setParameterString(filterCutter,'type', cbCutterType.Text);
        setParameterInteger(filterCutter,'margin',sbCutterMargin.Position);
        if cbCutterType.Text='TILES' then begin
          setParameterInteger(filterCutter,'cutterTiles_RectWidth', sbCutterRectWidth.Position) ;
          setParameterInteger(filterCutter,'cutterTiles_RectHeight', sbCutterRectHeight.Position) ;
        end else
        if cbCutterType.Text='BLOB' then begin
          setParameterInteger(filterCutter,'cutterBlob_ThresholdBackground', sbCutterBlobBackground.Position);
          setParameterInteger(filterCutter,'cutterBlob_AreaMin', StrToInt(txtCutterBlobAreaMin.Text));
          setParameterInteger(filterCutter,'cutterBlob_AreaMax', StrToInt(txtCutterBlobAreaMax.Text));
          setParameterBoolean(filterCutter,'cutterBlob_Clean', chkCutterBlobClean.Checked);
          setParameterBoolean(filterCutter,'cutterBlob_UseBlobRepositioning', chkCutterBlobUseblobrepositioning.Checked);
        end;
        setParameterBoolean(filterCutter,'monitoring',chkCutterMonitoring.Checked);
        run(filterCutter);
        chrono.Stop;
        images := getOutputImages(filterCutter,'outImages');
        if images<>nil then begin
          if Length(images^)>0 then begin
            sbCutterOutImages.Max := Length(images^)-1 ;
          end else begin
            sbCutterOutImages.Max := 0;
          end;
          if sbCutterOutImages.position>=length(images^) then begin
            sbCutterOutImages.position:=0;
          end;
          if Length(images^)>0 then begin
            image1 := images^[sbCutterOutImages.position];
            imageOut:=image.eraseOrCreateImageLike(imageOut,image1);
            image.copyImageToImage(image1,imageOut);
            sbCutterOutImagesChange(Self);
          end;
        end;
    end else
    if panelActif=pDistancesMap then begin
        imageOut:=image.eraseOrCreateImageLike(imageOut,imageIn);
        image1:=imageOut;
        chrono.Start;
        setParameterImage(filterDistancesMap,'inImage',imageIn);
        setParameterImage(filterDistancesMap,'outImage',imageOut);
        setParameterBoolean(filterDistancesMap,'preprocessInvert', chkDistanceMapPreInvert.Checked);
        setParameterInteger(filterDistancesMap,'scale', sbDistanceMapScale.Position) ;
        run(filterDistancesMap);
        chrono.Stop;
        lblMaxEDM.Text := IntToStr(getOutputInteger(filterDistancesMap,'maxEDM')) ;
    end else
    if panelActif=pExplorer then begin
        chrono.Start;
        setParameterImage( filterExplorer, 'inImage', imageIn );
        setParameterInteger( filterExplorer, 'X', Round(poi.x) );
        setParameterInteger( filterExplorer, 'Y', Round(poi.y) );
        setParameterInteger( filterExplorer, 'precision', sbExplorerPrecision.Position );
        run( filterExplorer );
        chrono.Stop;
        images := getOutputImages( filterExplorer, 'outImages' );
        image1 := images^[0];
        imageOut:=image.eraseOrCreateImageLike( imageOut, image1 );
        image.copyImageToImage( image1, imageOut );
        image2 := images^[1];
        imageOut2:=image.eraseOrCreateImageLike( imageOut2, image2 );
        image.copyImageToImage( image2, imageOut2 );
    end else
    if panelActif=pGranularityExplorer then begin
        preprocessMask(); // for imageMask
        imageOut := image.eraseOrCreateImageLike(imageOut,imageIn);
        image1 := imageOut;
        chrono.Start;
        setParameterImage( filterGranularityExplorer, 'inImage', imageIn );
        setParameterImage( filterGranularityExplorer, 'outImage', imageOut );
        setParameterImage( filterGranularityExplorer, 'mask', imageMask );
        setParameterInteger( filterGranularityExplorer, 'precision', sbGranularityExplorerPrecision.Position );
        setParameterInteger( filterGranularityExplorer, 'sensibility', sbGranularityExplorerSensibility.Position );
        setParameterInteger( filterGranularityExplorer, 'differenceThreshold', sbGranularityExplorerDifferenceThreshold.Position );
        run( filterGranularityExplorer );
        chrono.Stop;
    end else
    if panelActif=pHistogram then begin
        chrono.Start;
        setParameterImage(filterHistogram,'inImage',imageIn);
        setParameterString(filterHistogram,'normalize',cbHistogramNormalize.Text);
        setParameterString(filterHistogram,'show','TRUE');
        setParameterInteger(filterHistogram,'precision',sbHistogramPrecision.Position);
        setParameterInteger(filterHistogram,'feature', cbHistogramFeature.ItemIndex);
        if chkUseROI.Checked=true then begin
          setRegionOfInterest( filterHistogram, @roi );
        end else begin
          unsetRegionOfInterest(filterHistogram);
        end;
        run(filterHistogram);
        chrono.Stop;
        images := getOutputImages(filterHistogram,'outImages');
        image1 := images^[0];
        imageOut:=image.eraseOrCreateImageLike(imageOut,image1);
        image.copyImageToImage(image1,imageOut);
    end else
    if panelActif=pHistogramContrast then begin
        chrono.Start;
        setParameterImage(filterHistogramContrast,'inImage',imageIn);
        setParameterString(filterHistogramContrast,'mode',cbHistogramContrastMode.Text);
        setParameterInteger(filterHistogramContrast,'rectangleWidth',sbHistogramContrastRectangleWidth.Position);
        setParameterInteger(filterHistogramContrast,'rectangleHeight',sbHistogramContrastRectangleHeight.Position);
        setParameterInteger(filterHistogramContrast,'gridSpacingWidth',sbHistogramContrastGridSpacingWidth.Position);
        setParameterInteger(filterHistogramContrast,'gridSpacingHeight',sbHistogramContrastGridSpacingHeight.Position);
        setParameterInteger(filterHistogramContrast,'precision',sbHistogramContrastPrecision.Position);
        setParameterInteger(filterHistogramContrast,'blurIteration',sbHistogramContrastBlur.Position);
        if chkUseROI.Checked=true then begin
          setRegionOfInterest(filterHistogramContrast,@roi);
        end else begin
          unsetRegionOfInterest(filterHistogramContrast);
        end;
        run(filterHistogramContrast);
        chrono.Stop;
        images := getOutputImages(filterHistogramContrast,'outImages');
        image1 := images^[0];
        imageOut:=image.eraseOrCreateImageLike(imageOut,image1);
        image.copyImageToImage(image1,imageOut);
        image2 := images^[1];
        if image2<>nil then begin
          imageOut2:=image.eraseOrCreateImageLike(imageOut2,image2);
          image.copyImageToImage(image2,imageOut2);
        end;
    end else
    if panelActif=pInvert then begin
        imageOut:=image.eraseOrCreateImageLike(imageOut,imageIn);
        image1:=imageOut;
        chrono.Start;
        setParameterImage(filterInvert,'inImage',imageIn);
        setParameterImage(filterInvert,'outImage',imageOut);
        if chkUseROI.Checked=true then begin
          setRegionOfInterest(filterInvert,@roi);
        end else begin
          unsetRegionOfInterest(filterInvert);
        end;
        run(filterInvert);
        chrono.Stop;
    end else
    if panelActif=pMeans then begin
        preprocessMask(); // for imageMask
        imageOut := image.eraseOrCreateImageLike( imageOut, imageIn );
        image1 := imageOut;
        chrono.Start;
        setParameterImage( filterMeans, 'inImage', imageIn );
        setParameterImage( filterMeans, 'outImage', imageOut );
        setParameterImage( filterMeans, 'mask', imageMask );
        setParameterInteger( filterMeans, 'precision', sbMeansPrecision.Position );
        if chkUseROI.Checked=true then begin
          setRegionOfInterest( filterMeans, @roi );
        end else begin
          unsetRegionOfInterest( filterMeans );
        end;
        run( filterMeans );
        chrono.Stop;
    end else
    if panelActif=pMedian then begin
        imageOut := image.eraseOrCreateImageLike( imageOut, imageIn );
        image1 := imageOut;
        chrono.Start;
        setParameterImage( filterMedian, 'inImage', imageIn );
        setParameterImage( filterMedian, 'outImage', imageOut );
        setParameterInteger( filterMedian, 'precision', sbMedian.Position );
        run( filterMedian );
        chrono.Stop;
    end else
    if panelActif=pMorphology then begin
        imageOut := image.eraseOrCreateImageLike(imageOut,imageIn);
        image1 := imageOut;
        chrono.Start;
        setParameterImage( filterMorphology, 'inImage', imageIn );
        setParameterImage( filterMorphology, 'outImage', imageOut );
        setParameterImage( filterMorphology, 'structuredElementImage', morphoSE );
        setParameterInteger( filterMorphology, 'iteration', sbMorphologyIteration.Position );
        if lstMorphologyType.ItemIndex>=0 then begin
          setParameterString( filterMorphology, 'type', lstMorphologyType.Items[lstMorphologyType.ItemIndex] );
        end;
        run( filterMorphology );
        chrono.Stop;
    end else
    if panelActif=pNonMaximaSuppression then begin
        preprocessMask(); // for imageMask
        imageOut := image.eraseOrCreateImageLike(imageOut,imageIn);
        image1 := imageOut;
        chrono.Start;
        setParameterImage( filterNonMaximaSuppression, 'inImage', imageIn );
        setParameterImage( filterNonMaximaSuppression, 'outImage', imageOut );
        setParameterString( filterNonMaximaSuppression, 'outputColor', cbNonMaximaSuppressionOutputColor.Text );
        setParameterInteger( filterNonMaximaSuppression, 'gain', sbNonMaximaSuppressionGain.Position );
        setParameterImage( filterNonMaximaSuppression, 'mask', imageMask );
        if chkUseROI.Checked=true then begin
          setRegionOfInterest( filterNonMaximaSuppression, @roi );
        end else begin
          unsetRegionOfInterest( filterNonMaximaSuppression );
        end;
        run( filterNonMaximaSuppression );
        chrono.Stop;
    end else
    if panelActif=pPyramid then begin
        chrono.Start;
        setParameterImage( filterPyramid, 'inImage', imageIn );
        run( filterPyramid );
        images := getOutputImages( filterPyramid, 'outImages' );

        if (images<>nil) and (Length(images^)>0) then begin
          sbPyramidNormalisation.Max := Length(images^);
          // Normalize ?
          if chkPyramidNormalize.Checked=true then Begin
            imageOut := image.eraseOrCreateImageLike( imageOut, imageIn );
            setParameterImage( filterNormalize, 'inImage', imageIn );
            image2 := images^[sbPyramidNormalisation.Max-sbPyramidNormalisation.Position];
            imageOut2 := image.eraseOrCreateImageLike( imageOut2, image2 );
            image.copyImageToImage( image2, imageOut2 );
            setParameterImage( filterNormalize, 'refImage', image2 );
            setParameterImage( filterNormalize, 'outImage', imageOut );
            run( filterNormalize );
            setParameterImage( filterPyramid, 'inImage', imageOut );
            run( filterPyramid );
            images := getOutputImages( filterPyramid, 'outImages' );
          end;
        end;

        // StackProcessor ?
        tmpStr := lstPyramidFilter.Items[lstPyramidFilter.ItemIndex] ;
        if tmpStr = 'ContrastExplorer' then begin
          setParameterPointer( filterStackProcessor, 'filter', Pointer(filterContrastExplorer) );
        end else if tmpStr = 'Blur' then begin
          setParameterPointer( filterStackProcessor, 'filter', Pointer(filterBlur) );
        end else if tmpStr = 'StandardDeviation' then begin
          setParameterPointer( filterStackProcessor, 'filter', Pointer(filterStandardDeviation) );
        end else if tmpStr = 'Convolution' then begin
          setParameterPointer( filterStackProcessor, 'filter', Pointer(filterConvolution) );
        end else if tmpStr = 'GranularityExplorer' then begin
          setParameterPointer( filterStackProcessor, 'filter', Pointer(filterGranularityExplorer) );
        end else if tmpStr = 'Sobel' then begin
          setParameterPointer( filterStackProcessor, 'filter', Pointer(filterSobel) );
        end else if tmpStr = 'Susan' then begin
          setParameterPointer( filterStackProcessor, 'filter', Pointer(filterSusan) );
        end else begin
          setParameterPointer( filterStackProcessor, 'filter',nil);
        end;
        setParameterImages( filterStackProcessor, 'inImages', images );
        run( filterStackProcessor );
        images := getOutputImages( filterStackProcessor, 'outImages' );

        if (images<>nil) and (Length(images^)>0) then begin
          sbPyramidNormalisation.Max := Length(images^)-1 ;
          // StackSmasher ?
          if chkPyramidSmasher.Checked Then Begin
            setParameterImages( filterStackSmasher, 'inImages', images );
            run( filterStackSmasher );
            image1 := getOutputImage( filterStackSmasher, 'outImage' );
            sbPyramid.Enabled := false;
          end else Begin
            sbPyramid.Max := Length(images^)-1 ;
            image1 := images^[sbPyramid.position];
            sbPyramid.Enabled := true ;
          End ;
        end;

        chrono.Stop;
        imageOut:=image.eraseOrCreateImageLike(imageOut,image1);
        image.copyImageToImage(image1,imageOut);
    end else
    if panelActif=pEnvelope then begin
        preprocessMask(); // for imageMask
        chrono.Start;
        setParameterImage( filterEnvelope, 'inImage', imageIn );
        setParameterImage( filterEnvelope, 'mask', imageMask );
        setParameterInteger( filterEnvelope, 'smooth', sbEnvelopeSmooth.Position );
        if chkUseROI.Checked=true then begin
          setRegionOfInterest( filterEnvelope, @roi );
        end else begin
          unsetRegionOfInterest( filterEnvelope );
        end;
        run( filterEnvelope );
        chrono.Stop;
        if lstEnvelopeOutputs.ItemIndex<0 then lstEnvelopeOutputs.ItemIndex := 0;
        lstEnvelopeOutputsClick( Self );
    end else
    if panelActif=pStackAnalyser then begin
        preprocessStackAnalyser();
        chrono.Start;
        setParameterImages( filterStackAnalyser, 'inImages', @imagesInStackAnalyser );
        setParameterImage( filterStackAnalyser, 'mask', imageMask );
        if chkUseROI.Checked=true then begin
          setRegionOfInterest( filterStackAnalyser, @roi );
        end else begin
          unsetRegionOfInterest( filterStackAnalyser );
        end;
        run( filterStackAnalyser );
        chrono.Stop;
        if lstStackAnalyserAnalyse.ItemIndex<0 then lstStackAnalyserAnalyse.ItemIndex := 0;
        lstStackAnalyserAnalyseClick( Self );
        sbStackAnalyserInImagesChange( Self );
    end else
    if panelActif=pStackCreator then begin
        chrono.Start;
        setParameterImage( filterStackCreator, 'inImage', imageIn );
        setParameterInteger( filterStackCreator, 'count', sbStackCreatorStackSize.Position );
        if chkUseROI.Checked=true then begin
          setRegionOfInterest( filterStackCreator, @roi );
        end else begin
          unsetRegionOfInterest( filterStackCreator );
        end;
        run( filterStackCreator );
        chrono.Stop;
        sbStackCreatorImageIndexChange( Self );
        // and we use stackAnalyser for the demo
        if chkStackCreatorDemoStackAnalyser.Checked=True then begin
          images := getOutputImages( filterStackCreator, 'outImages' );
          setParameterImages( filterStackAnalyser, 'inImages', images );
          setParameterImage( filterStackAnalyser, 'mask', imageMask );
          if chkUseROI.Checked=true then begin
            setRegionOfInterest( filterStackAnalyser, @roi );
          end else begin
            unsetRegionOfInterest( filterStackAnalyser );
          end;
          run( filterStackAnalyser );
          images := getOutputImages( filterStackAnalyser, 'outImages' );
          if (images<>nil) then begin
            tmpI := lstStackAnalyserAnalyse.ItemIndex;
            if tmpI<0 then tmpI := 0;
            image2 := images^[tmpI];
            if image2 <> nil Then Begin
              imageOut2 := image.eraseOrCreateImageLike( imageOut2, image2 );
              image.copyImageToImage( image2, imageOut2 );
            end;
          end;
        end;
    end else
    if panelActif=pResize then begin
        tmpSingle:=sbResizeScale.Position/100;
        image.freeImage(imageOut);
        imageOut:=image.createImage(round(imageIn.Width * tmpSingle), round(imageIn.Height * tmpSingle));
        image1:=imageOut;
        chrono.Start;
        setParameterImage(filterResize,'inImage',imageIn);
        setParameterImage(filterResize,'outImage',imageOut);
        setParameterInteger(filterResize,'mode', cbResizeMode.ItemIndex);
        if chkUseROI.Checked=true then begin
          setRegionOfInterest(filterResize,@roi);
        end else begin
          unsetRegionOfInterest(filterResize,);
        end;
        run(filterResize);
        chrono.Stop;
    end else
    if panelActif=pSobel then begin
        preprocessMask(); // for imageMask
        imageOut := image.eraseOrCreateImageLike( imageOut, imageIn );
        image1 := imageOut;
        imageOut2 := image.eraseOrCreateImageLike( imageOut2, imageIn );
        image2 := imageOut2;
        chrono.Start;
        setParameterImage( filterSobel, 'inImage', imageIn );
        setParameterImage( filterSobel, 'outImage', imageOut );
        setParameterImage( filterSobel, 'mask', imageMask );
        if chkUseROI.Checked=true then begin
          setRegionOfInterest( filterSobel, @roi );
        end else begin
          unsetRegionOfInterest( filterSobel );
        end;
        if chkSobelAngleCalculation.Checked=True then begin
          tmpImage := image.eraseOrCreateImageLike( tmpImage, imageIn );
          setParameterImage( filterSobel, 'outImageAngle', tmpImage );
          setParameterImage( filterSobel, 'outImageAngleMonitoring', imageOut2 );
        end else begin
          tmpImage := nil;
          setParameterImage( filterSobel, 'outImageAngle', nil );
          setParameterImage( filterSobel, 'outImageAngleMonitoring', nil );
        end;
        setParameterInteger( filterSobel, 'blurIteration', sbSobelBlurIteration.Position );
        setParameterInteger( filterSobel, 'gain', sbSobelGain.Position );
        setParameterInteger( filterSobel, 'thresholdLower', sbSobelThresholdLower.Position );
        setParameterInteger( filterSobel, 'thresholdUpper', sbSobelThresholdUpper.Position );
        setParameterString( filterSobel, 'modeFast', cbSobelModeFast.Text );
        run( filterSobel );
        chrono.Stop;
        if tmpImage<>nil then begin
          image.freeImage( tmpImage );
        end;
    end else
    if panelActif=pSPV then begin
        chrono.Start;
        setParameterImage(filterSPV,'inImage',imageIn);
        setParameterInteger(filterSPV,'backgroundThreshold',sbSPVBackground.Position);
        setParameterInteger(filterSPV,'scanLineIncrement',sbSPVScanLineIncrement.Position);
        setParameterInteger(filterSPV,'maximalTrackingStep',sbSPVmaximalTrackingStep.Position);
        setParameterInteger(filterSPV,'maximalTrackingCycles',sbSPVmaximalTrackingCycles.Position);
        setParameterString(filterSPV,'monitoring',cbSPVmonitoring.Text);
        setParameterString(filterSPV,'showVectorWidth',cbSPVShowVectorWidth.Text);
        setParameterString(filterSPV,'showConnectedVector',cbSPVShowConnectedVector.Text);
        setParameterInteger(filterSPV,'polygonalApproximationEpsilone',sbSPVpolygonalApproximationEpsilone.Position);
        run(filterSPV);
        chrono.Stop;
        images := getOutputImages(filterSPV,'outImages');
        image1 := images^[0];
        imageOut:=image.eraseOrCreateImageLike(imageOut,image1);
        image.copyImageToImage(image1,imageOut);
        image2 := images^[1];
        imageOut2:=image.eraseOrCreateImageLike(imageOut2,image2);
        image.copyImageToImage(image2,imageOut2);
    end else
    if panelActif=pStandardDeviation then begin
        imageOut := image.eraseOrCreateImageLike(imageOut,imageIn);
        image1 := imageOut;
        chrono.Start;
        setParameterImage( filterStandardDeviation, 'inImage', imageIn );
        setParameterImage( filterStandardDeviation, 'outImage', imageOut );
        setParameterInteger( filterStandardDeviation, 'percentStandardDeviation', sbPercentStandardDeviation.Position );
        setParameterString( filterStandardDeviation, 'outputColor', cbStandardDeviationOutputColor.Text );
        setParameterBoolean( filterStandardDeviation, 'showOnlyROI', chkStandardDeviationShowOnlyROI.Checked );
        if chkUseROI.Checked=true then begin
          setRegionOfInterest( filterStandardDeviation, @roi );
        end else begin
          unsetRegionOfInterest( filterStandardDeviation );
        end;
        run( filterStandardDeviation );
        chrono.Stop;
    end else
    if panelActif=pSubstract then begin
        preprocessMask(); // for imageMask
        imageOut2 := image.eraseOrCreateImageLike( imageOut2, imageIn );
        image2 := imageOut2;
        chrono.Start;
        setParameterImage( filterArithmeticSubstract, 'inImage1', imageIn );
        setParameterImage( filterArithmeticSubstract, 'inImage2', imageOut );
        setParameterImage( filterArithmeticSubstract, 'outImage', imageOut2 );
        setParameterImage( filterArithmeticSubstract, 'mask', imageMask );
        setParameterString( filterArithmeticSubstract, 'mode', cbSubstractMode.Text );
        if chkUseROI.Checked=true then begin
          setRegionOfInterest( filterArithmeticSubstract, @roi );
        end else begin
          unsetRegionOfInterest( filterArithmeticSubstract );
        end;
        run( filterArithmeticSubstract );
        chrono.Stop;
        txtSubstractDeltaTotal.Text := IntToStr( getOutputInteger( filterArithmeticSubstract, 'deltaTotal' ) );
        txtSubstractDeltaTotalNormalized.Text := FloatToStrF( getOutputFloat( filterArithmeticSubstract, 'deltaTotalNormalized' ),ffFixed,5,2 );
    end else
    if panelActif=pSUSAN then begin
        preprocessMask(); // for imageMask
        imageOut := image.eraseOrCreateImageLike( imageOut, imageIn );
        image1 := imageOut;
        imageOut2 := image.eraseOrCreateImageLike( imageOut2, imageIn );
        image2 := imageOut2;
        chrono.Start;
        setParameterImage( filterSusan, 'inImage', imageIn );
        setParameterImage( filterSusan, 'outImage', imageOut );
        setParameterImage( filterSusan, 'mask', imageMask );
        if chkSusanAngleCalculation.Checked=True then begin
          tmpImage := image.eraseOrCreateImageLike( tmpImage, imageIn );
          setParameterImage( filterSusan, 'outImageAngle', tmpImage );
          setParameterImage( filterSusan, 'outImageAngleMonitoring', imageOut2 );
        end else begin
          tmpImage := nil;
          setParameterImage( filterSusan, 'outImageAngle', nil );
          setParameterImage( filterSusan, 'outImageAngleMonitoring', nil );
        end;
        setParameterString( filterSusan, 'mode', cbSUSANmode.Text );
        setParameterString( filterSusan, 'maskType', cbSUSANmasktype.Text );
        setParameterInteger( filterSusan, 'precision', sbSUSANprecision.Position );
        setParameterInteger( filterSusan, 'pixelBrightnessDifferenceThreshold', sbSUSANpixelBrightnessDifferenceThreshold.Position);
        setParameterInteger( filterSusan, 'pixelCentroidDifferenceThreshold', sbSUSANpixelCentroidDifferenceThreshold.Position );
        setParameterInteger( filterSusan, 'gain', sbSusanGain.Position );
        if chkUseROI.Checked=true then begin
          setRegionOfInterest( filterSusan, @roi );
        end else begin
          unsetRegionOfInterest( filterSusan );
        end;
        run( filterSusan );
        chrono.Stop;
        if tmpImage<>nil then begin
          image.freeImage( tmpImage );
        end;
    end else
    if panelActif=pThresholdBinary then begin
        preprocessMask(); // for imageMask
        imageOut := image.eraseOrCreateImageLike( imageOut, imageIn );
        image1 := imageOut;
        chrono.Start;
        setParameterImage( filterThresholdBinary, 'inImage', imageIn );
        setParameterImage( filterThresholdBinary, 'outImage', imageOut );
        setParameterInteger( filterThresholdBinary, 'thresholdLower', sbThresholdBinaryLower.Position );
        setParameterInteger( filterThresholdBinary, 'thresholdUpper', sbThresholdBinaryUpper.Position );
        setParameterInteger( filterThresholdBinary, 'lowcolor', rdgLow.ItemIndex );
        setParameterInteger( filterThresholdBinary, 'middlecolor', rdgMiddle.ItemIndex );
        setParameterInteger( filterThresholdBinary, 'highcolor', rdgHigh.ItemIndex );
        setParameterImage( filterThresholdBinary, 'mask', imageMask );
        if chkUseROI.Checked=true then begin
          setRegionOfInterest( filterThresholdBinary, @roi );
        end else begin
          unsetRegionOfInterest( filterThresholdBinary );
        end;
        run( filterThresholdBinary );
        chrono.Stop;
    end else
    if panelActif=pVectorHistogram then begin
        preprocessSimulateAngle(imageIn,StrToFloat(txtVectorHistogramPreprocessingAngle.Text)); // this function set 'imageSimulateAngle'
        preprocessBlob(imageSimulateAngle); // this function set 'imageBlob'
        // monitoring
        image2 := imageBlob;
        imageOut2:=image.eraseOrCreateImageLike(imageOut2,image2);
        image.copyImageToImage(image2,imageOut2);
        pointers := getOutputArrayPointers(fBlobExplorerForBlob,'blobs');
        tmpI:=Length(pointers^)-1;
        if tmpI>=0 then begin
          sbVectorHistogramBlobNumero.Max:=tmpI;
          sbVectorHistogramBlobNumero.Visible:=True;
          txtVectorHistogramBlobNumero.Text:=IntToStr(sbVectorHistogramBlobNumero.position+1)+'/'+IntToStr(sbVectorHistogramBlobNumero.Max+1);
        end else begin
          sbVectorHistogramBlobNumero.Visible:=False;
          txtVectorHistogramBlobNumero.Text:='';
          Application.MessageBox('Before using this filter, you must use filter BlobExplorer to obtain a blob', 'Information', MB_OK);
        end;
        chrono.Start;
        if sbVectorHistogramBlobNumero.Visible=True then begin
          tmpI:=sbVectorHistogramBlobNumero.Position;
          pointers := getOutputArrayPointers(fBlobExplorerForBlob,'blobs');
          tmpBlob:=pointers^[tmpI];
          tmpPointer:=tmpBlob.vectorChain;
          setParameterPointer(filterVectorHistogram,'vectorArray',tmpPointer);
          tmpI:=360;
          if cbVectorHistogramAngleprecision.ItemIndex=1 then tmpI:=720
          else if cbVectorHistogramAngleprecision.ItemIndex=2 then tmpI:=3600
          else if cbVectorHistogramAngleprecision.ItemIndex=3 then tmpI:=36000;
          setParameterInteger(filterVectorHistogram,'anglePrecision', tmpI);
          setParameterInteger(filterVectorHistogram,'smooth', sbVectorHistogramSmooth.Position);
          run(filterVectorHistogram);
          chrono.Stop;
          image1 := getOutputImage(filterVectorHistogram,'outImage');
          imageOut:=image.eraseOrCreateImageLike(imageOut,image1);
          image.copyImageToImage(image1,imageOut);
        end;
    end else
    if panelActif=pProjectionLine then begin
        tmpBoolean:=false;
        preprocessSimulateAngle(imageIn,StrToFloat(txtProjectionLinePreprocessingSimulateAngle.Text)); // this function set 'imageSimulateAngle'
        if rgProjectionLineInput.ItemIndex=1 then begin
          setParameterString(filterProjectionLine,'inputType','SEGMENTS');
          preprocessBlob(imageSimulateAngle); // this function set 'imageBlob'
          pointers := getOutputArrayPointers(fBlobExplorerForBlob,'blobs');
          tmpI:=Length(pointers^)-1;
          if tmpI>=0 then begin
            sbProjectionLinePreprocessingBlobIndex.Max:=tmpI;
            sbProjectionLinePreprocessingBlobIndex.Visible:=True;
            txtProjectionLinePreprocessingBlobIndex.Text:=IntToStr(sbProjectionLinePreprocessingBlobIndex.position+1)+'/'+IntToStr(sbProjectionLinePreprocessingBlobIndex.Max+1);
          end else begin
            sbProjectionLinePreprocessingBlobIndex.Visible:=False;
            txtProjectionLinePreprocessingBlobIndex.Text:='';
            Application.MessageBox('Before using this filter, you must use filter BlobExplorer to obtain a blob', 'Information', MB_OK);
          end;
          if sbProjectionLinePreprocessingBlobIndex.Visible=True then begin
            tmpBoolean:=true;
            tmpI:=sbProjectionLinePreprocessingBlobIndex.Position;
            pointers := getOutputArrayPointers(fBlobExplorerForBlob,'blobs');
            tmpBlob := pointers^[tmpI];
            tmpPointer:=tmpBlob.segmentList;
            setParameterPointer(filterProjectionLine,'segmentArray',tmpPointer);
            // monitoring
            image2:=imageBlob;
            imageOut2:=image.eraseOrCreateImageLike(imageOut2,image2);
            image.copyImageToImage(image2,imageOut2);
          end;
        end else begin
          setParameterString(filterProjectionLine,'inputType','IMAGE');
          setParameterImage(filterProjectionLine,'inImage',imageSimulateAngle);
          tmpBoolean:=true;
          // monitoring
          image2:=imageSimulateAngle;
          imageOut2:=image.eraseOrCreateImageLike(imageOut2,image2);
          image.copyImageToImage(image2,imageOut2);
        end;
        chrono.Start;
        if tmpBoolean=true then begin
          setParameterInteger(filterProjectionLine,'smooth', sbProjectionLineSmooth.Position);
          run(filterProjectionLine);
          chrono.Stop;
          txtProjectionLineMaximum.Text:=FloatToStrF(getOutputFloat(filterProjectionLine,'maximum'),ffFixed,6,3);
          image1 := getOutputImage(filterProjectionLine,'outImage');
          imageOut:=image.eraseOrCreateImageLike(imageOut,image1);
          image.copyImageToImage(image1,imageOut);
        end;
    end else
    if panelActif=pBlobBalance then begin
        preprocessSimulateAngle(imageIn,StrToFloat(txtBlobBalancePreprocessingAngle.Text)); // this function set 'imageSimulateAngle'
        preprocessBlob(imageSimulateAngle); // this function set 'imageBlob'
        pointers := getOutputArrayPointers(fBlobExplorerForBlob,'blobs');
        tmpI:=Length(pointers^)-1;
        if tmpI>=0 then begin
          sbBlobBalancePreprocessingBlobIndex.Max:=tmpI;
          sbBlobBalancePreprocessingBlobIndex.Visible:=True;
          txtBlobBalancePreprocessingBlobIndex.Text:=IntToStr(sbBlobBalancePreprocessingBlobIndex.position+1)+'/'+IntToStr(sbBlobBalancePreprocessingBlobIndex.Max+1);
        end else begin
          sbBlobBalancePreprocessingBlobIndex.Visible:=False;
          txtBlobBalancePreprocessingBlobIndex.Text:='';
          Application.MessageBox('Before using this filter, you must use filter BlobExplorer to obtain a blob', 'Information', MB_OK);
        end;
        if sbBlobBalancePreprocessingBlobIndex.Visible=True then begin
          tmpI:=sbBlobBalancePreprocessingBlobIndex.Position;
          pointers := getOutputArrayPointers(fBlobExplorerForBlob,'blobs');
          tmpBlob := pointers^[tmpI];
          tmpPointer:=tmpBlob;
          setParameterPointer(filterBlobBalance,'blob',tmpPointer);
          // monitoring
          imageOut:=image.eraseOrCreateImageLike(imageOut,imageBlob);
          image1:=imageOut;
          setParameterImage(filterBlobBalance,'outImageMonitoring',imageOut);
          setParameterImage(filterBlobBalance,'blobImage',imageBlob);
          setParameterBoolean(filterBlobBalance,'monitoring',chkBlobBalanceMonitoring.Checked);
          chrono.Start;
          run(filterBlobBalance);
          txtBlobBalanceAngle.Text:=FloatToStrF(getOutputFloat(filterBlobBalance,'angle'),ffFixed,5,2);
          chrono.Stop;
        end;
    end else
    if panelActif=pBlobGrouping then begin
        pointers := getOutputArrayPointers(filterBlobExplorer,'blobs');
        tmpI:=Length(pointers^)-1;
        if tmpI>=0 then begin
          imageOut := image.eraseOrCreateImageLike( imageOut, imageIn );
          image1 := imageOut;
          setParameterImage( filterBlobGrouping,'inImage', imageIn);
          setParameterImage( filterBlobGrouping,'outImage', imageOut) ;
          setParameterPointer( filterBlobGrouping,'filterBlobExplorer', Pointer(filterBlobExplorer));
          setParameterInteger( filterBlobGrouping, 'intensityPrecision', sbBlobGroupingIntensityPrecision.Position );
          chrono.Start;
          run( filterBlobGrouping );
          chrono.Stop;
        end else begin
          Application.MessageBox('Before using this filter, you must use filter BlobExplorer to obtain some blobs', 'Information', MB_OK);
        end;
    end else
    if panelActif=pWavelets then begin
        imageOut:=image.eraseOrCreateImageLike(imageOut,imageIn);
        image1:=imageOut;
        chrono.Start;
        setParameterImage(filterWavelet,'inImage', imageIn);
        setParameterImage(filterWavelet,'outImage', imageOut) ;
        setParameterBoolean(filterWavelet,'invert', chkWaveletsInverse.Checked);
        run(filterWavelet);
        chrono.Stop;
    end else
    if panelActif=pWaves then begin
        imageOut:=image.eraseOrCreateImageLike(imageOut,imageIn);
        image1:=imageOut;
        chrono.Start;
        if not isWavesSimpleRun then begin
          setParameterImage(filterWaves,'inImage', imageIn);
        end;
        setParameterImage(filterWaves,'outImage', imageOut) ;
        run(filterWaves) ;
        cmdWavesStep.Enabled := true ;
        chrono.Stop;
    end else
    if panelActif=pIntegration then begin
        imageOut:=image.eraseOrCreateImageLike(imageOut,imageIn);
        image1:=imageOut;
        chrono.Start;
        setParameterImage(filterIntegration,'inImage',imageIn);
        setParameterImage(filterIntegration,'outImage',imageOut);
        setParameterFloat(filterIntegration,'scale', sbIntegrationScale.Position/1000);
        setParameterFloat(filterIntegration,'offset', sbIntegrationOffset.Position);
        run(filterIntegration);
        chrono.Stop;
    end else
    if panelActif=pLocalDeviation then begin
        imageOut:=image.eraseOrCreateImageLike(imageOut,imageIn);
        image1:=imageOut;
        chrono.Start;
        setParameterImage(filterLocalDeviation,'inImage',imageIn);
        setParameterImage(filterLocalDeviation,'outImage',imageOut);
        setParameterInteger(filterLocalDeviation,'percentLocalDeviation',sbPercentLocalDeviation.Position);
        setParameterInteger(filterLocalDeviation,'localDeviationSize',sbLocalDeviationSize.Position);
        //setParameterString(filterLocalDeviation,'outputColor',cbLocalDeviationOutputColor.Text);
        if chkUseROI.Checked=true then begin
          setRegionOfInterest(filterLocalDeviation,@roi);
        end else begin
          unsetRegionOfInterest(filterLocalDeviation);
        end;
        run(filterLocalDeviation);
        chrono.Stop;
    end else
    if panelActif=pApplication1 then begin
      imageOut:=image.eraseOrCreateImageLike(imageOut,imageIn);
      image1:=imageOut;
      chrono.Start;
      application1.setInImage(imageIn);
      application1.setDefaultAreaMin(sbApplication1DefectAreaMin.Position);
      application1.setMinNumberOfDefectsForOK(sbApplication1MinNumberOfDefectsForOK.Position);
      application1.setMaxNumberOfDefectsForNG(sbApplication1MaxNumberOfDefectsForNG.Position);
      application1.Run;
      chrono.Stop;
      image.copyImageToImage(application1.getOutImage(),imageOut);
      txtApplication1NumberOfDefects.Text:=IntToStr(application1.getNumberOfDefects());
      decision:=application1.getDecision();
      if decision=1 then shapeApplication1Decision.Brush.Color:=clLime
      else if decision=0 then shapeApplication1Decision.Brush.Color:=clYellow
      else shapeApplication1Decision.Brush.Color:=clRed;
    end else
    if panelActif=pApplication2 then begin
      imageOut:=image.eraseOrCreateImageLike(imageOut,imageIn);
      image1:=imageOut;
      chrono.Start;
      application2.setInImage(imageIn);
      application2.setDefaultAreaMin(sbApplication2DefectAreaMin.Position);
      application2.Run;
      chrono.Stop;
      image.copyImageToImage(application2.getOutImage(),imageOut);
    end else
    if panelActif=pCanny then begin
        imageOut:=image.eraseOrCreateImageLike(imageOut,imageIn);
        image1:=imageOut;
        chrono.Start;
        setParameterImage(filterCanny,'inImage',imageIn);
        setParameterImage(filterCanny,'outImage',imageOut);
        setParameterInteger(filterCanny,'threshold1',sbCannyThreshold1.Position);
        setParameterInteger(filterCanny,'threshold2',sbCannyThreshold2.Position);
        run(filterCanny);
        chrono.Stop;
    end else
    if panelActif=pGradientAnisotropicDiffusion then begin
        imageOut:=image.eraseOrCreateImageLike(imageOut,imageIn);
        image1:=imageOut;
        chrono.Start;
        setParameterImage(filterGradientAnisotropicDiffusion,'inImage',imageIn);
        setParameterImage(filterGradientAnisotropicDiffusion,'outImage',imageOut);
        setParameterFloat(filterGradientAnisotropicDiffusion,'conductance',sbGradientAnisotropicDiffusionConductance.Position/10);
        setParameterInteger(filterGradientAnisotropicDiffusion,'iteration',sbGradientAnisotropicDiffusionIteration.Position);
        if cbGradientAnisotropicDiffusionMethod.ItemIndex=1 then setParameterString(filterGradientAnisotropicDiffusion,'method', 'STANDARD_GREY_LEVEL')
        else if cbGradientAnisotropicDiffusionMethod.ItemIndex=2 then setParameterString(filterGradientAnisotropicDiffusion,'method', 'STANDARD_RGB')
        else setParameterString(filterGradientAnisotropicDiffusion,'method', 'FAST_BLUR_ANISOTROPIC');
        run(filterGradientAnisotropicDiffusion);
        chrono.Stop;
    end else
    if panelActif=pBilateral then begin
        imageOut:=image.eraseOrCreateImageLike(imageOut,imageIn);
        image1:=imageOut;
        chrono.Start;
        setParameterImage(filterSmoothBilateral,'inImage',imageIn);
        setParameterImage(filterSmoothBilateral,'outImage',imageOut);
        setParameterFloat(filterSmoothBilateral,'domainSigma',sbBilateralDomainsigma.Position/10);
        setParameterFloat(filterSmoothBilateral,'rangeSigma',sbBilateralRangesigma.Position/10);
        run(filterSmoothBilateral);
        chrono.Stop;
    end else
    if panelActif=pRescaleIntensity then begin
        imageOut:=image.eraseOrCreateImageLike(imageOut,imageIn);
        image1:=imageOut;
        chrono.Start;
        setParameterImage(filterRescaleIntensity,'inImage',imageIn);
        setParameterImage(filterRescaleIntensity,'outImage',imageOut);
        setParameterInteger(filterRescaleIntensity,'intensityMinimum',sbRescaleIntensityMinimum.Position);
        setParameterInteger(filterRescaleIntensity,'intensityMaximum',sbRescaleIntensityMaximum.Position);
        run(filterRescaleIntensity);
        chrono.Stop;
    end else
    if panelActif=pSigmoid then begin
        imageOut:=image.eraseOrCreateImageLike(imageOut,imageIn);
        image1:=imageOut;
        chrono.Start;
        setParameterImage(filterSigmoid,'inImage',imageIn);
        setParameterImage(filterSigmoid,'outImage',imageOut);
        setParameterInteger(filterSigmoid,'intensityMinimum',sbSigmoidMinimum.Position);
        setParameterInteger(filterSigmoid,'intensityMaximum',sbSigmoidMaximum.Position);
        setParameterFloat(filterSigmoid,'alpha',sbSigmoidAlpha.Position/10);
        setParameterInteger(filterSigmoid,'beta',sbSigmoidBeta.Position);
        run(filterSigmoid);
        chrono.Stop;
    end else
    if panelActif=pCompare then begin
        preprocessMask(); // for imageMask
        imageOut2 := image.eraseOrCreateImageLike( imageOut2, imageIn );
        image2 := imageOut2;
        chrono.Start;
        setParameterImage( filterCompare, 'inImage1', imageIn );
        setParameterImage( filterCompare, 'inImage2', imageOut );
        setParameterImage( filterCompare, 'outImage', imageOut2 );
        setParameterImage( filterCompare, 'mask', imageMask );
        setParameterString( filterCompare, 'mode', cbCompareMode.Text );
        if chkUseROI.Checked=true then begin
          setRegionOfInterest( filterCompare, @roi );
        end else begin
          unsetRegionOfInterest( filterCompare );
        end;
        run( filterCompare );
        chrono.Stop;
    end else
    if panelActif=pContour then begin
        imageOut := image.eraseOrCreateImageLike(imageOut,imageIn);
        image1 := imageOut;
        chrono.Start;
        setParameterImage( filterContour, 'inImage', imageIn );
        setParameterImage( filterContour, 'outImage',imageOut );
        setParameterInteger( filterContour, 'threshold', sbContourThreshold.Position );
        setParameterBoolean( filterContour, 'fill', chkContourFill.Checked );
        setParameterBoolean( filterContour, 'criticalPoints', chkContourCriticalPoints.Checked );
        setParameterInteger( filterContour, 'approximationAccuracy', sbContourApproximationaccuracy.Position );
        run( filterContour );
        chrono.Stop;
    end else
    if panelActif=pLog then begin
        preprocessMask(); // for imageMask
        imageOut := image.eraseOrCreateImageLike( imageOut, imageIn );
        image1 := imageOut;
        chrono.Start;
        setParameterImage( filterLog, 'inImage', imageIn );
        setParameterImage( filterLog, 'outImage', imageOut );
        setParameterImage( filterLog, 'mask', imageMask );
        setParameterInteger( filterLog, 'intensityMax', sbLogIntensityMax.Position );
        setParameterBoolean( filterLog, 'autoAdjust', chkLogAdjustAuto.Checked );
        if chkUseROI.Checked=true then begin
          setRegionOfInterest( filterLog, @roi );
        end else begin
          unsetRegionOfInterest( filterLog );
        end;
        run( filterLog );
        chrono.Stop;
    end else
    if panelActif=pLogPolar then begin
        imageOut := image.eraseOrCreateImageLike( imageOut, imageIn );
        image1 := imageOut;
        chrono.Start;
        setParameterImage( filterLogPolar, 'inImage', imageIn );
        setParameterImage( filterLogPolar, 'outImage', imageOut );
        setParameterInteger( filterLogPolar, 'magnitude', sbLogpolarMagnitude.Position );
        setParameterBoolean( filterLogPolar, 'reinverseTransformation', chkLogpolarReinversetransformation.Checked );
        if chkUseROI.Checked=true then begin
          setRegionOfInterest( filterLogPolar, @roi );
        end else begin
          unsetRegionOfInterest( filterLogPolar );
        end;
        run( filterLogPolar );
        chrono.Stop;
    end else
    if panelActif=pHoughTransform then begin
        preprocessMask(); // for imageMask
        imageOut := image.eraseOrCreateImageLike( imageOut, imageIn );
        image1 := imageOut;
        chrono.Start;
        setParameterImage( filterHoughTransform, 'inImage', imageIn );
        setParameterImage( filterHoughTransform, 'outImage', imageOut );
        setParameterImage( filterHoughTransform, 'mask', imageMask );
        setParameterString( filterHoughTransform, 'preprocessor', cbHoughTransformPreprocessor.Text );
        setParameterInteger( filterHoughTransform, 'threshold', sbHoughTransformThreshold.Position );
        if chkUseROI.Checked=true then begin
          setRegionOfInterest( filterHoughTransform, @roi );
        end else begin
          unsetRegionOfInterest( filterHoughTransform );
        end;
        run( filterHoughTransform );
        chrono.Stop;
    end else
    if panelActif=pAdjust Then Begin
        imageOut := image.eraseOrCreateImageLike(imageOut,imageIn);
        image1 := imageOut;
        chrono.Start;
        setParameterImage( filterAdjust, 'inImage', imageIn );
        setParameterImage( filterAdjust, 'outImage', imageOut );
        setParameterInteger( filterAdjust, 'Contrast', sbConstrast.Position );
        setParameterInteger( filterAdjust, 'Brightness', sbBrightness.Position );
        setParameterBoolean( filterAdjust, 'AutoAdjust', chkAdjustAuto.Checked );
        run( filterAdjust );
        chrono.Stop;
    end else
    if panelActif=pRotation Then Begin
        imageOut2:=image.eraseOrCreateImageLike(imageOut2,imageIn);
        image2:=imageOut2;
        chrono.Start;
        setParameterImage(filterRotation,'inImage',imageIn);
        setParameterImage(filterRotation,'outImageMonitoring',imageOut2);
        setParameterBoolean(filterRotation,'monitoring',chkRotationMonitoring.Checked);
        setParameterFloat(filterRotation,'angle', StrToFloat(txtRotationAngle.Text));
        setParameterFloat(filterRotation,'xCenter', sbRotationCenterX.Position) ;
        setParameterFloat(filterRotation,'yCenter', sbRotationCenterY.Position) ;
        setParameterInteger(filterRotation,'interpolationMode', rdgRotationInterpolation.ItemIndex);
        setParameterString(filterRotation,'missingPixelColorMode',cbRotationMissingpixelcolormode.Text);
        setParameterBoolean(filterRotation,'autoAdjustSize',chkRotationAutoadjustsize.Checked);
        run(filterRotation);
        chrono.Stop;
        image1:=getOutputImage(filterRotation,'outImage');
        imageOut:=image.eraseOrCreateImageLike(imageOut,image1);
        image.copyImageToImage(image1,imageOut);
    end else
    if panelActif=pImageCreator then begin
        chrono.Start;
        setParameterString( filterImageCreator, 'command', txtImageCreatorCommand.Text );
        run( filterImageCreator );
        chrono.Stop;
        image1 := getOutputImage( filterImageCreator, 'outImage' );
        imageOut := image.eraseOrCreateImageLike( imageOut, image1 );
        image.copyImageToImage( image1, imageOut );
    end else
    if panelActif=pImageInfo then begin
        preprocessMask(); // for imageMask
        imageOut := image.eraseOrCreateImageLike( imageOut, imageIn );
        image1 := imageOut;
        chrono.Start;
        setParameterImage( filterImageInfo, 'inImage', imageIn );
        //setParameterImage( filterImageInfo, 'outImage',imageOut );
        setParameterImage( filterImageInfo, 'mask', imageMask );
        if chkUseROI.Checked=true then begin
          setRegionOfInterest( filterImageInfo, @roi );
        end else begin
          unsetRegionOfInterest( filterImageInfo );
        end;
        run( filterImageInfo );
        chrono.Stop;
        txtImageInfoPixelMin.Text := IntToStr( getOutputInteger( filterImageInfo, 'pixelMin' ) );
        txtImageInfoPixelMax.Text := IntToStr( getOutputInteger( filterImageInfo, 'pixelMax' ) );
        txtImageInfoPixelMaxSubMin.Text := IntToStr( getOutputInteger( filterImageInfo, 'pixelMax' ) - getOutputInteger( filterImageInfo, 'pixelMin' ) );
    end else
    if panelActif=pCoOccurrenceMatrix then begin
        preprocessMask(); // for imageMask
        imageOut2 := image.eraseOrCreateImageLike(imageOut2,imageIn);
        image2 := imageOut2;
        chrono.Start;
        setParameterImage( filterCoOccurrenceMatrix, 'inImage', imageIn );
        setParameterImage( filterCoOccurrenceMatrix, 'outImageMonitoring', imageOut2 );
        setParameterImage( filterCoOccurrenceMatrix, 'mask', imageMask );
        setParameterInteger( filterCoOccurrenceMatrix, 'horizontalDistance', sbCooccurenceHorSize.Position );
        setParameterInteger( filterCoOccurrenceMatrix, 'verticalDistance', sbCooccurenceVerSize.Position );
        setParameterInteger( filterCoOccurrenceMatrix, 'xAnalyse', rdCoocurenceX.ItemIndex );
        setParameterInteger( filterCoOccurrenceMatrix, 'yAnalyse', rdCoocurenceY.ItemIndex );
        setParameterFloat( filterCoOccurrenceMatrix, 'scale',  sbCoOccurenceScale.Position );
        setParameterBoolean( filterCoOccurrenceMatrix, 'Shift45', chkCoocurenceShift45.Checked);
        if chkUseROI.Checked=true then begin
          setRegionOfInterest( filterCoOccurrenceMatrix, @roi );
        end else begin
          unsetRegionOfInterest( filterCoOccurrenceMatrix );
        end;
        if (shpViewerToolROI.Visible) then begin
          x1 := round(shpViewerToolROI.Left*255/ViewerImageOut.width);
          if x1<0 then x1 :=0;
          x2 := round((shpViewerToolROI.Left+shpViewerToolROI.width)*255/ViewerImageOut.width);
          if x2>255 then x2 := 255;
          y1 := round(shpViewerToolROI.Top*255/ViewerImageOut.height);
          if y1 < 0 then y1 := 0;
          y2 := round((shpViewerToolROI.Top+shpViewerToolROI.height)*255/ViewerImageOut.height);
          if y2 > 255 then y2 := 255;
          setParameterInteger( filterCoOccurrenceMatrix, 'coMinX', x1);
          setParameterInteger( filterCoOccurrenceMatrix, 'coMaxX', x2);
          setParameterInteger( filterCoOccurrenceMatrix, 'coMinY', y1);
          setParameterInteger( filterCoOccurrenceMatrix, 'coMaxY', y2);
        end else begin
          setParameterInteger( filterCoOccurrenceMatrix, 'coMinX', 0);
          setParameterInteger( filterCoOccurrenceMatrix, 'coMaxX', 255);
          setParameterInteger( filterCoOccurrenceMatrix, 'coMinY', 0);
          setParameterInteger( filterCoOccurrenceMatrix, 'coMaxY', 255);
        end;
        run( filterCoOccurrenceMatrix );
        chrono.Stop;
        image1 := getOutputImage( filterCoOccurrenceMatrix, 'outImage' );
        imageOut := image.eraseOrCreateImageLike( imageOut, image1 );
        image.copyImageToImage( image1, imageOut );
        tmpSingle := getOutputFloat( filterCoOccurrenceMatrix, 'features_angularSecondMoment' );
        txtCoOccurrenceMatrixFeaturesAngularSecondMoment.Text := FloatToStrF(tmpSingle,ffFixed,10,10);
        tmpSingle := getOutputFloat( filterCoOccurrenceMatrix, 'features_energy' );
        txtCoOccurrenceMatrixFeaturesEnergy.Text := FloatToStrF(tmpSingle,ffFixed,10,10);
        tmpSingle := getOutputFloat( filterCoOccurrenceMatrix, 'features_entropy' );
        txtCoOccurrenceMatrixFeaturesEntropy.Text := FloatToStrF(tmpSingle,ffFixed,10,10);
        tmpSingle := getOutputFloat( filterCoOccurrenceMatrix, 'features_contrast' );
        txtCoOccurrenceMatrixFeaturesContrast.Text := FloatToStrF(tmpSingle,ffFixed,10,10);
        tmpSingle := getOutputFloat( filterCoOccurrenceMatrix, 'features_dissimilarity' );
        txtCoOccurrenceMatrixFeaturesDissimilarity.Text := FloatToStrF(tmpSingle,ffFixed,10,10);
        tmpSingle := getOutputFloat( filterCoOccurrenceMatrix, 'features_inverseDifferenceMoment' );
        txtCoOccurrenceMatrixFeaturesInversedifferencemoment.Text := FloatToStrF(tmpSingle,ffFixed,10,10);
        tmpSingle := getOutputFloat( filterCoOccurrenceMatrix, 'features_mean_i' );
        txtCoOccurrenceMatrixFeaturesMeanI.Text := FloatToStrF(tmpSingle,ffFixed,10,10);
        tmpSingle := getOutputFloat( filterCoOccurrenceMatrix, 'features_mean_j' );
        txtCoOccurrenceMatrixFeaturesMeanJ.Text := FloatToStrF(tmpSingle,ffFixed,10,10);
        tmpSingle := getOutputFloat( filterCoOccurrenceMatrix, 'features_variance_i' );
        txtCoOccurrenceMatrixFeaturesVarianceI.Text := FloatToStrF(tmpSingle,ffFixed,10,10);
        tmpSingle := getOutputFloat( filterCoOccurrenceMatrix, 'features_variance_j' );
        txtCoOccurrenceMatrixFeaturesVarianceJ.Text := FloatToStrF(tmpSingle,ffFixed,10,10);
        tmpSingle := getOutputFloat( filterCoOccurrenceMatrix, 'features_correlation' );
        txtCoOccurrenceMatrixFeaturesCorrelation.Text := FloatToStrF(tmpSingle,ffFixed,10,10);
    end else
    if panelActif=pImageLoader then begin
        chrono.Start;
        setParameterString(filterImageLoader,'filesName',txtImageLoaderFiles.Text);
        run(filterImageLoader);
        chrono.Stop;
        lstImageLoaderViewImage.Items.Clear;
        images := getOutputImages(filterImageLoader,'outImages');
        if (images<>nil) and (Length(images^)>0) then begin
          for tmpI:=0 to Length(images^)-1 do begin
            lstImageLoaderViewImage.Items.Add('image '+IntToStr(tmpI)+' ('+IntToStr(images^[tmpI].Width)+'*'+IntToStr(images^[tmpI].Height)+')');
          end;
        end;
    end else
    if panelActif=pImageSaver then begin
        chrono.Start;
        setParameterString(filterImageSaver,'fileName',txtImageSaverFilename.Text);
        if rgImageSaverImage.ItemIndex=0 then setParameterImage(filterImageSaver,'inImage',imageIn)
        else if rgImageSaverImage.ItemIndex=1 then setParameterImage(filterImageSaver,'inImage',image1)
        else setParameterImage(filterImageSaver,'inImage',image2);
        run(filterImageSaver);
        chrono.Stop;
    end else
    if panelActif=pFiltersPlugin_Resonator then begin
        imageOut:=image.eraseOrCreateImageLike(imageOut,imageIn);
        image1:=imageOut;
        chrono.Start;
        setParameterImage(filtersPlugin_Resonator,'inImage',imageIn);
        setParameterImage(filtersPlugin_Resonator,'outImage',imageOut);
        setParameterFloat(filtersPlugin_Resonator, 'omega', scrOmega.Position/1000);
        if chkUseROI.Checked=true then begin
          setRegionOfInterest(filtersPlugin_Resonator,@roi);
        end else begin
          unsetRegionOfInterest(filtersPlugin_Resonator);
        end;
        run(filtersPlugin_Resonator);
        chrono.Stop;
    end ;

    if panelActif=pFiltersPlugin_TestDelphi then begin
        preprocessMask(); // for imageMask
        imageOut := image.eraseOrCreateImageLike( imageOut, imageIn );
        image1 := imageOut;
        chrono.Start;
        setParameterInteger( filtersPlugin_TestDelphi, 'testIntegerParameter', StrToInt64(txtPluginSampleParameterInteger.Text) );
        setParameterFloat( filtersPlugin_TestDelphi, 'testFloatParameter', StrToFloat(txtPluginSampleParameterFloat.Text) );
        setParameterBoolean( filtersPlugin_TestDelphi, 'testBooleanParameter', chkPluginSampleParameterBoolean.Checked );
        setParameterString( filtersPlugin_TestDelphi, 'testStringParameter', txtPluginSampleParameterString.Text );
        setParameterImage( filtersPlugin_TestDelphi, 'testImageParameter', imageIn );
        SetLength( tmpImages, 2 );
        tmpImages[0] := imageIn;
        tmpImages[1] := imageIn;
        setParameterImages( filtersPlugin_TestDelphi, 'testImagesParameter', @tmpImages );
        if chkUseROI.Checked=true then begin
          setRegionOfInterest( filtersPlugin_TestDelphi, @roi );
        end else begin
          unsetRegionOfInterest( filtersPlugin_TestDelphi );
        end;
        run( filtersPlugin_TestDelphi );
        chrono.Stop;
        // get output [testIntegerOutput]
        txtPluginSampleOutputInteger.Text := IntToStr( getOutputInteger( filtersPlugin_TestDelphi, 'testIntegerOutput' ) );
        // get output [testFloatOutput]
        txtPluginSampleOutputFloat.Text := FloatToStrF( getOutputFloat( filtersPlugin_TestDelphi, 'testFloatOutput' ), ffFixed,4,3 );
        // get output image [testImageOutput]
        image1 := getOutputImage( filtersPlugin_TestDelphi, 'testImageOutput' );
        imageOut := image.eraseOrCreateImageLike( imageOut, image1 );
        image.copyImageToImage( image1, imageOut );
        // get output images [testImagesOutput]
        images := getOutputImages( filtersPlugin_TestDelphi, 'testImagesOutput' );
        image2 := images^[cbPluginSampleOutputImages.ItemIndex];
        imageOut2:=image.eraseOrCreateImageLike( imageOut2, image2 );
        image.copyImageToImage( image2, imageOut2 );
        // get output pointers [testArrayPointersOutput]
        pointers := getOutputArrayPointers( filtersPlugin_TestDelphi, 'testArrayPointersOutput' );
        // we know that it is pointers on C string
        txtPluginOutputArrayPointers.Lines.Clear();
        for tmpI:=0 to Length(pointers^)-1 do begin
          tmpStr := StrPas( pointers^[tmpI] );
          txtPluginOutputArrayPointers.Lines.Add( tmpStr );
        end;
        txtPluginOutputArrayPointers.SelStart := 0;
        SendMessage(txtPluginOutputArrayPointers.handle, EM_SCROLLCARET,0,0);
    end else
    if panelActif=pFiltersPlugin_TestC then begin
        preprocessMask(); // for imageMask
        imageOut := image.eraseOrCreateImageLike( imageOut, imageIn );
        image1 := imageOut;
        chrono.Start;
        setParameterInteger( filtersPlugin_TestC, 'testIntegerParameter', StrToInt64(txtPluginTestC_ParameterInteger.Text) );
        setParameterFloat( filtersPlugin_TestC, 'testFloatParameter', StrToFloat(txtPluginTestC_ParameterFloat.Text) );
        setParameterBoolean( filtersPlugin_TestC, 'testBooleanParameter', chkPluginTestC_ParameterBoolean.Checked );
        setParameterString( filtersPlugin_TestC, 'testStringParameter', txtPluginTestC_ParameterString.Text );
        setParameterImage( filtersPlugin_TestC, 'testImageParameter', imageIn );
        SetLength( tmpImages, 2 );
        tmpImages[0] := imageIn;
        tmpImages[1] := imageIn;
        setParameterImages( filtersPlugin_TestC, 'testImagesParameter', @tmpImages );
        if chkUseROI.Checked=true then begin
          setRegionOfInterest( filtersPlugin_TestC, @roi );
        end else begin
          unsetRegionOfInterest( filtersPlugin_TestC );
        end;
        run( filtersPlugin_TestC );
        chrono.Stop;
        // get output [testIntegerOutput]
        txtPluginTestC_OutputInteger.Text := IntToStr( getOutputInteger( filtersPlugin_TestC, 'testIntegerOutput' ) );
        // get output [testFloatOutput]
        txtPluginTestC_OutputFloat.Text := FloatToStrF( getOutputFloat( filtersPlugin_TestC, 'testFloatOutput' ), ffFixed,4,3 );
        // get output image [testImageOutput]
        image1 := getOutputImage( filtersPlugin_TestC, 'testImageOutput' );
        imageOut := image.eraseOrCreateImageLike( imageOut, image1 );
        image.copyImageToImage( image1, imageOut );
        // get output images [testImagesOutput]
        images := getOutputImages( filtersPlugin_TestC, 'testImagesOutput' );
        image2 := images^[cbPluginTestC_OutputImages.ItemIndex];
        imageOut2:=image.eraseOrCreateImageLike( imageOut2, image2 );
        image.copyImageToImage( image2, imageOut2 );
        // get output pointers [testArrayPointersOutput]
        pointers := getOutputArrayPointers( filtersPlugin_TestC, 'testArrayPointersOutput' );
        // we know that it is pointers on C string
        txtPluginTestC_OutputArrayPointers.Lines.Clear();
        for tmpI:=0 to Length(pointers^)-1 do begin
          tmpStr := StrPas( pointers^[tmpI] );
          txtPluginTestC_OutputArrayPointers.Lines.Add( tmpStr );
        end;
        txtPluginTestC_OutputArrayPointers.SelStart := 0;
        SendMessage(txtPluginTestC_OutputArrayPointers.handle, EM_SCROLLCARET,0,0);
    end else
    if panelActif=pFiltersPlugin_Video then begin
        preprocessMask(); // for imageMask
        chrono.Start;
        if chkUseROI.Checked=true then begin
          setRegionOfInterest( filtersPlugin_Video, @roi );
        end else begin
          unsetRegionOfInterest( filtersPlugin_Video );
        end;
        setParameterBoolean( filtersPlugin_Video, 'showViewer', chkPluginVideoShowViewer.Checked );
        setParameterString( filtersPlugin_Video, 'fileName', txtPluginVideoFileName.Text );
        if _runCommand<>'' then begin
          StrPCopy( tmpStrC, _runCommand );
          runCommand( filtersPlugin_Video, tmpStrC );
          _runCommand := '';
        end else begin
          run( filtersPlugin_Video );
        end;
        chrono.Stop;
        image1 := getOutputImage( filtersPlugin_Video, 'outImage' );
        if image1<>nil then begin
          imageOut := image.eraseOrCreateImageLike( imageOut, image1 );
          image.copyImageToImage( image1, imageOut );
        end;
    end else
    if panelActif=pFiltersPlugin_WebCam then begin
        preprocessMask(); // for imageMask
        chrono.Start;
        if chkUseROI.Checked=true then begin
          setRegionOfInterest( filtersPlugin_WebCam, @roi );
        end else begin
          unsetRegionOfInterest( filtersPlugin_WebCam );
        end;
        setParameterBoolean( filtersPlugin_WebCam, 'showViewer', chkPluginWebCamShowViewer.Checked );
        if txtPluginWebCamDeviceIndex.Text<>'' then begin
          setParameterInteger( filtersPlugin_WebCam, 'deviceIndex', StrToInt(txtPluginWebCamDeviceIndex.Text) );
        end;
        if txtPluginWebCamFormatIndex.Text<>'' then begin
          setParameterInteger( filtersPlugin_WebCam, 'formatIndex', StrToInt(txtPluginWebCamFormatIndex.Text) );
        end;
        if _runCommand<>'' then begin
          StrPCopy( tmpStrC, _runCommand );
          runCommand( filtersPlugin_WebCam, tmpStrC );
          _runCommand := '';
        end else begin
          run( filtersPlugin_WebCam );
        end;
        chrono.Stop;
        // get devices list
        pointers := getOutputArrayPointers( filtersPlugin_WebCam, 'devices' );
        // we know that it is pointers on C string
        lbPluginWebCamDevices.Clear();
        for tmpI:=0 to Length(pointers^)-1 do begin
          tmpStr := StrPas( pointers^[tmpI] );
          lbPluginWebCamDevices.Items.Add( tmpStr );
        end;
        // get format list
        pointers := getOutputArrayPointers( filtersPlugin_WebCam, 'deviceFormats' );
        // we know that it is pointers on C string
        lbPluginWebCamDeviceFormats.Clear();
        for tmpI:=0 to Length(pointers^)-1 do begin
          tmpStr := StrPas( pointers^[tmpI] );
          lbPluginWebCamDeviceFormats.Items.Add( tmpStr );
        end;
        // get captured image
        image1 := getOutputImage( filtersPlugin_WebCam, 'outImage' );
        if image1<>nil then begin
          imageOut := image.eraseOrCreateImageLike( imageOut, image1 );
          image.copyImageToImage( image1, imageOut );
        end;
    end else
    if panelActif=pFiltersPlugin_Viewer then begin
        preprocessMask(); // for imageMask
        chrono.Start;
        if chkUseROI.Checked=true then begin
          setRegionOfInterest( filtersPlugin_Viewer, @roi );
        end else begin
          unsetRegionOfInterest( filtersPlugin_Viewer );
        end;
        setParameterBoolean( filtersPlugin_Viewer, 'showViewer', chkPluginViewerShowViewer.Checked );
        setParameterImage( filtersPlugin_Viewer, 'inImage', imageOut );
        run( filtersPlugin_Viewer );
        chrono.Stop;
    end;
    if panelActif=pFiltersPlugin_SnapShot then begin
        chrono.Start;
        if txtPluginSnapShotWindowTitle.Text<>'' then begin
          setParameterString( filtersPlugin_SnapShot, 'window_title', txtPluginSnapShotWindowTitle.Text );
        end;
        if txtPluginSnapShotWindowHandle.Text<>'' then begin
          setParameterInteger( filtersPlugin_SnapShot, 'window_handle', StrToInt(txtPluginSnapShotWindowHandle.Text) );
        end else begin
          setParameterInteger( filtersPlugin_SnapShot, 'window_handle', 0 );
        end;
        if _runCommand<>'' then begin
          StrPCopy( tmpStrC, _runCommand );
          runCommand( filtersPlugin_SnapShot, tmpStrC );
          _runCommand := '';
        end else begin
          run( filtersPlugin_SnapShot );
        end;
        chrono.Stop;
        // get devices list
        pointers := getOutputArrayPointers( filtersPlugin_SnapShot, 'windows_title' );
        if pointers<>nil then begin
          // we know that it is pointers on C string
          lbPluginSnapShotWindowsTitle.Clear();
          for tmpI:=0 to Length(pointers^)-1 do begin
            tmpStr := StrPas( pointers^[tmpI] );
            lbPluginSnapShotWindowsTitle.Items.Add( tmpStr );
          end;
        end;
        // get outImage
        image1 := getOutputImage( filtersPlugin_SnapShot, 'outImage' );
        if image1<>nil then begin
          imageOut := image.eraseOrCreateImageLike( imageOut, image1 );
          image.copyImageToImage( image1, imageOut );
        end;
    end;
    timePerRun := timePerRun + chrono.getTime();
  end;

  timePerRun := timePerRun div count;
  txtProcessTime.Text := IntToStr(timePerRun);
  chrono.Free();

  imageIOVideo.showImage( imageOut, ViewerImageOut );
  imageIOVideo.showImage( imageOut2, ViewerImageOut2 );
  processViewerTool();
  testing := false;
 end;
end;

(...)

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.