11 #ifndef MESH_PROCESS_HEAT_MAP_HPP
12 #define MESH_PROCESS_HEAT_MAP_HPP
16 #include <QTreeWidgetItem>
23 #include "ui_HeatMap.h"
24 #include "ui_LoadHeatMap.h"
25 #include "ui_HeatMapNew.h"
26 #include "ui_HeatMapManipulate.h"
37 typedef std::set<vertex>
Set;
56 setName(
"Mesh/Heat Map/Heat Map Classic");
57 setDesc(
"Generate heat map for the current mesh");
58 setIcon(QIcon(
":/images/MakeHeatMap.png"));
60 addParm(
"Type",
"Area: signal/geometry on curved surfaces\n"
61 "Volume: for 3D only,\n"
62 "Walls: quantify signal or geometry at cell borders.",
"Area");
63 addParm(
"Visualize",
"Geometry: cell areas or volume,\n"
64 "Border signal: signal associated with cell borders, within a given distance (Border Size)\n"
65 "Interior signal: total signal of a cell - border signal.",
"Geometry");
66 addParm(
"FileName",
"Path to output file.",
"");
67 addParm(
"ReportFields",
"Options to report the following fields in spreadsheet: Geometry, Signal, Border-Interior",
"Geometry");
68 addParm(
"Man. Range",
"Manually define the range of the color map.",
"No");
69 addParm(
"Range Min",
"Color map lower bound.",
"0");
70 addParm(
"Range Max",
"Color map upper bound.",
"65535");
71 addParm(
"Signal Avg",
"Option to normalize the signal by cell area or volume",
"Yes");
72 addParm(
"Global Coord",
"Apply the rotation/translation of the stack to the cell center coordinates.",
"No");
73 addParm(
"Polarity Type",
"Experimental option, attempt to determine cell signal polarity based on strength of signal on different walls.\n"
74 "Cell Average: compare each wall signal to signal average,\n"
75 "Wall/Min: compare wall signal to the weakest wall signal in the cell.",
"None");
76 addParm(
"Change Map",
"Compare two meshes with each other (deformation or change in signal).",
"No");
77 addParm(
"Increasing",
"Increasing: the current mesh is the reference (T0), the other mesh is the changed state (T1),\n"
78 "Decreasing: the other mesh is the reference (T0), the current mesh is the changed state (T1).",
79 "Increasing", QStringList() <<
"Increasing" <<
"Decreasing");
80 addParm(
"Diff Type",
"Ratio: area or signal in changed state(T1) / area or signal in reference (T0),\n"
81 "Difference: area or signal in changed state(T1) - area or signal in reference (T0),"
82 "Growth: (Ratio -1) / growth time.",
"Ratio", QStringList() <<
"Ration" <<
"Grwoth"<<
"Difference");
83 addParm(
"Growth Time",
"Time interval between the two samples.",
".001");
84 addParm(
"Border Size(µm)",
"Border Size in µm",
"1.0");
130 const QString& reportFile,
int report,
bool manualRange,
float rangeMin,
131 float rangeMax,
bool signalAverage,
bool globalCoordinates,
PolarityType polarity,
132 MultiMapType multiMapType,
float growthTime,
float borderSize);
134 bool initialize(QWidget* parent);
142 void changeMapType(
const QString& type);
143 void selectSpreadsheetFile();
172 setName(
"Mesh/Heat Map/Delete Heat Range Labels");
173 setDesc(
"Delete labels with heat within a given range. The heat is given relative to the total range.");
174 setIcon(QIcon(
":/images/ClearStack.png"));
176 addParm(
"Rescale",
"Redefine the lower/upper bounds of colormap to fit the range of values.",
"Yes",booleanChoice());
177 addParm(
"Delete cells",
"Delete vertices within a given range of the color map (Min Heat-Max Heat).",
"No",booleanChoice());
178 addParm(
"Min Heat",
"Lower bound of color value for which the cells will be deleted (empty for current min).",
"");
179 addParm(
"Max Heat",
"Upper bound of color value for which the cells will be deleted (empty for current max).",
"");
184 if(!checkState().mesh(MESH_NON_EMPTY))
188 if(parm(
"Min Heat").isEmpty())
189 min = std::numeric_limits<float>::quiet_NaN();
191 min = parm(
"Min Heat").toFloat(&ok);
193 return setErrorMessage(
"Error, parameter 'Min Heat' must be either empty, or a number");
194 if(parm(
"Max Heat").isEmpty())
195 max = std::numeric_limits<float>::quiet_NaN();
197 max = parm(
"Max Heat").toFloat(&ok);
199 return setErrorMessage(
"Error, parameter 'Min Heat' must be either empty, or a number");
217 setName(
"Mesh/Heat Map/Heat Map Set Range");
218 setDesc(
"Change the range of the current heat map for display.");
219 setIcon(QIcon(
":/images/MakeHeatMap.png"));
221 addParm(
"Min",
"Lower bound (empty for current)",
"");
222 addParm(
"Max",
"Upper bound (empty for current)",
"");
227 if(!checkState().mesh(MESH_HEAT))
229 Mesh *mesh = currentMesh();
232 if(parm(
"Min").isEmpty())
233 min = std::numeric_limits<float>::quiet_NaN();
235 min = parm(
"Min").toFloat(&ok);
237 return setErrorMessage(
"Error, parameter 'Min' must be either empty, or a number");
238 if(parm(
"Max").isEmpty())
239 max = std::numeric_limits<float>::quiet_NaN();
241 max = parm(
"Max").toFloat(&ok);
243 return setErrorMessage(
"Error, parameter 'Max' must be either empty, or a number");
244 return run(mesh,
min,
max);
262 setName(
"Mesh/Heat Map/Heat Map Save");
263 setDesc(
"Save heat map to a file");
264 setIcon(QIcon(
":/images/MakeHeatMap.png"));
266 addParm(
"Filename",
"Path to spreadsheat file.",
"");
269 bool initialize(QWidget* parent);
273 if(!checkState().mesh(MESH_ANY))
275 Mesh *mesh = currentMesh();
276 return run(mesh, parm(
"Filename"));
279 bool run(
Mesh* mesh,
const QString& filename);
301 setName(
"Mesh/Heat Map/Heat Map Load");
302 setDesc(
"Load a heat map file and set the corresponding heat for each label");
304 addParm(
"File Name",
"Path to spreadsheet file.",
"");
305 addParm(
"Column",
"Column (name or number) of the csv file to load for display, s/b > 0, first column is label.\n",
"2");
306 addParm(
"Border size (µm)",
"Width of cell outline used for vizualization of 'wall' colormaps",
"1.0");
307 setIcon(QIcon(
":/images/MakeHeatMap.png"));
310 bool initialize(QWidget* parent);
314 if(!checkState().mesh(MESH_ANY))
316 Mesh *mesh = currentMesh();
317 return run(mesh, parm(
"File Name"), parm(
"Column").toInt(), parm(
"Border size (µm)").toFloat());
320 bool run(
Mesh* mesh,
const QString& filename,
int column,
float border_size);
321 bool selectFile(
const QString& filename);
325 void selectColumn(
int c);
329 Ui_LoadHeatMap *ui = 0;
396 setName(
"Mesh/Heat Map/Operators/Heat Map Scale Values");
397 setDesc(
"Scales the current heat map values according to the chosen type.\n"
398 "log uses the base of 10. inverse of 0 is 0 \n"
399 "the parameter (P) is used for: \n"
403 setIcon(QIcon(
":/images/MakeHeatMap.png"));
405 addParm(
"Type",
"Type",
"inverse", QStringList() <<
"inverse" <<
"square" <<
"sqrt" <<
"log" <<
"pow" <<
"ordinal" <<
"add" <<
"mult");
406 addParm(
"Parameter",
"Parameter",
"0.0");
411 if(!checkState().mesh(MESH_ANY))
413 Mesh *mesh = currentMesh();
414 return run(mesh, parm(
"Type"), parm(
"Parameter").toDouble());
417 bool run(
Mesh* mesh, QString type,
double parameter);
426 setName(
"Mesh/Heat Map/Operators/Heat Map Normalize");
427 setDesc(
"Normalizes the current heat map values according to the chosen type.");
428 setIcon(QIcon(
":/images/MakeHeatMap.png"));
430 addParm(
"Type",
"Type",
"Max Min", QStringList() <<
"Max Min" <<
"Selected Cells");
435 if(!checkState().mesh(MESH_ANY))
437 Mesh *mesh = currentMesh();
438 return run(mesh, parm(
"Type"));
441 bool run(
Mesh* mesh, QString type);
451 setName(
"Mesh/Heat Map/Operators/Export Heat to Attr Map");
452 setDesc(
"Creates an Attribute map of the chosen name (preceding Measure Label Double) using the current heat map values.");
453 setIcon(QIcon(
":/images/MakeHeatMap.png"));
455 addParm(
"Prefix",
"Prefix",
"Measure Label Double");
456 addParm(
"Name",
"Name",
"Custom Heat Map");
457 addParm(
"Key",
"Keys of Attr Map",
"Label", QStringList() <<
"Label" <<
"Parent");
458 addParm(
"Heat Map Type",
"Type of Heat Map to be saved",
"Label Heat", QStringList() <<
"Label Heat" <<
"Parent Heat");
459 addParm(
"Save to",
"Save to which mesh",
"Active Mesh", QStringList() <<
"Active Mesh" <<
"Other Mesh");
460 addParm(
"Clean",
"Remove entries for non-existent cells",
"No",booleanChoice());
465 if(!checkState().mesh(MESH_ANY))
467 Mesh *m = currentMesh();
469 if(currentMesh() == mesh(0))
473 return run(m, m2, parm(
"Prefix"), parm(
"Name"), parm(
"Key"), parm(
"Heat Map Type"), parm(
"Save to"),
stringToBool(parm(
"Clean")));
476 bool run(
Mesh* m,
Mesh* m2, QString prefix, QString name, QString key, QString value, QString meshNumber,
bool cleanMesh);
486 setName(
"Mesh/Heat Map/Analysis/Growth Analysis 2D");
487 setDesc(
"Creates all attribute maps with a chosen prefix required for heat-map based growth analysis using the current heat map values.");
488 setIcon(QIcon(
":/images/MakeHeatMap.png"));
490 addParm(
"Name Prefix (optional)",
"Name Prefix (optional)",
"");
491 addParm(
"Name Time Point 1",
"Name Time Point 1",
"T1");
492 addParm(
"Name Time Point 2",
"Name Time Point 2",
"T2");
493 addParm(
"Create Custom Dirs From Heat",
"Create Custom Dirs From Current Heat Map",
"No",booleanChoice());
498 if(!checkState().mesh(MESH_ANY))
500 Mesh *m = currentMesh();
502 if(currentMesh() == mesh(0))
506 return run(m, m2, parm(
"Name Prefix (optional)"), parm(
"Name Time Point 1"), parm(
"Name Time Point 2"),
stringToBool(parm(
"Create Custom Dirs From Heat")));
509 bool run(
Mesh* m,
Mesh* m2, QString name, QString t1, QString t2,
bool createCustom);
518 setName(
"Mesh/Heat Map/Operators/Clean Heat Map");
519 setDesc(
"Removes unwanted entries from the heat map (i.e. values for non-existent cells).");
520 setIcon(QIcon(
":/images/MakeHeatMap.png"));
522 addParm(
"Selection",
"Eliminate non-selected cells",
"No",booleanChoice());
523 addParm(
"Min valid",
"Minimum valid value",
"NA");
524 addParm(
"Max valid",
"Maximum valid value",
"NA");
529 if(!checkState().mesh(MESH_ANY))
531 Mesh *m = currentMesh();
533 if(currentMesh() == mesh(0))
537 return run(m, m2,
stringToBool(parm(
"Selection")), parm(
"Min valid"), parm(
"Max valid"));
540 bool run(
Mesh* m,
Mesh* m2,
bool useSelection, QString minValue, QString maxValue);
550 setName(
"Mesh/Heat Map/Operators/Heat Map Transform");
551 setDesc(
"Creates an Attribute map of the chosen name (preceding Measure Label Double) using the current heat map values.");
552 setIcon(QIcon(
":/images/MakeHeatMap.png"));
554 addParm(
"Attr Map 1",
"Attr Map 1",
"A1");
555 addParm(
"Attr Map 2",
"Attr Map 2",
"A2");
556 addParm(
"Combination",
"Combination",
"Yes");
557 addParm(
"Combination Type",
"Combination Type",
"Addition (A + B)");
558 addParm(
"Transformation",
"Transformation",
"No");
559 addParm(
"Transformation Type",
"Transformation Type",
"Neighborhood");
560 addParm(
"Transformation Type 2",
"Transformation Type 2",
"Average");
561 addParm(
"Ignore Parent",
"Ignore Parent",
"-1");
562 addParm(
"Lower Threshold",
"Lower Threshold",
"0");
563 addParm(
"Upper Threshold",
"Upper Threshold",
"100000");
564 addParm(
"New Attr Map",
"Combined Attr Map",
"Combined Attr Map");
567 bool initialize(QWidget *parent);
571 if(!checkState().mesh(MESH_ANY))
573 Mesh *m = currentMesh();
574 return run(m, parm(
"Attr Map 1"), parm(
"Attr Map 2"),
575 stringToBool(parm(
"Combination")), parm(
"Combination Type"),
576 stringToBool(parm(
"Transformation")), parm(
"Transformation Type"), parm(
"Transformation Type 2"), parm(
"Ignore Parent").toInt(), parm(
"Lower Threshold").toDouble(), parm(
"Upper Threshold").toDouble(),
577 parm(
"New Attr Map"));
580 bool run(
Mesh* m, QString name1, QString name2,
581 bool combination, QString combinationType,
582 bool transformation, QString transformationType, QString transformationType2,
int ignoreParent,
double lowerT,
double upperT,
583 QString combinedAttrMap);
592 setName(
"Mesh/Heat Map/Heat Map Select");
593 setDesc(
"Select Cells according to their heat value.");
594 setIcon(QIcon(
":/images/MakeHeatMap.png"));
596 addParm(
"Lower Threshold",
"Lower Threshold",
"0.0");
597 addParm(
"Upper Threshold",
"Upper Threshold",
"1.0");
598 addParm(
"Reset Selection",
"Reset Selection",
"Yes",booleanChoice());
604 if(!checkState().mesh(MESH_ANY))
606 Mesh *m = currentMesh();
607 return run(m, parm(
"Lower Threshold").toDouble(), parm(
"Upper Threshold").toDouble(),
stringToBool(parm(
"Reset Selection")));
610 bool run(
Mesh* m,
double lowerThreshold,
double upperThreshold,
bool resetSelection);
619 setName(
"Mesh/Heat Map/Operators/Switch Heat and Parent");
620 setDesc(
"Select Cells according to their heat value.");
621 setIcon(QIcon(
":/images/MakeHeatMap.png"));
623 addParm(
"Direction",
"Direction",
"Heat -> Parent", QStringList() <<
"Heat -> Parent" <<
"Parent -> Heat" <<
"Parent <-> Heat");
628 if(!checkState().mesh(MESH_ANY))
630 Mesh *m = currentMesh();
631 return run(m, parm(
"Direction"));
634 bool run(
Mesh* m, QString direction);
644 Ui_HeatMapDialogNew
ui;
649 setName(
"Mesh/Heat Map/Heat Map");
650 setDesc(
"New Heat Map process that supports Attribute Maps used for: \n"
651 "- generation of heat maps of any measure or importing attribute maps as heat maps \n"
652 "- generation of change maps of any measure or attribute maps \n"
653 "- generation of heat maps based on label or parent");
655 addParm(
"Measure",
"Measure",
"");
656 addParm(
"Force Recalc",
"Force Recalc",
"No",booleanChoice());
657 addParm(
"Identical Label Behavior",
"Identical Label Behavior",
"Sum", QStringList() <<
"Sum" <<
"Average" <<
"Max"<<
"Min"<<
"Max-Min");
658 addParm(
"Change Map",
"Change Map",
"No",booleanChoice());
659 addParm(
"Change Map Dir",
"Change Map Dir",
"Increasing", QStringList() <<
"Increasing" <<
"Decreasing");
660 addParm(
"Change Map Type",
"Change Map Type",
"Ratio", QStringList() <<
"Ratio" <<
"Difference");
661 addParm(
"Use Labels Active Mesh",
"Use Labels Active Mesh",
"Yes",booleanChoice());
662 addParm(
"Use Labels Inactive Mesh",
"Use Labels Inactive Mesh",
"No",booleanChoice());
665 setIcon(QIcon(
":/images/MakeHeatMap.png"));
668 bool initialize(QWidget *parent);
672 if(!checkState().mesh(MESH_ANY))
674 Mesh *m = currentMesh();
676 if(currentMesh() == mesh(0))
681 return run(m, m2, parm(
"Measure"),
stringToBool(parm(
"Force Recalc")), parm(
"Identical Label Behavior"),
682 stringToBool(parm(
"Change Map")), parm(
"Change Map Dir"), parm(
"Change Map Type"),
688 bool run(
Mesh* m,
Mesh* m2, QString measure,
bool forceRecalc, QString identicalLabel,
689 bool changeMap, QString changeDir, QString changeType,
bool m1Labels,
bool m2Labels);
693 void changeMapType(
const QString& type);
701 setName(
"Mesh/Heat Map/Analysis/Parent Heats");
702 setDesc(
"Computes parent based heat-maps for all identical label behaviour options. Stores in attribute maps");
703 addParm(
"Prefix",
"String to prepend to attr map names",
"");
704 addParm(
"Attr map",
"Name of attribute map to be used for parent heats",
"");
705 setIcon(QIcon(
":/images/MakeHeatMap.png"));
717 setName(
"Mesh/Heat Map/Operators/Heat Map Binning");
718 setDesc(
"Use the current heat map to create a binning of based on cells or values and set the parent label according to the bin.\n"
719 "In Threshold mode only two bins are created based on the parameters in the process Select By Heat");
720 setIcon(QIcon(
":/images/MakeHeatMap.png"));
722 addParm(
"Mode",
"Mode",
"Bins Cells", QStringList() <<
"Bins Cells" <<
"Bins Heat" <<
"Threshold");
723 addParm(
"Nr of Bins",
"Nr of Bins",
"5");
729 Mesh* m = currentMesh();
730 return run(m, parm(
"Mode"), parm(
"Nr of Bins").toInt());
733 bool run(
Mesh* m, QString mode,
int bins);
742 setName(
"Mesh/Heat Map/Analysis/Cell Analysis 2D");
743 setDesc(
"Calculates ALL 2D measure maps. (Might take a bit depending on the mesh.");
744 setIcon(QIcon(
":/images/CellTypeRecognitionSpecification.jpeg"));
746 addParm(
"Exclude Slow Measures",
"Exclude Slow Measures",
"Yes",booleanChoice());
750 return run(
stringToBool(parm(
"Exclude Slow Measures")));
753 bool run(
bool excludeSlow);
762 setName(
"Mesh/Heat Map/Heat Map Smooth");
763 setDesc(
"Smooth the current heat map across the cell neighborhood.\n"
764 "Heat values can be weighted by cell area and the result can be directly exported to an Attr Map");
765 setIcon(QIcon(
":/images/CellTypeRecognitionSpecification.jpeg"));
767 addParm(
"Passes",
"Number of smoothing passes",
"1");
768 addParm(
"Weights",
"Weights",
"None",QStringList() <<
"None" <<
"Area");
769 addParm(
"Rescale Heat",
"Rescale Heat",
"Yes",booleanChoice());
770 addParm(
"Export Attr Map Name",
"Export Attr Map Name",
"");
774 Mesh* m = currentMesh();
775 return run(m, parm(
"Passes").toInt(), parm(
"Weights"),
stringToBool(parm(
"Rescale Heat")), parm(
"Export Attr Map Name"));
778 bool run(
Mesh* m,
int passes, QString mode,
bool rescale, QString attrName);
787 bool run(
const QStringList& parms)
789 if(!checkState().mesh(MESH_NON_EMPTY))
791 Mesh* m = currentMesh();
792 return run(m, parms[0], parms[1].toDouble(), parms[2].toDouble(), parms[3].toDouble());
795 bool run(
Mesh* mesh,
const QString& heatUnit,
double heat,
double minHeat,
double maxHeat);
797 QString
name()
const {
return "Mesh/Heat Map/Apply Heat"; }
798 QString
description()
const {
return "Apply heat to selected labels and scale the heat to range"; }
799 QStringList
parmNames()
const {
return QStringList() <<
"Units" <<
"Heat" <<
"Min Heat" <<
"Max Heat"; }
801 <<
"Units for the new heat." <<
"New heat value to apply."
802 <<
"Lower bound for heat." <<
"Upper bound for heat."; }
803 QStringList
parmDefaults()
const {
return QStringList() <<
"" <<
"1.0" <<
"1.0" <<
"10.0"; }
804 QIcon
icon()
const {
return QIcon(
":/images/ApplyHeat.png"); }