Skip to content

Commit

Permalink
Feature/code clean up (#190)
Browse files Browse the repository at this point in the history
* Remove some warnings

* Replace refine and review containers with view container
  • Loading branch information
davidborland authored Oct 27, 2022
1 parent 4254d07 commit c8f8917
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ const sortOrder = (a, b) => (
);

export const Assignments = ({ type, header, subheader, assignments, showEmpty = true }) => {
const enabledStatus = type === 'refine' ? 'active' : type;

const enabled = ({ status, reviewer }) =>
type === 'refine' ? status === 'active' :
status !== 'active' || !reviewer?.login;
Expand Down

This file was deleted.

3 changes: 2 additions & 1 deletion client/src/modules/view/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ export * from './slice';
export * from './image';
export * from './mask';
export * from './surface';
export * from './bounding-box';
export * from './bounding-box';
export * from './view-container';
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { ClaimDialog, RemoveDialog, SplitDialog, MergeDialog, CreateDialog, Dele

const { Column } = Grid;

export const RefineContainer = () => {
export const ViewContainer = ({ review = false }) => {
const [{ imageData }, userDispatch] = useContext(UserContext);
const [, annotateDispatch] = useContext(AnnotateContext);
const [volumeView, setVolumeView] = useState();
Expand Down Expand Up @@ -240,7 +240,7 @@ export const RefineContainer = () => {
</Grid>
{ !loading &&
<>
<SaveButtons />
<SaveButtons review={ review } />
<ClaimDialog />
<RemoveDialog />
<SplitDialog sliceView={ sliceView } />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const applyActiveRegion = (region, surfaces) => {

export function VolumeView(painter) {
// Callbacks
let onEdit = () => {};
// let onEdit = () => {};
let onSliceChange = () => {};

const renderWindow = RenderWindow();
Expand Down
4 changes: 2 additions & 2 deletions client/src/modules/view/components/volume-view/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export function Widgets(painter) {
let regions = [];
let backgroundRegions = [];
let activeRegion = null;
let hoverLabel = null;
let highlightLabel = null;
// let hoverLabel = null;
// let highlightLabel = null;

const getRegion = label => {
const region = regions.concat(backgroundRegions).find(region => region.label === label);
Expand Down
7 changes: 3 additions & 4 deletions client/src/pages/assignment.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { useNavigate } from 'react-router-dom';
import { Message } from 'semantic-ui-react';
import { UserContext } from 'contexts';
import { RedirectMessage } from 'modules/common/components/redirect-message';
import { RefineContainer } from 'modules/refine/components/refine-container';
import { ReviewContainer } from 'modules/review/components/review-container';
import { ViewContainer } from 'modules/view/components';

export const Assignment = () => {
const [{ user, assignment }] = useContext(UserContext);
Expand All @@ -21,9 +20,9 @@ export const Assignment = () => {
: !assignment ?
<RedirectMessage message='No Assignment' />
: assignment.status === 'active' ?
<RefineContainer />
<ViewContainer />
: assignment.status === 'review' ?
<ReviewContainer />
<ViewContainer review={ true } />
:
<Message>Unknown assignment type { assignment.type }</Message>
);
Expand Down
12 changes: 0 additions & 12 deletions client/src/vtk/filters/ninjato-painter/ninjato-painter.worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,18 +194,6 @@ function handlePaintFloodFill({ labels, label, labelConstraint, pointList, brush
}
}

// XXX: Currently assuming z slice
function handleErase({ pointList, brush }) {
if (pointList.length === 0) return;

// Paint points
pointList.forEach((point, i) => {
paint({ point, brush });

if (i === 0) globals.prevPoint = null;
});
}

function handleCrop({ p1, p2 }) {
const xStart = p1[0];
const xStop = p2[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,5 @@ export const newInstance = macro.newInstance(
'vtkBrush3DRepresentation'
);

// eslint-disable-next-line import/no-anonymous-default-export
export default { newInstance, extend };
2 changes: 1 addition & 1 deletion client/src/vtk/widgets/brush-3d-widget/behavior.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import macro from '@kitware/vtk.js/macros';
import { vec3 } from 'gl-matrix';
import { getSurfaceLabel } from 'vtk/widgets/widget-utils';
//import { getSurfaceLabel } from 'vtk/widgets/widget-utils';

const toVoxelCenter = (p, spacing, extent) => {
return p.map((v, i) => {
Expand Down

0 comments on commit c8f8917

Please sign in to comment.