Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add i.cca algorithm (segfaults from GRASS)
- Loading branch information
Médéric Ribreux
authored and
Médéric RIBREUX
committed
May 29, 2016
1 parent
02bbcbb
commit 1d15342
Showing
4 changed files
with
91 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
i.cca | ||
Canonical components analysis (CCA) program for image processing. | ||
Imagery (i.*) | ||
ParameterMultipleInput|input|Input rasters (2 to 8)|3|False | ||
ParameterFile|signature|File containing spectral signatures|False|False | ||
OutputDirectory|output|Output Directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
""" | ||
*************************************************************************** | ||
i_cca.py | ||
-------- | ||
Date : March 2016 | ||
Copyright : (C) 2016 by Médéric Ribreux | ||
Email : medspx at medspx dot fr | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
*************************************************************************** | ||
""" | ||
|
||
__author__ = 'Médéric Ribreux' | ||
__date__ = 'March 2016' | ||
__copyright__ = '(C) 2016, Médéric Ribreux' | ||
|
||
# This will get replaced with a git SHA1 when you do a git archive | ||
|
||
__revision__ = '$Format:%H$' | ||
|
||
from i import multipleOutputDir, verifyRasterNum, regroupRasters | ||
from processing.core.parameters import getParameterFromString | ||
|
||
|
||
def checkParameterValuesBeforeExecuting(alg): | ||
return verifyRasterNum(alg, 'input', 2, 8) | ||
|
||
|
||
def processCommand(alg): | ||
# Remove output | ||
output = alg.getOutputFromName('output') | ||
alg.removeOutputFromName('output') | ||
|
||
# Create output parameter | ||
param = getParameterFromString("ParameterString|output|output basename|None|False|False") | ||
param.value = alg.getTempFilename() | ||
alg.addParameter(param) | ||
|
||
# Regroup rasters | ||
regroupRasters(alg, 'input', 'group', 'subgroup', {'signature': 'sig'}) | ||
|
||
# re-add output | ||
alg.addOutput(output) | ||
|
||
|
||
def processOutputs(alg): | ||
param = alg.getParameterFromName('output') | ||
multipleOutputDir(alg, 'output', param.value) | ||
|
||
# Delete output parameter | ||
alg.parameters.remove(param) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters