Skip to content

Commit 015ae9f

Browse files
Bug fixes; Update URLs to match autoindexJson v1
1 parent 4171a75 commit 015ae9f

File tree

11 files changed

+139
-107
lines changed

11 files changed

+139
-107
lines changed

client/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The app is fully functional offline after the initial page load, except for the
2020

2121
## Serving dataset files
2222

23-
The web-client expect the dataset files to be downloadable at `/files`, with an [autoindex JSON API](https://www.npmjs.com/package/autoindex-json) conforming to [NGINX JSON autoindex](http://nginx.org/en/docs/http/ngx_http_autoindex_module.html#autoindex_format) output standards for browsing the data directories at `/files?path=<path>`.
23+
The web-client expect the dataset files to be downloadable at `/files`, with an [autoindex JSON API](https://www.npmjs.com/package/autoindex-json) conforming to [NGINX JSON autoindex](http://nginx.org/en/docs/http/ngx_http_autoindex_module.html#autoindex_format) output standards for browsing the data directories at `/files/<path>`.
2424

2525
## Setting up with a Custom Server
2626

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "odoviz-react-client",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"license": "MIT",
55
"repository": "https://github.com/robotvisionmu/odoviz/tree/main/client",
66
"author": "Saravanabalagi Ramachandran <saravanabalagi@hotmail.com>",

client/public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
work correctly both with client-side routing and a non-root public URL.
2020
Learn how to configure a non-root public URL by running `npm run build`.
2121
-->
22-
<title>Odoviz | 3D Odometry Visualization and Processing Tool</title>
22+
<title>OdoViz | 3D Odometry Visualization and Processing Tool</title>
2323
</head>
2424
<body>
2525
<noscript>You need to enable JavaScript to run this app.</noscript>

client/src/extensions/distances/distances.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ class Distances extends Component {
4040
this.state = {
4141
loading: null,
4242
error: null,
43-
sideBar: false,
44-
imagesToDisplay: {},
43+
sideBar: true,
4544
selectedIndex: null,
4645
compareIndex: 1,
4746
localTopKToDisplay: props.topKToDisplay,
@@ -97,8 +96,8 @@ class Distances extends Component {
9796
this.setState({ loading: false });
9897
};
9998

100-
setImagesToDisplay = (e) => {
101-
const i = parseInt(e.currentTarget.getAttribute('i'));
99+
getImagesToDisplay = (i) => {
100+
if (i == null) return {};
102101
const { distancesNpzs, currentDistancesIndex, topKToDisplay, skip0thMatch } = this.props;
103102
const distances = distancesNpzs && distancesNpzs[currentDistancesIndex];
104103
const imagesToDisplay = [...Array(topKToDisplay + skip0thMatch).keys()].reduce((result, j, dict_index) => {
@@ -107,7 +106,7 @@ class Distances extends Component {
107106
result[dict_index] = [this.getImagePath(label, index), [label, index]];
108107
return result;
109108
}, {});
110-
this.setState({ imagesToDisplay, sideBar: true, selectedIndex: i });
109+
return imagesToDisplay;
111110
};
112111

113112
getImagePath = (label, index) => {
@@ -127,6 +126,15 @@ class Distances extends Component {
127126
this.setState({ compareIndex: index });
128127
};
129128

129+
setSelectedIndex = (index) => {
130+
this.setState({ selectedIndex: index });
131+
};
132+
133+
handleSetSelectedIndex = (e) => {
134+
const index = parseInt(e.currentTarget.getAttribute('i'));
135+
this.setSelectedIndex(index);
136+
};
137+
130138
handleSetCompareIndex = (e) => {
131139
const index = parseInt(e.currentTarget.getAttribute('j'));
132140
this.setCompareIndex(index);
@@ -137,8 +145,8 @@ class Distances extends Component {
137145
};
138146

139147
handleSetTopKDisplay = (e, value) => {
148+
this.setState((s) => ({ localTopKToDisplay: value, compareIndex: s.compareIndex > value ? 1 : s.compareIndex }));
140149
this.props.setTopKToDisplay(value);
141-
this.setState({ localTopKToDisplay: value });
142150
};
143151

144152
handleSetSkip0thMatch = (e, value) => {
@@ -164,7 +172,8 @@ class Distances extends Component {
164172
const { loading, error, sideBar } = this.state;
165173
const { topKToDisplay, skip0thMatch, dataFile, dataJson, distancesNpzs, distancesFiles, currentDistancesIndex } =
166174
this.props;
167-
const { imagesToDisplay, selectedIndex, compareIndex, localTopKToDisplay } = this.state;
175+
const { selectedIndex, compareIndex, localTopKToDisplay } = this.state;
176+
const imagesToDisplay = this.getImagesToDisplay(selectedIndex);
168177

169178
const steps = this.getAllSteps();
170179
const distanceIndexMarks = steps.map((step, i) => ({
@@ -319,7 +328,7 @@ class Distances extends Component {
319328
className={classnames('row', { selected: i === selectedIndex })}
320329
key={i}
321330
i={i}
322-
onClick={this.setImagesToDisplay}
331+
onClick={this.handleSetSelectedIndex}
323332
>
324333
<Grid container spacing={1} direction={'row'} wrap={'nowrap'}>
325334
<Grid item className={'displayImagesIcon'}>

client/src/extensions/explorer/explorer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class Explorer extends Component {
8181
fetchDir = async (path) => {
8282
this.setState({ loading: true });
8383
try {
84-
const response = await fetch(`/files?path=${path}`);
84+
const response = await fetch(`/files/${path}`);
8585
if (!response.ok) throw new Error(`${response.status} ${response.statusText}`);
8686
const data = await response.json();
8787
this.setState({ files: data || [], loading: false, error: data.error });

client/src/extensions/matching/matching.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ class Matching extends Component {
123123
const carsGroup = scene.getObjectByName('cars');
124124
if (carsGroup) carsSubgroups = carsGroup.children;
125125

126-
const queryCars = carsSubgroups[0].children.map((car) => car.data);
127-
const refCarsArray = carsSubgroups.slice(1).map((carsSubgroup) => carsSubgroup.children.map((car) => car.data));
126+
const queryCars = carsSubgroups[0].children;
127+
const refCarsArray = carsSubgroups.slice(1).map((carsSubgroup) => carsSubgroup.children);
128128
exportPoses(queryCars, refCarsArray);
129129
};
130130

client/src/matcher/oxfordRobotcarMatcher.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,15 @@ function exportPoses(queryCars, matchedCarsArray) {
130130
// and add them based on query index inside
131131
for (let i = 0; i < matchedCars.length; i++) {
132132
const matchedCar = matchedCars[i];
133-
classes[matchedCar.samplingIndex].push(matchedCar);
133+
classes[matchedCar.data.matchingForSamplingIndex].push(matchedCar);
134134
}
135135
}
136136

137137
const classesWithPath = {};
138138
Object.entries(classes).forEach(([key, values]) => {
139139
classesWithPath[key] = [];
140140
values.forEach((car) => {
141-
const imagePath = getImgPath(car.image.value, car.parent.name);
141+
const imagePath = getImgPath(car.data.image.stereo_centre, car.parent.name);
142142
classesWithPath[key].push(imagePath);
143143
});
144144
});

client/src/parsers/oxfordRobotcarParser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ async function parseFn(data, filePath) {
3434
console.debug('Total INS timestamps', dataLines.length);
3535

3636
const imageFolder = getImgPath(null, filePath);
37-
const response = await fetch(`/files?path=${imageFolder}`);
37+
const response = await fetch(`/files/${imageFolder}`);
3838
const responseData = await response.json();
3939
const filenames = responseData
4040
.filter((f) => f.type === 'file')

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "odoviz",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "A reactive web-based odometry 3D visualization and processing tool",
55
"repository": "git@github.com:robotvisionmu/odoviz.git",
66
"author": "Saravanabalagi Ramachandran <saravanabalagi@hotmail.com>",
77
"license": "MIT",
88
"dependencies": {
9-
"autoindex-json": "^0.2.0",
9+
"autoindex-json": "^1.0.0",
1010
"express": "^4.17.1",
1111
"express-pino-logger": "^4.0.0",
1212
"pino-colada": "^1.4.4"

server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const PORT = process.env.ODOVIZ_PORT || 3000;
1111
const DATA_DIR = process.env.ODOVIZ_DATA_DIR;
1212

1313
if (DATA_DIR == null) {
14-
console.error("Please specify ODOVIZ_DATA_DIR environment variable before initializing OdoViz");
14+
console.error('Please specify ODOVIZ_DATA_DIR environment variable before initializing OdoViz');
1515
process.exit();
1616
}
1717

0 commit comments

Comments
 (0)