Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/BIOP/ijp-imagetoatlas
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoKiaru committed Sep 12, 2024
2 parents e5e2684 + 61348df commit fa2e953
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 4 deletions.
5 changes: 3 additions & 2 deletions message/howtocite.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<html>
<body style='font-family:sans-serif; font-size:12px; color:#333333;'>
<p style='margin-top:0;'>If you use ABBA for your research, a preprint will soon become available...</p>
<p>Don't forget to cite these resources if you use them: atlas dataset, DeepSlice, QuPath.<p/>
<p style='margin-top:0;'>If you use ABBA for your research, please cite this preprint:</p>
<p><a href="https://doi.org/10.1101/2024.09.06.611625">https://doi.org/10.1101/2024.09.06.611625</a></p>
<p>Also, don't forget to cite the other resources you may be using: atlas dataset, DeepSlice, QuPath.<p/>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public class ABBACiteInfoCommand implements Command {
public void run() {

JFrame frame = new JFrame("How to cite");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(450, 350);
frame.setLocationRelativeTo(null); // Center the window
frame.setIconImage((new ImageIcon(MultiSlicePositioner.class.getResource("/graphics/ABBAFrame.jpg"))).getImage());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package ch.epfl.biop.atlas.aligner.command;

import ch.epfl.biop.atlas.aligner.MultiSlicePositioner;
import ch.epfl.biop.sourceandconverter.exporter.IntRangeParser;
import org.scijava.command.Command;
import org.scijava.plugin.Parameter;
import org.scijava.plugin.Plugin;

import java.util.List;

@SuppressWarnings("CanBeFinal")
@Plugin(type = Command.class,
menuPath = "Plugins>BIOP>Atlas>Multi Image To Atlas>Edit>ABBA - Deselect Slices",
description = "Set the slices to deselect.")
public class SetSlicesDeselectedCommand implements Command {

@Parameter
MultiSlicePositioner mp;

@Parameter(label = "Slices to deselect, '*' for all slices, comma separated, 0-based")
String slices_csv = "*";

@Override
public void run() {
if (slices_csv.trim().equals("*")) {
slices_csv ="0:-1";
}
try {
List<Integer> indices = new IntRangeParser(slices_csv).get(mp.getSlices().size());
for (int index: indices) {
mp.getSlices().get(index).deSelect();
}
} catch (Exception e) {
mp.errorMessageForUser.accept("Error during parsing of slice indices", e.getMessage());
throw new RuntimeException(e);
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package ch.epfl.biop.atlas.aligner.command;

import ch.epfl.biop.atlas.aligner.MultiSlicePositioner;
import ch.epfl.biop.atlas.aligner.SliceSources;
import ch.epfl.biop.sourceandconverter.exporter.IntRangeParser;
import org.scijava.command.Command;
import org.scijava.plugin.Parameter;
import org.scijava.plugin.Plugin;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

@SuppressWarnings("CanBeFinal")
@Plugin(type = Command.class,
menuPath = "Plugins>BIOP>Atlas>Multi Image To Atlas>Edit>ABBA - Select Slices",
description = "Set the slices to select.")
public class SetSlicesSelectedCommand implements Command {

@Parameter
MultiSlicePositioner mp;

@Parameter(label = "Slices to select, '*' for all slices, comma separated, 0-based")
String slices_csv = "*";

@Override
public void run() {
if (slices_csv.trim().equals("*")) {
slices_csv ="0:-1";
}
try {
List<Integer> indices = new IntRangeParser(slices_csv).get(mp.getSlices().size());
for (int index: indices) {
mp.getSlices().get(index).select();
}
} catch (Exception e) {
mp.errorMessageForUser.accept("Error during parsing of slice indices", e.getMessage());
throw new RuntimeException(e);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@
import ch.epfl.biop.atlas.aligner.command.RegisterSlicesElastixSplineCommand;
import ch.epfl.biop.atlas.aligner.command.RegisterSlicesRemoveLastCommand;
import ch.epfl.biop.atlas.aligner.command.RotateSlicesCommand;
import ch.epfl.biop.atlas.aligner.command.SetSlicesDeselectedCommand;
import ch.epfl.biop.atlas.aligner.command.SetSlicesDisplayRangeCommand;
import ch.epfl.biop.atlas.aligner.command.SetSlicesSelectedCommand;
import ch.epfl.biop.atlas.aligner.command.SetSlicesThicknessCommand;
import ch.epfl.biop.atlas.aligner.command.SetSlicesThicknessMatchNeighborsCommand;
import ch.epfl.biop.atlas.aligner.command.SliceAffineTransformCommand;
Expand Down Expand Up @@ -375,6 +377,8 @@ private void installBdvMenu(int hierarchyLevelsSkipped) {

BdvScijavaHelper.addActionToBdvHandleMenu(bdvh,"Slices>Select All Slices [Ctrl+A]",0,() -> msp.getSlices().forEach(SliceSources::select));
BdvScijavaHelper.addActionToBdvHandleMenu(bdvh,"Slices>Deselect All Slices [Ctrl+Shift+A]",0,() -> msp.getSlices().forEach(SliceSources::deSelect));
BdvScijavaHelper.addCommandToBdvHandleMenu(bdvh, msp.getContext(),"Slices>Select Slices", SetSlicesSelectedCommand.class, "mp", msp);
BdvScijavaHelper.addCommandToBdvHandleMenu(bdvh, msp.getContext(),"Slices>Deselect Slices", SetSlicesDeselectedCommand.class, "mp", msp);
BdvScijavaHelper.addSeparator(bdvh,"Slices");
BdvScijavaHelper.addActionToBdvHandleMenu(bdvh,"Slices>Remove Slices",0,() ->
msp.getSlices()
Expand Down Expand Up @@ -471,7 +475,7 @@ private void installBdvMenu(int hierarchyLevelsSkipped) {
BdvScijavaHelper.addCommandToBdvHandleMenu(bdvh, msp.getContext(), "Help>Give your feedback (web)", ABBAUserFeedbackCommand.class);
BdvScijavaHelper.addCommandToBdvHandleMenu(bdvh, msp.getContext(), "Help>About DeepSlice (web)", DeepSliceDocumentationCommand.class);
BdvScijavaHelper.addSeparator(bdvh,"Help");
BdvScijavaHelper.addCommandToBdvHandleMenu(bdvh, msp.getContext(), "Help>How to cite ABBA (web)", ABBACiteInfoCommand.class);
BdvScijavaHelper.addCommandToBdvHandleMenu(bdvh, msp.getContext(), "Help>How to cite ABBA", ABBACiteInfoCommand.class);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import ch.epfl.biop.atlas.aligner.gui.bdv.ABBABdvStartCommand;
import ch.epfl.biop.atlas.mouse.allen.ccfv3p1.command.AllenBrainAdultMouseAtlasCCF2017v3p1Command;
import ch.epfl.biop.atlas.scijava.AtlasChooserCommand;
import ch.epfl.biop.bdv.img.omero.command.OmeroConnectCommand;
import ch.epfl.biop.scijava.command.bdv.userdefinedregion.GetUserRectangleCommand;
import org.scijava.Priority;
import org.scijava.command.CommandInfo;
Expand Down Expand Up @@ -56,6 +57,7 @@ static void initializeCommands() {
checkedCommands.add(ABBAStateSaveCommand.class.getName());
checkedCommands.add(GetUserRectangleCommand.class.getName());
checkedCommands.add(DisplaySettingsCommand.class.getName());
checkedCommands.add(OmeroConnectCommand.class.getName());
initialized = true;
}
}
Expand Down

0 comments on commit fa2e953

Please sign in to comment.