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

Reading .ISQ header #27

Closed
sbonaretti opened this issue Jan 30, 2020 · 4 comments
Closed

Reading .ISQ header #27

sbonaretti opened this issue Jan 30, 2020 · 4 comments

Comments

@sbonaretti
Copy link
Collaborator

Hi,

Is there a function that reads and returns the header of .isq files?

Thanks!
Serena

@thewtex
Copy link
Member

thewtex commented Jan 30, 2020

A number of the import header elements are exposed in the itk.ScancoImageIO class:

itkGetConstMacro( PatientIndex, int );
itkSetMacro( PatientIndex, int );
itkGetConstMacro( ScannerID, int );
itkSetMacro( ScannerID, int );
itkGetConstMacro( SliceThickness, double );
itkSetMacro( SliceThickness, double );
itkGetConstMacro( SliceIncrement, double );
itkSetMacro( SliceIncrement, double );
itkGetConstMacro( StartPosition, double );
itkSetMacro( StartPosition, double );
/** Set / Get the minimum and maximum values */
const double * GetDataRange() const { return this->m_DataRange; }
void SetDataRange( const double * dataRange )
{
this->m_DataRange[0] = dataRange[0];
this->m_DataRange[1] = dataRange[1];
}
itkGetConstMacro( MuScaling, double );
itkSetMacro( MuScaling, double );
itkGetConstMacro( NumberOfSamples, int );
itkSetMacro( NumberOfSamples, int );
itkGetConstMacro( NumberOfProjections, int );
itkSetMacro( NumberOfProjections, int );
itkGetConstMacro( ScanDistance, double );
itkSetMacro( ScanDistance, double );
itkGetConstMacro( ScannerType, int );
itkSetMacro( ScannerType, int );
itkGetConstMacro( SampleTime, double );
itkSetMacro( SampleTime, double );
itkGetConstMacro( MeasurementIndex, int );
itkSetMacro( MeasurementIndex, int );
itkGetConstMacro( Site, int );
itkSetMacro( Site, int );
itkGetConstMacro( ReferenceLine, int );
itkSetMacro( ReferenceLine, int );
itkGetConstMacro( ReconstructionAlg, int );
itkSetMacro( ReconstructionAlg, int );
/** Get a string that states patient name.
* Max size: 40 characters. */
const char *GetPatientName() const { return this->m_PatientName; }
void SetPatientName( const char * version )
{
strcpy(this->m_PatientName, version);
this->Modified();
}
itkGetConstMacro( Energy, double );
itkSetMacro( Energy, double );
itkGetConstMacro( Intensity, double );
itkSetMacro( Intensity, double );

@thewtex thewtex closed this as completed Feb 25, 2020
@sbonaretti
Copy link
Collaborator Author

sbonaretti commented Apr 16, 2020

Thanks! Got it! For anybody who might need it in python:

After reading the image:

ImageType = itk.Image[itk.ctype('signed short'), 3]
reader = itk.ImageFileReader[ImageType].New()
imageio = itk.ScancoImageIO.New()
reader.SetImageIO(imageio)
reader.SetFileName(file_name) # change to your filename here
reader.Update()

Get the header fields:

print(imageio.GetPatientIndex())
print(imageio.GetScannerID())
print(imageio.GetSliceThickness())
print(imageio.GetSliceIncrement())
print(imageio.GetStartPosition())
print(imageio.GetMuScaling())
print(imageio.GetNumberOfSamples())
print(imageio.GetNumberOfProjections())
print(imageio.GetScanDistance())
print(imageio.GetScannerType())
print(imageio.GetSampleTime())
print(imageio.GetMeasurementIndex())
print(imageio.GetSite())
print(imageio.GetReferenceLine())
print(imageio.GetReconstructionAlg())
print(imageio.GetEnergy())
print(imageio.GetIntensity())
print(imageio.GetPatientName())

@sbonaretti
Copy link
Collaborator Author

Hi,
Is there any way to get CreationDate and ModificationDate in python?
Thanks a lot,
Serena

@thewtex
Copy link
Member

thewtex commented May 7, 2020

Hi @sbonaretti ,

Yes, this should do it: #30

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

No branches or pull requests

2 participants