The Spatial Possibilistic Clustering Algorithm (SPoCA) produces a segmentation of EUV solar images into regions named here "classes" corresponding to Active Regions (AR), Coronal Holes (CH), and the Quiet Sun (QS). SPoCA uses a multi-channel unsupervised spatially-constrained fuzzy clustering procedure, where the classes are determined by minimization of intra-class variance.
The description of the segmentation process in terms of fuzzy logic was motivated by the facts that information provided by a solar EUV image is uncertain (Poisson and readout noise, cosmic ray hits) and subject to both observational biases (line of sight integration of a transparent volume) and interpretation (the apparent boundary between regions is a matter of convention).
This technique attributes to every pixel a probability of belonging to a particular class (AR, QS, CH). By assigning each pixel to the class for which it has the largest probability of belonging, we get image segmentations. In order to cope successfully with intensity outlier pixels such as those affected by cosmic rays and proton storms, a spatial regularization term was integrated in the clustering algorithm. Since the solar corona is optically thin, and since the intensity in EUV images is obtained through an integration along the line of sight, there is a limb brightening effect in those images which may hinder the segmentation process. Therefore, we first process the EUV images so as to lower the enhanced brightness near the limb. The initial SPoCA class contours are automatically postprocessed using a conditional morphological opening with a circular isotropic element of size equal to one.
SPoCA has been applied successfully to a series of EIT image pairs (171 & 195 A) spanning more than a full solar cycle, as well as to data from AIA, EUVI, and SWAP. See Verbeeck, Delouille, Mampaey & De Visscher (2014).
Please cite the first paper if you are using the SPoCA algorithms, software or results
1. **The SPoCA-suite: Software for extraction, characterization, and tracking of active regions and coronal holes on EUV images**,C. Verbeeck, V. Delouille, B. Mampaey, R. De Visscher (2014) ''Astronomy & Astrophysics'', 561, A29, doi: 10.1051/0004-6361/201321243
1. **Fast and robust segmentation of solar EUV images: algorithm and results for solar cycle 23** Barra V., Delouille V., Kretzschmar M., Hochedez J.-F., ''Astronomy & Astrophysics'', 505(1), 361--371, 2009
1. **Segmentation, Tracking and Characterization of Solar Features from EIT Solar Corona Images** V. Barra, V. Delouille, and J.-F. Hochedez, ''Lecture Notes in Computer Science'', Volume 5575/2009, 199--208, 2009
1. **Segmentation of extreme ultraviolet solar images via multichannel fuzzy clustering** Barra V., Delouille V., Hochedez J.-F. ''Advances in Space Research'', 42, 917--925, 2008.
1. **Segmentation of EIT Images Using Fuzzy Clustering: a Preliminary Study** Barra, V., Delouille, V., Hochedez, J.-F., & Chainais, P. ''ESA Special Publication'', 600, 77.1, 2005.
# Research Projects and Operational Usage
## Heliophysics Knowledge Base (HEK)
The SPoCA software ( version 1.0 ) is running continously at LMSAL since January 2012 to detect Active Regions and Coronal Holes, and store their position and characteristics in the [HEK](https://www.lmsal.com/hek/).
Active Regions are detected using an HPCM2 classifier on SDO/AIA 171Å & 193Å preprocessed images, using the median of the last 10 computed class centers, followed by morphological operations on the pixels of the AR class to group them into regions, regions with an area of less than 1500 arcsec² are discarded, tracking is then used to connect the regions in time.
Coronal Holes are detected using an HFCM classifier on SDO/AIA 193Å preprocessed images, using the median of the last 10 computed class centers, followed by morphological operations on the pixels of the CH class to group them into regions, regions with an area of less than 3000 arcsec² are discarded, tracking is then used to connect the regions in time and regions with a lifespan of less than 3 days are discarded.
For information on how to search and retrieve SPoCA entries in the HEK, see [SPoCA Data Access](#spoca-data-access) below
The SPoCA software ( version 2.0 ) has been used since August 2013 in the [AFFects](http://www.affects-fp7.eu/home/) project to produce statistics on Active Regions (AR), Coronal Holes (CH) and Quiet Sun (QS) for the Solar Timelines viewer for AFFects (STAFF viewer).
The software has been used on SOHO/EIT, SDO/AIA and quicklook SDO/AIA images, it uses specific parameters to create AR segmentation maps and CH segmentation maps, the statistics are then computed on each segmentation map separately, and then on the pixels belonging to neither map for the QS statistics.
For information on how to retrieve the SPoCA produced statistics from the STAFF viewer, see [SPoCA Data Access](#spoca-data-access) below
## SIDC Event Database
The SPoCA software ( version 3.0 ) is running continously since January 2019 to detect Coronal Holes in near real time, and store their position and characteristics in the SIDC event database which is used in [SWE-ESA project](https://swe.ssa.esa.int/).
Coronal Holes are computed using a HFCM classifier on Quicklook SDO/AIA 193Å preprocessed images, using the median of the last 10 computed class centers, followed by morphological operations on the pixels of the CH class to group them into regions, tracking is then used to connect the regions in time.
The SPoCA software ( version 3.0 ) has been used since September 2021 in the [ESCAPE project](https://projectescape.eu/) to produce entries for the [ROB EPN-TAP service](https://vo-tap.oma.be) related to the position and characteristics of Coronal Holes (CH).
Coronal Holes are computed using a FCM classifier on SDO/AIA 193Å preprocessed images, using fix median class centers computed on a 11 year span, followed by morphological operations on the pixels of the CH class to group them into regions, regions with an area of less than 3000 arcsec² are discarded, tracking is then used to connect the regions in time and regions with a lifespan of less than 3 days are discarded.
For information on how to search and retrieve SPoCA entries in the EPN-TAP service, see [SPoCA Data Access](#spoca-data-access) below
# SPoCA Data Access
## Heliophysics Knowledge Base (HEK)
The HEK uses the VOevent standard to store the position and characteristics of AR and CH detected by SPoCA. These are accessible:
- via the [iSolSearch web interface](https://www.lmsal.com/hek/hek_isolsearch.html)
- via Python by using the [SunPy library](https://sunpy.org/), see the [tutorial on how to search events](https://docs.sunpy.org/en/stable/guide/acquiring_data/hek.html), and the [tutorial on how to plot CH onto an image of the sun](https://docs.sunpy.org/en/stable/generated/gallery/plotting/overplot_hek_polygon.html)
- via the IDL® Software by using the [SolarSoft library](https://www.lmsal.com/solarsoft/), see the [tutorial on how to search events using SolarSoft](./ssw_idl_hek.html)
## STAFF viewer
To access SPoCA generated statistics about Active regions, Coronal Hole and Quiet Sun in the [STAFF viewer](http://www.staff.oma.be), in the "Advanced" menu, select "Plot Options...", then in the popup that appears, under Filtering, select "Image" such that there is a green checkmark behind instead of a red cross. SPoCA statistics should then be available under the "Dataset Selection" dropdown.
The rest of the interface is relatively intuitive, but for more information on how to plot the timelines or retrieve the data, select the "Adavanced" menu, then the "Help" menu.
## ROB EPN-TAP
The [ROB EPN-TAP service](https://vo-tap.oma.be), follows the EPNCore metadata dictionary to store the position and characteristics of CH detected by SPoCA. These are accessible:
- via the [web interface](https://vo-tap.oma.be/rob_spoca_ch/q/spoca_ch_dr/form)
- via the TAP protocol https://vo-tap.oma.be/tap
- via Python by using the [PyVO library](https://pyvo.readthedocs.io/en/latest/), see these [quick examples](./pyvo_epn_tap.html)
Information about the metadata can be found [on this page](https://vo-tap.oma.be/rob_spoca_ch/q/spoca_ch_dr/info)
# Software Usage
The SPoCA software suite is not distributed as an executable, but the source code is available publicly. We do recommend **strongly** to try first using the results already generated by SPoCA as descibed above in [SPoCA Data Access](#spoca-data-access). Compiling the software requires a good knowledge of Linux, C++ compilator and libraries.
More over, SPoCA has dozens of parameters, and it is not simple to find the correct values and understand how they influence each other.
If you still decide to use the software directly, please note that it is beyond our resources to provide support for trivial problems, such as Linux usage, compilation, or library installation; i.e. please do not ask us questions before you have successfully compiled the software.
The source is avalable publicly on [Github](https://github.com/bmampaey/SPoCA). The software is comprised of multiple programs to do the classification, the extraction of Active regions and Coronal Holes, the computation of statistics and the visualisation.
Below are some presentations given about the SPoCA software:
- [SPoCA results for SWAP: Towards AFFECTS Timelines](./uploads/SPoCA_SWAP_towards_AFFECTS_timelines.ppt), February 2011