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

WIP: refactoring of the code base #226

Open
wants to merge 118 commits into
base: master
Choose a base branch
from

Conversation

fedorov
Copy link
Member

@fedorov fedorov commented Mar 10, 2017

WIP == FYI == "do not even consider merging"

This is an intermediate commit that aims to improve organization of the conversion
functionality, motivated by the various standing issues (e.g., #217, #192 and #150)
that are difficult to address with the current level of disarray in the code.

Some of the ideas are the following:

  • introduce basic hierarchy of classes to allow reuse of the common
    functionality between PM and SEG converters (MultiFrameConverter parent for
    ParametricMapConverter and SegmentationImageConverter)
  • do not use static functions, instead make better use of converter classes
  • factor out containers to keep information about ImageVolume and DICOMFrame
    to simplify conversion and book keeping
  • improve consistency of naming and code style

My plan to proceed with the refactoring is to implement "shadow" functions in the
updated classes while keeping the original functions initially, and then phase out
the original functions.

The current commit is just an intermediate milestone to open this for feedback
and keep development history at least somewhat incremental.

Copy link
Member

@che85 che85 left a comment

Choose a reason for hiding this comment

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

LGTM. Compiles on my machine as well. Far better structured than before.


DICOMFrame(DcmDataset *dataset, int number) :
frameNumber(number),
frameDataset(dataset) {
Copy link
Member

Choose a reason for hiding this comment

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

indentation ..

typedef short ShortPixelType;
typedef itk::Image<ShortPixelType, 3> ShortImageType;
typedef itk::ImageFileReader<ShortImageType> ShortReaderType;

namespace dcmqi {

class ConverterBase {
class MultiframeConverter {
Copy link
Member

Choose a reason for hiding this comment

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

MultiframeConverter should be MultiFrameConverter

ifdefs should be renamed according to class name

#ifndef DCMQI_CONVERTERBASE_H
#define DCMQI_CONVERTERBASE_H

Copy link
Member

Choose a reason for hiding this comment

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

The filenames use "Multiframe" but some of the code uses "MultiFrame" so it should be uniform in the codebase.

The DICOM standard uses "Multi-frame" which can't be used as an identifier, so that doesn't help.

It looks like DCMTK has a mix of MultiFrame and Multiframe.

Personally I prefer Multiframe and would suggest using that consistently and that looks like Andrey's preference too.

Copy link
Member

Choose a reason for hiding this comment

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

@michaelonken is there a preference in DCMTK for Multiframe vs. MultiFrame?

I see several examples of both currently...

(cd DCMTK; git grep -i multiframe) | less

Copy link
Member Author

Choose a reason for hiding this comment

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

I did pay attention to this, and my logic is to capitalize individual words. Since they are not separate words in the standard, I decided not to capitalize Frame.

*
*
*/
class MultiframeObject {
Copy link
Member

Choose a reason for hiding this comment

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

MultiframeObject --> MultiFrameObject

@pieper
Copy link
Member

pieper commented Apr 6, 2017 via email

@fedorov fedorov force-pushed the frame-handling-refactoring branch from 2c1aa3b to 9fdbc16 Compare May 5, 2017 15:57
@fedorov fedorov force-pushed the frame-handling-refactoring branch from 4466a5d to e1827fe Compare May 14, 2017 18:11
@fedorov fedorov force-pushed the frame-handling-refactoring branch from 3baebf7 to 70b0055 Compare June 22, 2017 20:56
initializeContentIdentification();

// TODO: consider creating parametric map object after all FGs are initialized instead
createParametricMap();
Copy link
Member

@che85 che85 Jun 26, 2017

Choose a reason for hiding this comment

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

Even though createParametricMap is called within initializeFromITK, I think the method name should indicate the type (DICOM or ITK)

We could add two virtual methods {create/get}{DICOM/ITK}Representation to MultiframeObject that needs to be implemented by inheriting classes.

P.S. with initializeFromITK I associate reading an ITK image into the internal data structure. I don't associate the conversion into DICOM with it.

@fedorov fedorov force-pushed the frame-handling-refactoring branch 3 times, most recently from 3ed27af to f8486ba Compare June 30, 2017 22:13
fedorov and others added 21 commits July 5, 2017 15:32
This is an intermediate commit that aims to improve organization of the conversion
functionality, motivated by the various standing issues (e.g., QIICR#217, QIICR#192 and QIICR#150)
that are difficult to address with the current level of disarray in the code.

Some of the ideas are the following:

 - introduce basic hierarchy of classes to allow reuse of the common
   functionality between PM and SEG converters (MultiFrameConverter parent for
   ParametricMapConverter and SegmentationImageConverter)
 - do not use static functions, instead make better use of converter classes
 - factor out containers to keep information about ImageVolume and DICOMFrame
   to simplify conversion and book keeping
 - improve consistency of naming and code style

My plan to proceed with the refactoring is to implement "shadow" functions in the
updated classes while keeping the original functions initially, and then phase out
the original functions.

The current commit is just an intermediate milestone to open this for feedback
and keep development history at least somewhat incremental.
fedorov and others added 24 commits July 28, 2017 17:24
itkimage2paramap tests are passing!
crash in addForAllFrames()!...
Also:
* fix the typo in JSON lookup
* replace the temporary codes with the standard ones: CP-1665 became standard
in 2017a
CP-1665 became standard in 2017a
dciodvfy is happy!
rows/columns were flipped on initialization
* added replacement method to SegmentationImageConverter
* TODO: refactor even more and generalize
 - PixelContrast is no longer needed for PM
 - use standard code for fitting model type
If DerivationImageSequence is not empty for at least one frame, it must be present
for each of the frames.
@fedorov fedorov force-pushed the frame-handling-refactoring branch from 49ed047 to ec36add Compare July 28, 2017 21:28
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

3 participants