Hi Marcel,
Albert is right, updating nodes through the database is likely the
better approach, because it avoids many moving parts you are dealing
with at the moment and is faster and more robust too:
Assuming that you need to update all treenodes and synapses in a
particular project, you can do the following:
1. create a backup of your database (pg_dumpall is likely the quickest
for you)
2. connect to your db:
manage.py dbshell
3. start a new transaction:
BEGIN;
4. list projects to get ID of correct projcet
SELECT * FROM project;
5. update all "location" entries with their new coordinates (using
project_id=1 and factor 1000 as example:
UPDATE location SET location_x=location_x * 1000, location_y=location_y * 1000, location_z=location_z * 1000
WHERE project_id = 1;
6. Check if everything looks good:
SELECT * from location LIMIT 10;
7. If everything looks good, commit your changes:
COMMIT;
8. Exit database: Ctrl + D
Note that if there is an error inside the transaction (between begin and
commit), you need to rollback the transaction and start again before you
can issue any new commands: ROLLBACK; and then BEGIN; again.
Of course you don't need a transaction to execute the UPDATE, but when
working with production data in the database, this safeguard is always
advisable. It's easy to make a typo and a wrong DELETE can be really
fast.
The above assumes of course that all treenodes and connectors in a
particular project (with ID=1 in example above) need to be
multiplied by 1000 in X, Y and Z. Of course only a subset or other
operations can be done as well.
Using SQL has the benefit of being able to work on all data that needs
updates at once in a transactional manner. I agree though that it might
be nice to have such an operation exposed in the admin view might be a
good idea.
CATMAID uses table inheritance in its database schema and more detailed
tables like treenode or connector inherit from the location table. With
an UPDATE statement like above, all child tables from location will be
updated, too (which is what you want here).
Best,
Tom
>To view this discussion on the web visit
https://groups.google.com/d/msgid/catmaid/10982510-6123-41A8-9DE8-289FC880DC59%40gmail.com.