Tutorial - Tiled Pixelmap
A pixelmap is a way of representing categorical data. It uses a lossless
image where, instead of the pixels representing colors, they represent
category indices. This is usually compactly represented as a integer split
across the red, green, and blue channels, where the category index is
(red value) + (green value * 256) + (blue value * 65536).
For large datasets, a single image might be too large to display at once.
Much like tile layers used for maps and large images, a pixelmap can also
be rendered from a tiled image using the
pixelmapLayer is essentially a hybrid between a tile image layer and a
First, let's create our map in the appropriate image coordinates for our pixelmap tile image.
We can use some of the parameters generated by
geo.util.pixelCoordinateParams for the pixelmap tile layer. We need to
modify the url to find the image tiles, create an appropriate data array
with the categorical data, and determine how to map colors to the
Our categorical image data was generated from a small portion of a histology image using a superpixel algorithm. After dividing the source image into superpixels, the edge of each superpixel was located and set as a separate index value. These happen to always have an index value one greater than the superpixel itself (so the main superpixels are indices 0, 2, 4, ..., and the corresponding edges are indices 1, 3, 5, ...). This data set happens to have 5112 distinct index values. We start with a data array of all zeroes.
It is more useful to allow the user to modify the data. Change our coloring so that superpixels start transparent with yellow edges and cycle through red, green, and blue as they are selected.
When changing a value in the data array, we need to inform the pixelmap that it is changed. This could be done a variety of ways:
pixelmap.data(data)- this marks the entire data set as changed and will require recomputing the most values.
pixelmap.modified()- this states that the style has changed in some way, but without more specificifity, all of the colors are rechecked.
pixelmap.indexModified(lowIndex, highIndex)- this states that only a small number of indicies' colors have changed, allowing the most efficient update.
We might want to make it easier for a user to set many superpixels to the same state at once. If the user holds down shift, then the color that the first superpixel that is clicked on is applied to any superpixel entered until the mouse button is released. By using shift, the core pan feature isn't affected.
Mafunzo - Tiled Pixelmap A pixelmap ni njia ya kuwakilisha data categorical. Inatumia picha lossless ambapo, badala ya pixels kuwakilisha rangi, wao kuwakilisha makundi faharisi. Kwa kawaida, hii inawakilishwa kwa urahisi kama nambari kamili iliyogawanywa katika njia nyekundu, kijani, na bluu, ambapo faharisi ya jamii ni (thamani nyekundu) + (thamani ya kijani) + (thamani ya bluu) * 65536 Kwa seti kubwa za data, picha moja inaweza kuwa kubwa sana kuonyesha mara moja. Kwa mfano, kama ilivyo kwa picha za picha za picha za picha za picha za picha za picha za picha za picha za picha za picha za picha za picha za picha za picha za picha za picha za picha za picha za picha za picha za picha za picha za picha za picha za picha za picha za picha za picha za picha za picha za picha za picha za picha. Tunaweza kutumia baadhi ya vigezo zinazozalishwa na geo.util.pixelCoordinateParams kwa safu ya tile ya pixelmap. "Kutumia ""URL"" kwa ajili ya kuunda data ya rangi, kuunda safu ya data ya rangi na kuamua jinsi ya kuiga rangi kwenye picha ya rangi, na kuunda safu ya data ya rangi ya rangi na kuunda safu ya data ya rangi ya rangi na kuunda safu ya safu ya safu ya safu ya safu ya safu ya safu ya safu ya safu ya safu ya safu." Baada ya kugawanya picha chanzo katika superpixels, makali ya kila superpixel ilikuwa iko na kuweka kama thamani tofauti index. "Hizi daima kuwa na thamani index moja kubwa kuliko superpixel yenyewe (kwa hiyo superpixels kuu ni indices 0, 2, 4,..., na kingo zinazolingana ni indices 1, 3, 5,...).""" Kwa mfano, data hii ina thamani ya index 512. Sisi kuanza na data safu ya sifuri zote. Ni muhimu zaidi kuruhusu mtumiaji kurekebisha data. Badilisha rangi yetu ili superpixels kuanza uwazi na kingo manjano na mzunguko kupitia nyekundu, kijani, na bluu kama wao ni kuchaguliwa. Wakati wa kubadilisha thamani katika safu ya data, tunahitaji kuwajulisha pixelmap kwamba ni iliyopita. Hii inaweza kufanyika kwa njia mbalimbali: pixelmap.data (data) - hii alama seti nzima ya data kama iliyopita na itahitaji recomputing maadili zaidi. pixelmap.modified() - hii inasema kwamba mtindo imebadilika kwa njia fulani, lakini bila zaidi specififity, rangi zote ni rechecked. pixelmap.indexModified(lowIndex, highIndex) - hii inasema kwamba tu idadi ndogo ya rangi indices 'imebadilika, kuruhusu updates ufanisi zaidi. Tunaweza kutaka kufanya hivyo rahisi kwa mtumiaji kuweka superpixels wengi kwa hali hiyo kwa mara moja. Ikiwa mtumiaji anashikilia chini ya shift, rangi ya superpixel ya kwanza ambayo imebadilishwa inatumika kwa superpixel yoyote iliyoingizwa hadi kifungo cha panya kinaachiliwa. Kwa kutumia mabadiliko, kipengele cha pan msingi haathiriwi.