Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement viewer for import tomograms #3

Merged
merged 7 commits into from May 7, 2019
Merged

Conversation

adrianq
Copy link
Collaborator

@adrianq adrianq commented Apr 24, 2019

For now, this is just mirroring the viewer volumes behaviour. As discussed with @delarosatrevin we will have to find a more intelligent approach as this viewer won't be able to handle regular-size tomograms (a few GBs). This is just a quick solution for the moment.

We have just discussed to implement the viewer per data type instead of per protocol. However, if we do it so the viewer_volume will be triggered instead of the viewer for Tomograms or Set of Tomograms.

@adrianq adrianq changed the base branch from devel to tomo May 7, 2019 07:20
import pyworkflow.protocol.params as params
from pyworkflow.em.convert import ImageHandler
from pyworkflow.viewer import DESKTOP_TKINTER, WEB_DJANGO, ProtocolViewer
from pyworkflow.em.viewers.viewer_chimera import Chimera, ChimeraView
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import should be done from submodule pyworkflow.em.viewers, viewers_chimera is an implementation file and should not be imported directly.

from pyworkflow.viewer import DESKTOP_TKINTER, WEB_DJANGO, ProtocolViewer
from pyworkflow.em.viewers.viewer_chimera import Chimera, ChimeraView

from tomo.protocols.protocol_import_tomograms import ProtImportTomograms
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, import from tomo.protocols

TOMOGRAM_CHIMERA = 0


class viewerProtImportTomograms(ProtocolViewer):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class names should start with capital letter

return [self.objectView(setOfTomograms)]


def errorWindow(tkParent, msg):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are error messages in the base classes of Viewers (or ProtocolViewers), so I think this function is unnecessary here.

@adrianq
Copy link
Collaborator Author

adrianq commented May 7, 2019

@delarosatrevin I think I have taken care of all your comments. Let me know otherwise... Thanks!

from pyworkflow.viewer import DESKTOP_TKINTER, WEB_DJANGO, ProtocolViewer, MessageView, MSG_ERROR
import pyworkflow.em.viewers as viewers

from tomo.protocols import protocol_import_tomograms
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still here you are referring to "internal" implementation file 'protocol_import_tomograms'. This is not a good practice since this file can change, or merged...the class definition should be available from tomo.protocols (defined in its init.py file), so it should be something like this:
from tomo.protocols import ProtImportTomograms # so you don't really need to know where the class is implemented


import pyworkflow.protocol.params as params
from pyworkflow.em.convert import ImageHandler
from pyworkflow.viewer import DESKTOP_TKINTER, WEB_DJANGO, ProtocolViewer, MessageView, MSG_ERROR
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check line length of max 80, as stated in PEP8

}

def _validate(self):
if (self.displayTomo == TOMOGRAM_CHIMERA
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a plugin specific to Chimera, have you checked if some of this functionality is already there?

@delarosatrevin
Copy link
Member

I have added some extra comments.

@delarosatrevin delarosatrevin merged commit 98d968b into tomo May 7, 2019
@delarosatrevin delarosatrevin deleted the fix/viewer_tomograms branch May 7, 2019 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants