
The CytoSpec software allows to cut hyperspectral data in two different ways:
 Cut spectra, i.e. cutting in the spectral domain, and
 Crop images in the spatial domains.
This section describes the crop function which cuts hyperspectral data in the spatial dimensions.

Cropping in the spatial (x,y) dimensions reduces the number of pixel spectra. Select the 'crop images' radiobutton and enter the respective
values for the x and yspatial regions (in pixels) which should be retained. Then press 'crop' to proceed.

Note that the 'cut/crop' function overwrites all existing data blocks (see also
Internal Data Organization, Table IV).
The parameter used for 'cut' are stored within the program workspace and are accessible through the
File Info pull down menu (File Info → File Manipulations → type of data block).


CytoSpec's 'interpolation' routines offer two different methods for data interpolation:
 interpolation in the spectral domain, and
 interpolation in the spatial domains.
This section describes the interpolate images function which interpolates hyperspectral images (HSI) in the spatial dimensions.

Interpolation in the spatial [x,y] dimensions changes the number of pixel spectra. The number of pixel spectra can be increased, or decreased (binning).
For example, if the actual number of pixel spectra is 64 x 64 (cf. edit field '# of pixel in x/y') and the settings for 'new xdim/ydim' are
32 x 32, the program performs a twodimensional interpolation in the spatial domains which will reduce the map size by a factor of 2 x 2. Note that k�nHSI
dimensions can be changed to any sizes, e.g. spatial interpolation from an initial HSI size of 64 x 64 to a size of 30 x 32 will be possible. Note also that
enlarged images may require a lot of memory ressources (RAM)
Select the 'interpolate in the spatial dimensions' radiobutton and enter the desired image size in xdirection. Then press 'enter'  the value in the
field 'new ydim' will be automatically updated. To change the aspect ratio between the x and ydimensions uncheck the checkbox 'fix aspect ratio'.
Then press 'interpolate' to proceed.

The 'interpolate / pixel binning' function overwrites all existing data blocks (see also
Internal Data Organization, Table III).
The parameter used for interpolate are stored within the program workspace and are accessible through
File Info menu (File Info → File Manipulations → type of data block). These parameters are also provided in
the report window of CytoSpec.


CytoSpec's function 'replace NaNs' (NaN  not a number): This function has been introduced with CytoSpec version 2.00.05. The function is useful to replace
pixel spectra containing NaN data by means of average data obtained from neighboring [x,y] pixel spectra.
What are NaN spectra?
NaN spectra, also called 'bad pixel spectra', are produced by the quality test routine:
If the quality test of a given spectrum is negative, the respective spectrum in the data block of preprocessed data is replaced by NaN (Not a Number) values.
In which cases the function 'replace NaN's will be useful?
Some imaging functions, such as edge preserving denoising, or
3D Fourierself deconvolution do not accept NaN values as inputs. In such cases the 'replace NaN' function
will be useful for spatial preprocessing hyperspectral data sets.
Algorithm
 The [x,y] coordinates of NaN pixel spectra are identified. CytoSpec returns a warning message in cases where more than 15% of the pixel spectra are represented by
NaN spectra.
 CytoSpec determines whether the NaN spectra are located (i) at the the corners of the image, (ii) at the margins of the image, or (iii) in the center of an image.
 The coordinates of the pixel neighbors are obtained and the number of nonNaN neighbors is determined.
 Mean spectra are obtained from nonNaN neighbors if the number of nonNaN neighbor spectra is larger than zero (corner case i), one (edge case, ii), or two (center
case, iii).
 Mean spectra are used to replace the NaN spectra.
 The algorithm is repeated until all NaN spectra are replaced by nonNaN mean spectra.
Constraints
1. This function should only be used to preprocess data prior to edge preserving denoising, 3D Fourierself deconvolution, or spatial filtering.
2. The function 'replace NaN' should ideally only be employed in cases were single NaN spectra prevent application of the above mentioned functions.
3. Try to avoid replacing NaN spectra from large image regions.
4. Do not interprete spectra from regions with interpolated data.

The function 'filter images' can be used to apply frequency filters in the [x,y] image domain. Frequency filters such as low or high pass (smoothing/sharpening)
filters are appplied in the image domain to smooth, or sharpen chemical images. The target data block of filtering in the image domain will be the data block of
(de)convolution spectra if the function is applied to original, or preprocessed spectra. If derivative data are filtered, the target data block will be the block
of derivative spectra (see also Internal Data Organization, Table IX
).

Select the source data block by clicking the appropriate radio button, then select the spatial filter function and the size of the kernel. To finally apply
the spatial filter function click on the 'filter' button.
Available filters:
Gaussian
Mean
Disk
SavitzkyGolay smoothing
Laplacian
Kernel size: indicates the size of the kernel filter function in pixels

The parameter used for 'filtering images' are stored within the program workspace and are accessible through the
File Info pull down menu (File Info > File Manipulations > type of data block). These
parameters are also shown in the command line window.

CytoSpec's function 'Edge preserving denoising': This is a new function of CytoSpec version 2.00.05. Description to be continued

Basics of 3DFSD and references to the literature:
The method of 3D deconvolution can be considered a technique of blind deconvolution,
where the transfer function is unknown and a number of assumptions are made for recovering the target scene.
3D deconvolution allows Fourier selfdeconvolution in the two spatial dimensions (x and y) and the spectral/frequency dimensions (z) to be performed at the same time. The
method can be applied to enhance the spectral and/or spatial resolution and to increase the image contrast. Adapted from the 1D algorithm described in:
J.K. Kauppinen, D.J.
Moffat, H.H. Mantsch, D.G. Cameron, Fourier SelfDeconvolution: a method for resolving intrinsically overlapped bands. Appl Spectrosc. 35(3) 1981. 271276.
J.K. Kauppinen, D.J. Moffat, H.H. Mantsch, D.G. Cameron, Selfdeconvolution and first
order derivatives using Fourier transforms. Anal Chem. 53(9) 1981. 14541457.
J.K. Kauppinen, D.J. Moffat, H.H. Mantsch, D.G. Cameron, Noise in Fourier selfdeconvolution.
Appl. Opt. 20(3) 1981. 1866.
Procedure of 3DFSD:
 Spectra from the spectral hypercube are first baseline corrected.
 A 3D exponential curve, normalized to the point spacing, is generated.
 A 3D Bessel smoothing function is generated.
 The 3D data file are Fourier transformed.
 The result is multiplied in Fourier space by the product of the 3D exponential and smoothing functions.
 Finally, the result is inverse Fourier transformed to get the deconvoluted data file.
Constraints:
The kfactor must lie between 0 and 0.95: the larger k, the more smoothing is applied to the data. CytoSpec allows to set different settings for k in the spatial
(kfactor x or y) or spectral dimensions (kfactor z).
Gamma (the halfwidth at half maximium, gamma > 0) determines the power of deconvolution: The higher gamma, the higher the power of deconvolution.
Example: The example below shows the results of 3DFSD (data acquired by the use of a 64 x 64 midinfrared MCT focal plane array detector). For chemical imaging, the
absorbance values at 1731 wavenumbers of the original spectral (upper image) and of the deconvolution data block (lower panel) were color encoded and plotted as a
function of [x,y] position. The panel to the left displays the original (blue) spectra and FSD spectra (red).
Important :
3D Fourier selfdeconvolution can be performed only from the original data (data block #1). This function is only suited for envelopes much broader than the spatial/spectral
resolution. Avoid oscillatory patterns due to overdeconvolution!
Reference to the literature:
