25using namespace Qt::StringLiterals;
33QString QgsFuzzifyRasterAlgorithmBase::group()
const
35 return QObject::tr(
"Raster analysis" );
38QString QgsFuzzifyRasterAlgorithmBase::groupId()
const
40 return u
"rasteranalysis"_s;
43void QgsFuzzifyRasterAlgorithmBase::initAlgorithm(
const QVariantMap & )
59 auto createOptsParam = std::make_unique<QgsProcessingParameterString>( u
"CREATE_OPTIONS"_s, QObject::tr(
"Creation options" ), QVariant(),
false,
true );
60 createOptsParam->setMetadata( QVariantMap( { { u
"widget_wrapper"_s, QVariantMap( { { u
"widget_type"_s, u
"rasteroptions"_s } } ) } } ) );
62 addParameter( createOptsParam.release() );
64 auto creationOptsParam = std::make_unique<QgsProcessingParameterString>( u
"CREATION_OPTIONS"_s, QObject::tr(
"Creation options" ), QVariant(),
false,
true );
65 creationOptsParam->setMetadata( QVariantMap( { { u
"widget_wrapper"_s, QVariantMap( { { u
"widget_type"_s, u
"rasteroptions"_s } } ) } } ) );
67 addParameter( creationOptsParam.release() );
74 mInputRaster = parameterAsRasterLayer( parameters, u
"INPUT"_s, context );
79 mBand = parameterAsInt( parameters, u
"BAND"_s, context );
80 if ( mBand < 1 || mBand > mInputRaster->bandCount() )
81 throw QgsProcessingException( QObject::tr(
"Invalid band number for BAND (%1): Valid values for input raster are 1 to %2" ).arg( mBand ).arg( mInputRaster->bandCount() ) );
83 mInterface.reset( mInputRaster->dataProvider()->clone() );
84 mExtent = mInputRaster->extent();
85 mLayerWidth = mInputRaster->width();
86 mLayerHeight = mInputRaster->height();
87 mCrs = mInputRaster->crs();
88 mNbCellsXProvider = mInterface->xSize();
89 mNbCellsYProvider = mInterface->ySize();
92 prepareAlgorithmFuzzificationParameters( parameters, context, feedback );
99 QString creationOptions = parameterAsString( parameters, u
"CREATION_OPTIONS"_s, context ).trimmed();
101 const QString optionsString = parameterAsString( parameters, u
"CREATE_OPTIONS"_s, context );
102 if ( !optionsString.isEmpty() )
103 creationOptions = optionsString;
105 const QString outputFile = parameterAsOutputLayer( parameters, u
"OUTPUT"_s, context );
106 const QString outputFormat = parameterAsOutputRasterFormat( parameters, u
"OUTPUT"_s, context );
108 auto writer = std::make_unique<QgsRasterFileWriter>( outputFile );
109 writer->setOutputProviderKey( u
"gdal"_s );
110 if ( !creationOptions.isEmpty() )
112 writer->setCreationOptions( creationOptions.split(
'|' ) );
114 writer->setOutputFormat( outputFormat );
115 std::unique_ptr<QgsRasterDataProvider> provider( writer->createOneBandRaster( mDataType, mNbCellsXProvider, mNbCellsYProvider, mExtent, mCrs ) );
118 if ( !provider->isValid() )
121 provider->setNoDataValue( 1, mNoDataValue );
122 provider->setEditable(
true );
123 const qgssize layerSize =
static_cast<qgssize>( mLayerWidth ) *
static_cast<qgssize>( mLayerHeight );
125 const bool hasReportsDuringClose = provider->hasReportsDuringClose();
126 mMaxProgressDuringBlockWriting = hasReportsDuringClose ? 50.0 : 100.0;
128 fuzzify( provider.get(), feedback );
130 provider->setEditable(
false );
132 if ( feedback && hasReportsDuringClose )
135 if ( !provider->closeWithProgress( scaledFeedback.get() ) )
144 outputs.insert( u
"EXTENT"_s, mExtent.toString() );
145 outputs.insert( u
"CRS_AUTHID"_s, mCrs.authid() );
146 outputs.insert( u
"WIDTH_IN_PIXELS"_s, mLayerWidth );
147 outputs.insert( u
"HEIGHT_IN_PIXELS"_s, mLayerHeight );
148 outputs.insert( u
"TOTAL_PIXEL_COUNT"_s, layerSize );
149 outputs.insert( u
"OUTPUT"_s, outputFile );
158QString QgsFuzzifyRasterLinearMembershipAlgorithm::name()
const
160 return u
"fuzzifyrasterlinearmembership"_s;
163QString QgsFuzzifyRasterLinearMembershipAlgorithm::displayName()
const
165 return QObject::tr(
"Fuzzify raster (linear membership)" );
168QStringList QgsFuzzifyRasterLinearMembershipAlgorithm::tags()
const
170 return QObject::tr(
"fuzzy logic,fuzzify,fuzzy,logic,linear,membership" ).split(
',' );
173QString QgsFuzzifyRasterLinearMembershipAlgorithm::shortDescription()
const
176 "Transforms an input raster to a fuzzified raster where values range from 0 to 1 following a "
177 "linear fuzzy membership function."
181QString QgsFuzzifyRasterLinearMembershipAlgorithm::shortHelpString()
const
184 "This algorithm transforms an input raster "
185 "to a fuzzified raster and thereby assigns values between 0 and 1 following a "
186 "linear fuzzy membership function. The value of 0 implies no membership with the "
187 "defined fuzzy set, a value of 1 depicts full membership. In between, the degree "
188 "of membership of raster values follows a linear membership function.\n\n"
189 "The linear function is constructed using two user-defined input raster values "
190 "which set the point of full membership (high bound, results to 1) and no membership "
191 "(low bound, results to 0) respectively. The fuzzy set in between those values is defined as a "
192 "linear function.\n\n"
193 "Both increasing and decreasing fuzzy sets can be modeled by "
194 "swapping the high and low bound parameters."
198QgsFuzzifyRasterLinearMembershipAlgorithm *QgsFuzzifyRasterLinearMembershipAlgorithm::createInstance()
const
200 return new QgsFuzzifyRasterLinearMembershipAlgorithm();
203void QgsFuzzifyRasterLinearMembershipAlgorithm::addAlgorithmParams()
212 mFuzzifyHighBound = parameterAsDouble( parameters, u
"FUZZYHIGHBOUND"_s, context );
213 mFuzzifyLowBound = parameterAsDouble( parameters, u
"FUZZYLOWBOUND"_s, context );
219 QGS_MARK_ALGORITHM_SOURCE
222 iter.startRasterRead( mBand, mLayerWidth, mLayerHeight, mExtent );
227 bool isNoData =
false;
228 std::unique_ptr<QgsRasterBlock> rasterBlock;
229 while ( iter.readNextRasterPart( mBand, iterCols, iterRows, rasterBlock, iterLeft, iterTop ) )
232 feedback->
setProgress( 100 * iter.progress( mBand ) );
233 auto fuzzifiedBlock = std::make_unique<QgsRasterBlock>( destinationProvider->
dataType( 1 ), iterCols, iterRows );
235 for (
int row = 0; row < iterRows; row++ )
239 for (
int column = 0; column < iterCols; column++ )
244 const double value = rasterBlock->valueAndNoData( row, column, isNoData );
245 double fuzzifiedValue;
249 fuzzifiedValue = mNoDataValue;
251 else if ( mFuzzifyLowBound < mFuzzifyHighBound )
253 if ( value <= mFuzzifyLowBound )
255 else if ( value >= mFuzzifyHighBound )
258 fuzzifiedValue = ( ( value - mFuzzifyLowBound ) / ( mFuzzifyHighBound - mFuzzifyLowBound ) );
260 else if ( mFuzzifyLowBound > mFuzzifyHighBound )
262 if ( value >= mFuzzifyLowBound )
264 else if ( value <= mFuzzifyHighBound )
267 fuzzifiedValue = ( ( value - mFuzzifyLowBound ) / ( mFuzzifyHighBound - mFuzzifyLowBound ) );
271 throw QgsProcessingException( QObject::tr(
"Please choose varying values for the high and low membership parameters" ) );
274 fuzzifiedBlock->setValue( row, column, fuzzifiedValue );
277 if ( !destinationProvider->
writeBlock( fuzzifiedBlock.get(), mBand, iterLeft, iterTop ) )
289QString QgsFuzzifyRasterPowerMembershipAlgorithm::name()
const
291 return u
"fuzzifyrasterpowermembership"_s;
294QString QgsFuzzifyRasterPowerMembershipAlgorithm::displayName()
const
296 return QObject::tr(
"Fuzzify raster (power membership)" );
299QStringList QgsFuzzifyRasterPowerMembershipAlgorithm::tags()
const
301 return QObject::tr(
"fuzzy logic,fuzzify,fuzzy,logic,power,non-linear,membership,exponent" ).split(
',' );
304QString QgsFuzzifyRasterPowerMembershipAlgorithm::shortDescription()
const
307 "Transforms an input raster to a fuzzified raster where values range from 0 to 1 following a "
312QString QgsFuzzifyRasterPowerMembershipAlgorithm::shortHelpString()
const
315 "This algorithm transforms an input raster "
316 "to a fuzzified raster and thereby assigns values between 0 and 1 following a "
317 "power function. The value of 0 implies no membership with the "
318 "defined fuzzy set, a value of 1 depicts full membership. In between, the degree "
319 "of membership of raster values follows a power function.\n\n"
320 "The power function is constructed using three user-defined input raster values "
321 "which set the point of full membership (high bound, results to 1), no membership "
322 "(low bound, results to 0) and function exponent (only positive) respectively. "
323 "The fuzzy set in between those the upper and lower bounds values is then defined as "
324 "a power function.\n\n"
325 "Both increasing and decreasing fuzzy sets can be modeled by "
326 "swapping the high and low bound parameters."
330QgsFuzzifyRasterPowerMembershipAlgorithm *QgsFuzzifyRasterPowerMembershipAlgorithm::createInstance()
const
332 return new QgsFuzzifyRasterPowerMembershipAlgorithm();
335void QgsFuzzifyRasterPowerMembershipAlgorithm::addAlgorithmParams()
345 mFuzzifyHighBound = parameterAsDouble( parameters, u
"FUZZYHIGHBOUND"_s, context );
346 mFuzzifyLowBound = parameterAsDouble( parameters, u
"FUZZYLOWBOUND"_s, context );
347 mFuzzifyExponent = parameterAsDouble( parameters, u
"FUZZYEXPONENT"_s, context );
353 QGS_MARK_ALGORITHM_SOURCE
356 iter.startRasterRead( mBand, mLayerWidth, mLayerHeight, mExtent );
361 bool isNoData =
false;
362 std::unique_ptr<QgsRasterBlock> rasterBlock;
363 while ( iter.readNextRasterPart( mBand, iterCols, iterRows, rasterBlock, iterLeft, iterTop ) )
366 feedback->
setProgress( 100 * iter.progress( mBand ) );
367 auto fuzzifiedBlock = std::make_unique<QgsRasterBlock>( destinationProvider->
dataType( 1 ), iterCols, iterRows );
369 for (
int row = 0; row < iterRows; row++ )
373 for (
int column = 0; column < iterCols; column++ )
378 const double value = rasterBlock->valueAndNoData( row, column, isNoData );
379 double fuzzifiedValue;
383 fuzzifiedValue = mNoDataValue;
385 else if ( mFuzzifyLowBound < mFuzzifyHighBound )
387 if ( value <= mFuzzifyLowBound )
389 else if ( value >= mFuzzifyHighBound )
392 fuzzifiedValue = std::pow( ( value - mFuzzifyLowBound ) / ( mFuzzifyHighBound - mFuzzifyLowBound ), mFuzzifyExponent );
394 else if ( mFuzzifyLowBound > mFuzzifyHighBound )
396 if ( value >= mFuzzifyLowBound )
398 else if ( value <= mFuzzifyHighBound )
401 fuzzifiedValue = std::pow( ( value - mFuzzifyLowBound ) / ( mFuzzifyHighBound - mFuzzifyLowBound ), mFuzzifyExponent );
405 throw QgsProcessingException( QObject::tr(
"Please choose varying values for the high and low membership parameters" ) );
408 fuzzifiedBlock->setValue( row, column, fuzzifiedValue );
411 if ( !destinationProvider->
writeBlock( fuzzifiedBlock.get(), mBand, iterLeft, iterTop ) )
422QString QgsFuzzifyRasterLargeMembershipAlgorithm::name()
const
424 return u
"fuzzifyrasterlargemembership"_s;
427QString QgsFuzzifyRasterLargeMembershipAlgorithm::displayName()
const
429 return QObject::tr(
"Fuzzify raster (large membership)" );
432QStringList QgsFuzzifyRasterLargeMembershipAlgorithm::tags()
const
434 return QObject::tr(
"fuzzy logic,fuzzify,fuzzy,logic,large,membership" ).split(
',' );
437QString QgsFuzzifyRasterLargeMembershipAlgorithm::shortDescription()
const
440 "Transforms an input raster to a fuzzified raster where values range from 0 to 1 following the "
441 "'large' fuzzy membership function."
445QString QgsFuzzifyRasterLargeMembershipAlgorithm::shortHelpString()
const
448 "This algorithm transforms an input raster "
449 "to a fuzzified raster and thereby assigns values between 0 and 1 following the "
450 "'large' fuzzy membership function. The value of 0 implies no membership with the "
451 "defined fuzzy set, a value of 1 depicts full membership. In between, the degree "
452 "of membership of raster values follows the 'large' membership function.\n\n"
453 "The 'large' function is constructed using two user-defined input raster values "
454 "which set the point of half membership (midpoint, results to 0.5) and a predefined "
455 "function spread which controls the function uptake.\n\n"
456 "This function is typically used when larger input raster values should become members "
457 "of the fuzzy set more easily than smaller values."
461QgsFuzzifyRasterLargeMembershipAlgorithm *QgsFuzzifyRasterLargeMembershipAlgorithm::createInstance()
const
463 return new QgsFuzzifyRasterLargeMembershipAlgorithm();
466void QgsFuzzifyRasterLargeMembershipAlgorithm::addAlgorithmParams()
475 mFuzzifyMidpoint = parameterAsDouble( parameters, u
"FUZZYMIDPOINT"_s, context );
476 mFuzzifySpread = parameterAsDouble( parameters, u
"FUZZYSPREAD"_s, context );
482 QGS_MARK_ALGORITHM_SOURCE
485 iter.startRasterRead( mBand, mLayerWidth, mLayerHeight, mExtent );
490 bool isNoData =
false;
491 std::unique_ptr<QgsRasterBlock> rasterBlock;
492 while ( iter.readNextRasterPart( mBand, iterCols, iterRows, rasterBlock, iterLeft, iterTop ) )
495 feedback->
setProgress( 100 * iter.progress( mBand ) );
496 auto fuzzifiedBlock = std::make_unique<QgsRasterBlock>( destinationProvider->
dataType( 1 ), iterCols, iterRows );
498 for (
int row = 0; row < iterRows; row++ )
502 for (
int column = 0; column < iterCols; column++ )
507 const double value = rasterBlock->valueAndNoData( row, column, isNoData );
508 double fuzzifiedValue;
512 fuzzifiedValue = mNoDataValue;
516 fuzzifiedValue = 1 / ( 1 + std::pow( value / mFuzzifyMidpoint, -mFuzzifySpread ) );
519 fuzzifiedBlock->setValue( row, column, fuzzifiedValue );
522 if ( !destinationProvider->
writeBlock( fuzzifiedBlock.get(), mBand, iterLeft, iterTop ) )
534QString QgsFuzzifyRasterSmallMembershipAlgorithm::name()
const
536 return u
"fuzzifyrastersmallmembership"_s;
539QString QgsFuzzifyRasterSmallMembershipAlgorithm::displayName()
const
541 return QObject::tr(
"Fuzzify raster (small membership)" );
544QStringList QgsFuzzifyRasterSmallMembershipAlgorithm::tags()
const
546 return QObject::tr(
"fuzzy logic,fuzzify,fuzzy,logic,small,membership" ).split(
',' );
549QString QgsFuzzifyRasterSmallMembershipAlgorithm::shortDescription()
const
552 "Transforms an input raster to a fuzzified raster where values range from 0 to 1 following the "
553 "'small' fuzzy membership function."
557QString QgsFuzzifyRasterSmallMembershipAlgorithm::shortHelpString()
const
560 "The Fuzzify raster (small membership) algorithm transforms an input raster "
561 "to a fuzzified raster and thereby assigns values between 0 and 1 following the "
562 "'small' fuzzy membership function. The value of 0 implies no membership with the "
563 "defined fuzzy set, a value of 1 depicts full membership. In between, the degree "
564 "of membership of raster values follows the 'small' membership function.\n\n"
565 "The 'small' function is constructed using two user-defined input raster values "
566 "which set the point of half membership (midpoint, results to 0.5) and a predefined "
567 "function spread which controls the function uptake.\n\n"
568 "This function is typically used when smaller input raster values should become members "
569 "of the fuzzy set more easily than higher values."
573QgsFuzzifyRasterSmallMembershipAlgorithm *QgsFuzzifyRasterSmallMembershipAlgorithm::createInstance()
const
575 return new QgsFuzzifyRasterSmallMembershipAlgorithm();
578void QgsFuzzifyRasterSmallMembershipAlgorithm::addAlgorithmParams()
587 mFuzzifyMidpoint = parameterAsDouble( parameters, u
"FUZZYMIDPOINT"_s, context );
588 mFuzzifySpread = parameterAsDouble( parameters, u
"FUZZYSPREAD"_s, context );
594 QGS_MARK_ALGORITHM_SOURCE
597 iter.startRasterRead( mBand, mLayerWidth, mLayerHeight, mExtent );
602 bool isNoData =
false;
603 std::unique_ptr<QgsRasterBlock> rasterBlock;
604 while ( iter.readNextRasterPart( mBand, iterCols, iterRows, rasterBlock, iterLeft, iterTop ) )
607 feedback->
setProgress( 100 * iter.progress( mBand ) );
608 auto fuzzifiedBlock = std::make_unique<QgsRasterBlock>( destinationProvider->
dataType( 1 ), iterCols, iterRows );
610 for (
int row = 0; row < iterRows; row++ )
614 for (
int column = 0; column < iterCols; column++ )
619 const double value = rasterBlock->valueAndNoData( row, column, isNoData );
620 double fuzzifiedValue;
624 fuzzifiedValue = mNoDataValue;
628 fuzzifiedValue = 1 / ( 1 + std::pow( value / mFuzzifyMidpoint, mFuzzifySpread ) );
631 fuzzifiedBlock->setValue( row, column, fuzzifiedValue );
634 if ( !destinationProvider->
writeBlock( fuzzifiedBlock.get(), mBand, iterLeft, iterTop ) )
646QString QgsFuzzifyRasterGaussianMembershipAlgorithm::name()
const
648 return u
"fuzzifyrastergaussianmembership"_s;
651QString QgsFuzzifyRasterGaussianMembershipAlgorithm::displayName()
const
653 return QObject::tr(
"Fuzzify raster (gaussian membership)" );
656QStringList QgsFuzzifyRasterGaussianMembershipAlgorithm::tags()
const
658 return QObject::tr(
"fuzzy logic,fuzzify,fuzzy,logic,gaussian,membership" ).split(
',' );
661QString QgsFuzzifyRasterGaussianMembershipAlgorithm::shortDescription()
const
664 "Transforms an input raster to a fuzzified raster where values range from 0 to 1 following a "
665 "gaussian fuzzy membership function."
669QString QgsFuzzifyRasterGaussianMembershipAlgorithm::shortHelpString()
const
672 "This algorithm transforms an input raster "
673 "to a fuzzified raster and thereby assigns values between 0 and 1 following a "
674 "gaussian fuzzy membership function. The value of 0 implies no membership with the "
675 "defined fuzzy set, a value of 1 depicts full membership. In between, the degree "
676 "of membership of raster values follows a gaussian membership function.\n\n"
677 "The gaussian function is constructed using two user-defined input values "
678 "which set the midpoint of the gaussian function (midpoint, results to 1) and a "
679 "predefined function spread which controls the function spread.\n\n"
680 "This function is typically used when a certain range of raster values around a "
681 "predefined function midpoint should become members of the fuzzy set."
685QgsFuzzifyRasterGaussianMembershipAlgorithm *QgsFuzzifyRasterGaussianMembershipAlgorithm::createInstance()
const
687 return new QgsFuzzifyRasterGaussianMembershipAlgorithm();
690void QgsFuzzifyRasterGaussianMembershipAlgorithm::addAlgorithmParams()
699 mFuzzifyMidpoint = parameterAsDouble( parameters, u
"FUZZYMIDPOINT"_s, context );
700 mFuzzifySpread = parameterAsDouble( parameters, u
"FUZZYSPREAD"_s, context );
706 QGS_MARK_ALGORITHM_SOURCE
709 iter.startRasterRead( mBand, mLayerWidth, mLayerHeight, mExtent );
714 bool isNoData =
false;
715 std::unique_ptr<QgsRasterBlock> rasterBlock;
716 while ( iter.readNextRasterPart( mBand, iterCols, iterRows, rasterBlock, iterLeft, iterTop ) )
719 feedback->
setProgress( 100 * iter.progress( mBand ) );
720 auto fuzzifiedBlock = std::make_unique<QgsRasterBlock>( destinationProvider->
dataType( 1 ), iterCols, iterRows );
722 for (
int row = 0; row < iterRows; row++ )
726 for (
int column = 0; column < iterCols; column++ )
731 const double value = rasterBlock->valueAndNoData( row, column, isNoData );
732 double fuzzifiedValue;
736 fuzzifiedValue = mNoDataValue;
740 fuzzifiedValue = std::exp( -mFuzzifySpread * std::pow( value - mFuzzifyMidpoint, 2 ) );
743 fuzzifiedBlock->setValue( row, column, fuzzifiedValue );
746 if ( !destinationProvider->
writeBlock( fuzzifiedBlock.get(), mBand, iterLeft, iterTop ) )
758QString QgsFuzzifyRasterNearMembershipAlgorithm::name()
const
760 return u
"fuzzifyrasternearmembership"_s;
763QString QgsFuzzifyRasterNearMembershipAlgorithm::displayName()
const
765 return QObject::tr(
"Fuzzify raster (near membership)" );
768QStringList QgsFuzzifyRasterNearMembershipAlgorithm::tags()
const
770 return QObject::tr(
"fuzzy logic,fuzzify,fuzzy,logic,near,membership" ).split(
',' );
773QString QgsFuzzifyRasterNearMembershipAlgorithm::shortDescription()
const
776 "Transforms an input raster to a fuzzified raster where values range from 0 to 1 following the "
777 "'near' fuzzy membership function."
781QString QgsFuzzifyRasterNearMembershipAlgorithm::shortHelpString()
const
784 "The Fuzzify raster (near membership) algorithm transforms an input raster "
785 "to a fuzzified raster and thereby assigns values between 0 and 1 following the "
786 "'near' fuzzy membership function. The value of 0 implies no membership with the "
787 "defined fuzzy set, a value of 1 depicts full membership. In between, the degree "
788 "of membership of raster values follows the 'near' membership function.\n\n"
789 "The 'near' function is constructed using two user-defined input values "
790 "which set the midpoint of the 'near' function (midpoint, results to 1) and a "
791 "predefined function spread which controls the function spread.\n\n"
792 "This function is typically used when a certain range of raster values near a "
793 "predefined function midpoint should become members of the fuzzy set. The function"
794 " generally shows a higher rate of decay than the gaussian membership function."
798QgsFuzzifyRasterNearMembershipAlgorithm *QgsFuzzifyRasterNearMembershipAlgorithm::createInstance()
const
800 return new QgsFuzzifyRasterNearMembershipAlgorithm();
803void QgsFuzzifyRasterNearMembershipAlgorithm::addAlgorithmParams()
812 mFuzzifyMidpoint = parameterAsDouble( parameters, u
"FUZZYMIDPOINT"_s, context );
813 mFuzzifySpread = parameterAsDouble( parameters, u
"FUZZYSPREAD"_s, context );
819 QGS_MARK_ALGORITHM_SOURCE
822 iter.startRasterRead( mBand, mLayerWidth, mLayerHeight, mExtent );
827 bool isNoData =
false;
828 std::unique_ptr<QgsRasterBlock> rasterBlock;
829 while ( iter.readNextRasterPart( mBand, iterCols, iterRows, rasterBlock, iterLeft, iterTop ) )
832 feedback->
setProgress( 100 * iter.progress( mBand ) );
833 auto fuzzifiedBlock = std::make_unique<QgsRasterBlock>( destinationProvider->
dataType( 1 ), iterCols, iterRows );
835 for (
int row = 0; row < iterRows; row++ )
839 for (
int column = 0; column < iterCols; column++ )
844 const double value = rasterBlock->valueAndNoData( row, column, isNoData );
845 double fuzzifiedValue;
849 fuzzifiedValue = mNoDataValue;
853 fuzzifiedValue = 1 / ( 1 + mFuzzifySpread * std::pow( value - mFuzzifyMidpoint, 2 ) );
856 fuzzifiedBlock->setValue( row, column, fuzzifiedValue );
859 if ( !destinationProvider->
writeBlock( fuzzifiedBlock.get(), mBand, iterLeft, iterTop ) )
@ Hidden
Parameter is hidden and should not be shown to users.
@ Advanced
Parameter is an advanced parameter which should be hidden from users by default.
@ Double
Double/float values.
virtual QgsError error() const
Gets current status error.
QString summary() const
Short error description, usually the first error in chain, the real error.
bool isCanceled() const
Tells whether the operation has been canceled already.
void setProgress(double progress)
Sets the current progress for the feedback object.
static std::unique_ptr< QgsFeedback > createScaledFeedback(QgsFeedback *parentFeedback, double startPercentage, double endPercentage)
Returns a feedback object whose [0, 100] progression range will be mapped to parentFeedback [startPer...
Contains information about the context in which a processing algorithm is executed.
Custom exception class for processing related exceptions.
Base class for providing feedback from a processing algorithm.
A numeric output for processing algorithms.
A string output for processing algorithms.
A raster band parameter for Processing algorithms.
A numeric parameter for processing algorithms.
A raster layer destination parameter, for specifying the destination path for a raster layer created ...
A raster layer parameter for processing algorithms.
Base class for raster data providers.
bool writeBlock(QgsRasterBlock *block, int band, int xOffset=0, int yOffset=0)
Writes pixel data from a raster block into the provider data source.
Qgis::DataType dataType(int bandNo) const override=0
Returns data type for the band specified by number.
Iterator for sequentially processing raster cells.
unsigned long long qgssize
Qgssize is used instead of size_t, because size_t is stdlib type, unknown by SIP, and it would be har...