Histogram tool. Plots the intensity distribution of a dataset, optionally restricted to one ROI of the active ROI layer with the ROI Filter.
The tool can be driven from a script without being shown:
var h = VQ.histogramTool();
h.setDataset(VQ.index(0)); // or h.setDataset(0) for leaf 0
h.setNumBins(64);
h.setRange(0, 1000);
h.setROIByName("Heart"); // or h.setROI(1); h.setROI(-1) turns the ROI filter off
h.setChannel(4); // RGB data only: 0 backing, 1 red, 2 green, 3 blue, 4 all three
var r = h.getHistogram(); // { dataset, roi, min, max, binStep, binStarts:[], counts:[] }
h.saveCSVFile("C:/tmp/heart_hist.csv");
See also VQ.histogramTool() to obtain this object, and the Histogram Tool example.
|
|
void | showDataset () |
| | Recomputes the plot with the current settings.
|
| void | saveCSVFile (string fileName) |
| | Saves the histogram as CSV: one line per bin, "binStart,count".
|
| void | savePDFFile (string fileName) |
| | Saves the histogram plot as a PDF.
|
|
void | refreshROIs () |
| | Rebuilds the ROI selector from the global ROI object, keeping the current selection by name where possible. Hides the selector when there are no ROIs.
|
|
void | reload () |
| | Rebuilds the ROI selector and recomputes the plot. Called on show; launchers should call it when the dialog is already visible, since show() then sends no showEvent.
|
|
|
int | currentIndex () |
| | Top-level row selected in the dataset combo box.
|
|
Index | currentDataIndex () |
| | Data being plotted: a dynamic frame set by setDataset(), otherwise the top-level row's active image.
|
| QList< double > | getValues (Index idx, int numValues, float min, float max, float &binStep) |
| | Computes raw bin counts for the given dataset index and range.
|
| QList< double > | getValues (int idx, int numValues, float min, float max, float &binStep) |
|
float | getMin () |
| | Left edge of the histogram range (inclusive lower bound of the first bin).
|
|
float | getMax () |
| | Right edge of the histogram range (inclusive upper bound; voxels at exactly max land in the last bin).
|
| bool | setDataset (Index idx) |
| | Selects the dataset to plot.
|
| bool | setDataset (int i) |
| | Selects the dataset to plot.
|
|
Index | getDataset () |
| | Returns the index of the data being plotted (see VQ.index()), invalid if none.
|
|
void | setNumBins (int n) |
| | Sets the number of bins.
|
|
int | getNumBins () |
| | Returns the number of bins.
|
| void | setRange (double min, double max) |
| | Sets the histogram range and replots.
|
|
void | resetRange () |
| | Sets the histogram range to the min/max of the current dataset and replots.
|
| bool | setROILayer (int layerID) |
| | Uses a specific ROI layer instead of the active one.
|
|
int | getROILayer () |
| | Returns the ROI layer in use, or -1 when following the active layer.
|
| bool | setROI (int roiID) |
| | Restricts the histogram to one ROI of the ROI layer and turns the ROI filter on.
|
| bool | setROIByName (string name) |
| | Restricts the histogram to the ROI with the given name.
|
|
void | setROIFilterEnabled (bool on) |
| | Turns the ROI filter on or off, keeping the selected ROI. Turning it on with nothing selected picks the first ROI. If no ROI exists yet, the first one is picked once it appears.
|
|
bool | isROIFilterEnabled () |
| | Returns whether the ROI filter is on.
|
|
int | getROI () |
| | Returns the selected ROI label value, or -1 when the ROI filter is off.
|
|
bool | hasROIs () |
| | Returns whether ROIs are available for the histogram.
|
| bool | setChannel (int channel) |
| | Selects which values of RGB data are used.
|
|
int | getChannel () |
| | Returns the channel used for the current dataset: the selected one for RGB data, otherwise 0 (backing).
|
| VariantMap | getHistogram () |
| | Computes the histogram with the current settings.
|
|
void | setupROIs (TRasterUChar *) |
| | Kept for backwards compatibility; the argument is ignored, equivalent to refreshROIs().
|