Skip to content

Commit

Permalink
Bug fixes (#646)
Browse files Browse the repository at this point in the history
* "sklearn" import name

* Fix render flickering issues

* Fix resetting slices on frame change

* Lint fix
  • Loading branch information
annehaley committed Apr 10, 2023
1 parent de0da65 commit 4a2d357
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 24 deletions.
2 changes: 1 addition & 1 deletion miqa/learning/correlator.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3

import pandas as pd
from scikit_learn.metrics import confusion_matrix
from sklearn.metrics import confusion_matrix

df = pd.read_csv('M:/MIQA/data.csv') # manually converted TRUE/FALSE into 1/0
print(f'count NaN: {df.isnull().sum().sum()}')
Expand Down
7 changes: 1 addition & 6 deletions miqa/learning/nn_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@
import itk
import monai
import numpy as np
from scikit_learn.metrics import (
classification_report,
confusion_matrix,
mean_squared_error,
r2_score,
)
from sklearn.metrics import classification_report, confusion_matrix, mean_squared_error, r2_score
import torch
from torch.utils.data import DataLoader
import torchio
Expand Down
2 changes: 1 addition & 1 deletion miqa/learning/nn_training.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
)
import numpy as np
import pandas as pd
from scikit_learn.metrics import confusion_matrix
from sklearn.metrics import confusion_matrix
import torch
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter
Expand Down
38 changes: 22 additions & 16 deletions web_client/src/components/VtkViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,17 @@ export default {
this.initializeSlice();
this.initializeView();
},
currentFrame() {
this.prepareViewer();
currentFrame(oldFrame, newFrame) {
this.representation.setSlice(this.slice);
},
currentScan() {
this.initializeSlice();
this.initializeCamera();
this.applyCurrentWindowLevel();
this.updateCrosshairs();
// use this instead of currentScan watcher
// currentScan is computed from currentFrame and technically
// will change every time currentFrame has changed
if (oldFrame.scan !== newFrame.scan) {
this.initializeSlice();
this.initializeCamera();
}
},
showCrosshairs() {
this.updateCrosshairs();
Expand Down Expand Up @@ -150,9 +154,7 @@ export default {
}
});
this.resizeObserver.observe(this.$refs.viewer);
const representationProperty = this.representation.getActors()[0].getProperty();
representationProperty.setColorWindow(this.currentWindowWidth);
representationProperty.setColorLevel(this.currentWindowLevel);
this.applyCurrentWindowLevel();
},
initializeSlice() {
if (this.name !== 'default') {
Expand All @@ -162,13 +164,12 @@ export default {
initializeView() {
this.view.setContainer(this.$refs.viewer);
fill2DView(this.view);
if (this.name !== 'default') {
this.modifiedSubscription = this.representation.onModified(() => {
if (!this.loadingFrame) {
this.slice = this.representation.getSlice();
}
});
}
// add scroll interaction to change slice
this.view.getInteractor().onMouseWheel(() => {
if (!this.loadingFrame) {
this.slice = this.representation.getSlice();
}
});
// add click interaction to place crosshairs
this.view.getInteractor().onLeftButtonPress((event) => this.placeCrosshairs(event));
// remove drag interaction to change window
Expand Down Expand Up @@ -206,6 +207,11 @@ export default {
this.view.resetCamera();
fill2DView(this.view);
},
applyCurrentWindowLevel() {
const representationProperty = this.representation.getActors()[0].getProperty();
representationProperty.setColorWindow(this.currentWindowWidth);
representationProperty.setColorLevel(this.currentWindowLevel);
},
findClosestColumnToVector(inputVector, matrix) {
let currClosest = null;
let currMax = 0;
Expand Down

0 comments on commit 4a2d357

Please sign in to comment.