Skip to content

Add TransformedAxis and TransformedAxes#75

Open
alanocallaghan wants to merge 4 commits into
qupath:mainfrom
alanocallaghan:main
Open

Add TransformedAxis and TransformedAxes#75
alanocallaghan wants to merge 4 commits into
qupath:mainfrom
alanocallaghan:main

Conversation

@alanocallaghan

Copy link
Copy Markdown
Contributor

Supply a basic abstract class to clarify which methods need to be overridden to create a functional class. Do not provide a default implementation but do provide two concrete classes for common options via static method.

Supply a basic abstract class to clarify which methods need to be
overridden to create a functional class. Do not provide a default
implementation but do provide two concrete classes for common options
via static method.

@petebankhead petebankhead left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't run it, but I like the look of it. Added some comments, will actually try using it at some point.

Comment thread src/main/java/qupath/lib/gui/charts/TransformedAxis.java Outdated
Comment thread src/main/java/qupath/lib/gui/charts/TransformedAxes.java Outdated
Comment thread src/main/java/qupath/lib/gui/charts/TransformedAxes.java Outdated
Comment thread src/main/java/qupath/lib/gui/charts/TransformedAxes.java
@alanocallaghan

Copy link
Copy Markdown
Contributor Author

Good yeah, I tested it on scatter plots but not yet histograms. I may still tweak the axis limits

@alanocallaghan alanocallaghan marked this pull request as draft June 23, 2026 16:20
@alanocallaghan

Copy link
Copy Markdown
Contributor Author

I seem to have messed this up somewhere along the line

@alanocallaghan alanocallaghan marked this pull request as ready for review June 24, 2026 14:35
@alanocallaghan

alanocallaghan commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Slightly artificial example:

import javafx.application.Platform
import javafx.scene.chart.ScatterChart
import javafx.collections.FXCollections
import javafx.scene.chart.XYChart;
import javafx.scene.chart.NumberAxis;
import javafx.stage.Stage;
import javafx.scene.Scene

import qupath.fx.charts.TransformedAxes
import qupath.lib.objects.PathObjectTools


var chart = new ScatterChart<>(TransformedAxes.log1p2(), TransformedAxes.log1p10())
var cells = getCellObjects()

var xFun = {p -> PathObjectTools.getROI(p, true).getCentroidX()}
var yFun = {p -> PathObjectTools.getROI(p, true).getCentroidY()}

var data = cells.stream()
        .map(p -> new XYChart.Data<>(xFun(p), yFun(p), p))
        .toList();
var series = FXCollections.observableArrayList()
series.add(new XYChart.Series<>("Series A", FXCollections.observableArrayList(data)));

chart.setData(series)


Platform.runLater( {
    var stage = new Stage()
    stage.setScene(new Scene(chart))
    stage.show()
})
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants