Skip to content

Commit

Permalink
Update second modality naming scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelSNelson committed Jan 18, 2024
1 parent 07bad33 commit cbb1839
Showing 1 changed file with 34 additions and 28 deletions.
62 changes: 34 additions & 28 deletions src/main/groovy/qupath/ext/qp_scope/functions/QP_scope_GUI.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,10 @@ class QP_scope_GUI {
String stitchedImagePathStr = UtilityFunctions.stitchImagesAndUpdateProject(projectsFolderPath,
sampleLabel, scanTypeWithIndex, "bounds", qupathGUI, currentQuPathProject,
preferences.compression)
qupathGUI.openImageEntry(currentQuPathProject.getImageList().find { image ->
(new File(image.getImageName()).name == new File(stitchedImagePathStr).name)
})
logger.info(stitchedImagePathStr)
// qupathGUI.openImageEntry(currentQuPathProject.getImageList().find { image ->
// (new File(image.getImageName()).name == new File(stitchedImagePathStr).name)
// })
qupathGUI.refreshProject()
//Check if the tiles should be deleted from the collection folder
if (preferences.tileHandling == "Delete")
Expand Down Expand Up @@ -442,6 +443,7 @@ class QP_scope_GUI {
def projectsFolderPath = projectsFolderField.getText()

//SETUP: collect variables
QuPathGUI qupathGUI = QPEx.getQuPath()
String scanTypeWithIndex = MinorFunctions.getUniqueFolderName(projectsFolderPath + File.separator + sampleLabel + File.separator + preferences.secondScanType)
String tempTileDirectory = projectsFolderPath + File.separator + sampleLabel + File.separator + scanTypeWithIndex
Project<BufferedImage> currentQuPathProject = getProject()
Expand Down Expand Up @@ -486,31 +488,35 @@ class QP_scope_GUI {
//TODO get pixel size from somewhere???
//TODO BEGIN SECOND COLLECTION WHILE FIRST IS STITCHING
logger.info("Begin stitching")
String stitchedImagePathStr = StitchingImplementations.stitchCore("Coordinates in TileConfiguration.txt file",
projectsFolderPath + File.separator + sampleLabel + File.separator + scanTypeWithIndex,
stitchedImageOutputFolder,
"J2K_LOSSY",
0,
1,
annotation.getName())
logger.info("Get project")

//UtilityFunctions.showAlertDialog("Wait and complete stitching in other version of QuPath")

//String stitchedImagePathStr = stitchedImageOutputFolder + File.separator + preferences.secondScanType + sampleLabel + ".ome.tif"
File stitchedImagePath = new File(stitchedImagePathStr)
UtilityFunctions.addImageToProject(stitchedImagePath, currentQuPathProject)

//open the newly created project
//https://qupath.github.io/javadoc/docs/qupath/lib/gui/QuPathGUI.html#setProject(qupath.lib.projects.Project)
def qupathGUI = QPEx.getQuPath()

//qupathGUI.setProject(currentQuPathProject)
//Find the existing images - there should only be one since the project was just created
def matchingImage = currentQuPathProject.getImageList().find { image ->
(new File(image.getImageName()).name == new File(stitchedImagePathStr).name)
}
qupathGUI.refreshProject()
String stitchedImagePathStr = UtilityFunctions.stitchImagesAndUpdateProject(projectsFolderPath,
sampleLabel, scanTypeWithIndex as String, annotation.getName(),
qupathGUI, currentQuPathProject, preferences.compression)
logger.info(stitchedImagePathStr)
// String stitchedImagePathStr = StitchingImplementations.stitchCore("Coordinates in TileConfiguration.txt file",
// projectsFolderPath + File.separator + sampleLabel + File.separator + scanTypeWithIndex,
// stitchedImageOutputFolder,
// "J2K_LOSSY",
// 0,
// 1,
// annotation.getName())
// logger.info("Get project")
//
// //UtilityFunctions.showAlertDialog("Wait and complete stitching in other version of QuPath")
//
// //String stitchedImagePathStr = stitchedImageOutputFolder + File.separator + preferences.secondScanType + sampleLabel + ".ome.tif"
// File stitchedImagePath = new File(stitchedImagePathStr)
// UtilityFunctions.addImageToProject(stitchedImagePath, currentQuPathProject)
//
// //open the newly created project
// //https://qupath.github.io/javadoc/docs/qupath/lib/gui/QuPathGUI.html#setProject(qupath.lib.projects.Project)
// def qupathGUI = QPEx.getQuPath()
//
// //qupathGUI.setProject(currentQuPathProject)
// //Find the existing images - there should only be one since the project was just created
// def matchingImage = currentQuPathProject.getImageList().find { image ->
// (new File(image.getImageName()).name == new File(stitchedImagePathStr).name)
// }
// qupathGUI.refreshProject()
//Open the first image
//https://qupath.github.io/javadoc/docs/qupath/lib/gui/QuPathGUI.html#openImageEntry(qupath.lib.projects.ProjectImageEntry)

Expand Down

0 comments on commit cbb1839

Please sign in to comment.