Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
bd65de5
ENH: Initial file structure
thewtex May 7, 2017
8fde676
ENH: Enable External module configuration
thewtex May 7, 2017
5bb5f2b
BUG: Use temporary local testing file
thewtex May 8, 2017
f742de1
COMP: Fix export macro includes
thewtex May 8, 2017
8029ecf
ENH: Implement CanReadFile
thewtex May 8, 2017
f18d57d
ENH: Implement ReadImageInformation
thewtex May 9, 2017
43efeab
ENH: Implement Read()
thewtex May 10, 2017
22b3c56
ENH: Add initial test
thewtex May 10, 2017
0cd567d
BUG: Dimensions are off by one
thewtex May 10, 2017
6b6086a
BUG: Consider the component size when populating the buffer
thewtex May 10, 2017
93e99e8
ENH: Add test baseline comparison
thewtex May 12, 2017
2fe2f1d
ENH: CanWriteFile
thewtex May 12, 2017
b8aebc2
ENH: Write the first part of the header
thewtex May 13, 2017
44b5a00
ENH: Add EncodeInt, GetPatientIndex
thewtex May 16, 2017
ebf62bd
ENH: Add GetScannerID
thewtex May 16, 2017
7440d46
ENH: EncodeDate
thewtex May 16, 2017
17615f7
ENH: SliceThickness and SliceIncrement
thewtex May 16, 2017
ddd210f
ENH: StartPosition
thewtex May 16, 2017
dd7a646
ENH: DataRange
thewtex May 16, 2017
d655414
ENH: MuScaling
thewtex May 16, 2017
543a325
ENH: NumberOfSamples
thewtex May 16, 2017
e7d8941
ENH: NumberOfProjections
thewtex May 16, 2017
35be3a9
ENH: ScannerType and ScanDistance
thewtex May 16, 2017
a13c76f
ENH: SampleTime
thewtex May 16, 2017
11618cd
ENH: MeasurementIndex Site ReferenceLine ReconstructionAlg
thewtex May 16, 2017
5b4a70c
ENH: PatientName
thewtex May 16, 2017
e41bddc
ENH: Energy Intensity
thewtex May 16, 2017
fa318b9
BUG: Set HeaderSize Compression when writing
thewtex May 16, 2017
a421ff6
ENH: Write method
thewtex May 19, 2017
42151aa
ENH: Add testing data
thewtex May 19, 2017
124f061
STYLE: Address KWStyle issues
thewtex May 19, 2017
ae707d2
COMP: Define _CRT_SECURE_NO_WARNINGS
thewtex Mar 31, 2019
2d28a56
DOC: Merge pull request #1 from thewtex/readme-update
thewtex Mar 31, 2019
26c36ad
DOC: Improve `README` file
jhlegarreta Mar 31, 2019
6fe758e
COMP: Move ITK_DISALLOW_COPY_AND_ASSIGN calls to public section
jhlegarreta Mar 31, 2019
5dcb51b
STYLE: Prefer C++11 type alias over typedef
jhlegarreta Mar 31, 2019
0e40fde
STYLE: Prefer constexpr for const numeric literals
jhlegarreta Mar 31, 2019
4698044
STYLE: Prefer = default to explicitly trivial implementations
jhlegarreta Mar 31, 2019
71136fe
COMP: Use C++11 override directly
jhlegarreta Mar 31, 2019
7c6d331
ENH: Merge pull request #9 from jhlegarreta/PreferC++11TypeAliasOverT…
thewtex Mar 31, 2019
3410080
ENH: Merge pull request #8 from jhlegarreta/MoveITKDisallowCopyAndAss…
thewtex Mar 31, 2019
d14a14e
ENH: Merge branch 'master' into PreferConstExprForConstNumericLiterals
thewtex Apr 1, 2019
44ee093
ENH: Merge branch 'master' into PreferDefaultToExplicitTrivialImpleme…
thewtex Apr 1, 2019
c718a8c
ENH: Merge pull request #6 from jhlegarreta/UseC++11OverrideDirectly
thewtex Apr 1, 2019
38ab49a
DOC: Merge pull request #11 from jhlegarreta/ImproveREADME
thewtex Apr 1, 2019
d3b76b0
ENH: Merge pull request #7 from jhlegarreta/PreferConstExprForConstNu…
thewtex Apr 1, 2019
4afe2ce
ENH: Merge pull request #5 from jhlegarreta/PreferDefaultToExplicitTr…
thewtex Apr 1, 2019
0dd4e7a
ENH: Add ImageIO::Scanco to module FACTORY_NAMES
thewtex Apr 1, 2019
cf446d7
ENH: Merge pull request #13 from thewtex/factory-registration
thewtex Apr 2, 2019
8de7a70
COMP: Suppress unused numBytes numBlocks warnings
thewtex Apr 2, 2019
a6323c9
ENH: Merge pull request #15 from thewtex/unused-variables
thewtex Apr 2, 2019
c271276
STYLE: Add ITK prefix to testing macros
jhlegarreta Jun 15, 2019
043491d
ENH: Improve tests
jhlegarreta Mar 31, 2019
1b24e5b
ENH: update version numbers
dzenanz Oct 15, 2019
39e8180
ENH: Merge pull request #10 from jhlegarreta/ImproveTests
thewtex Oct 15, 2019
1c08151
ENH: Update enums from recent enum changes in ITK
mseng10 Feb 18, 2020
8a93f21
STYLE: Remove redundant void argument lists
hjmjohnson Feb 17, 2020
788b286
STYLE: Make prototype match definition names
hjmjohnson Feb 17, 2020
754f70d
STYLE: Use auto for variable type matches the type of the initializer
hjmjohnson Feb 17, 2020
d4a4d58
COMP: Use nullptr instead of 0 or NULL
hjmjohnson Feb 17, 2020
5c342f5
STYLE: Replace integer literals which are cast to bool.
hjmjohnson Feb 17, 2020
7b31b75
STYLE: Use override statements for C++11
hjmjohnson Feb 17, 2020
50fd069
STYLE: Use default member initialization
hjmjohnson Feb 17, 2020
b85055e
STYLE: Use range-based loops from C++11
hjmjohnson Feb 18, 2020
de8e2d8
PERF: readability container size empty
hjmjohnson Feb 18, 2020
7ff712b
DOC: Update copyright assignment to NumFOCUS
hjmjohnson Feb 19, 2020
94b22f4
ENH: Update CI to build against ITK 5.1 RC 2
thewtex Feb 25, 2020
68446dc
ENH: Expose CreationDate and ModificationDate in the API
thewtex May 7, 2020
876070d
ENH: Merge pull request #30 from thewtex/creation-modification-date
thewtex May 7, 2020
e158fd6
BUG: Fix ReadAIMHeader to work with short images (#36)
mkuczyns Dec 29, 2020
2c4fdbf
STYLE: Rename ITK_DISALLOW_COPY_AND_ASSIGN to ITK_DISALLOW_COPY_AND_MOVE
mseng10 Oct 16, 2020
d77ebf6
COMP: Add missing ';' at end of macro
mseng10 Dec 29, 2020
efb77de
STYLE: remove unnecessary space
dzenanz Jan 5, 2021
acbf09c
ENH: Convert Images to HU by Default
mkuczyns Jan 21, 2021
2b30b72
ENH: Add Tests for AIM Reading
mkuczyns Feb 11, 2021
7944a0b
STYLE: Update Output File Names in Tests
mkuczyns Feb 11, 2021
0da7f89
BUG: Updated Baseline AIM Image to Pass Tests
mkuczyns Feb 11, 2021
910687a
ENH: Merge pull request #43 from mkuczyns/add-aim-tests
thewtex Feb 11, 2021
2cbc51d
ENH: enable writing ISQ files
dzenanz Feb 16, 2021
87cff0b
ENH: avoid possible buffer overflows on string ivar setters
dzenanz Feb 16, 2021
7d2468d
PERF: do not re-scale the data if there is no need for it
dzenanz Feb 16, 2021
8ca4f43
ENH: Merge pull request #44 from dzenanz/master
thewtex Mar 3, 2021
121e9c3
ENH: Populate the Image MetaDataDictionary when reading
thewtex Mar 3, 2021
95fae6f
ENH: Populate the Image MetaDataDictionary when reading
thewtex Mar 3, 2021
fa18268
ENH: Merge pull request #47 from thewtex/metadata-dictionary
thewtex Mar 10, 2021
0dbb9fc
ENH: Initializing MuWater constant to the usual value
dzenanz Mar 22, 2021
4eea1ba
ENH: Merge pull request #48 from dzenanz/master
thewtex Mar 23, 2021
bf98198
BUG: do not crash in CanReadFile if the path does not exist
dzenanz Mar 31, 2021
2cbea2b
ENH: Apply rescaling to compressed images (#56)
mkuczyns May 6, 2021
5f4a3ac
STYLE: initialize the header fields in the order of declaration
dzenanz May 4, 2021
fabe660
ENH: add support for writing metadata
dzenanz May 4, 2021
7425f37
ENH: Compare the image with updated metadata
dzenanz May 6, 2021
9c39ac7
ENH: Merge pull request #55 from dzenanz/master
dzenanz May 12, 2021
b85526a
ENH: Avoid re-scaling when image is converted to AIM format
dzenanz May 12, 2021
f8b4b37
ENH: remove unsupported write extensions
dzenanz Dec 15, 2021
2cfa5cb
ENH: Make use of improvements in ImageIO file extensions
dzenanz Dec 15, 2021
40a9946
STYLE: Prefer itk::Math::abs for consistency.
hjmjohnson Dec 17, 2021
6a842be
ENH: Bump ITK and change http to https
tbirdso May 31, 2022
e49da36
STYLE: Merge pull request #62 from KitwareMedical/bump_and_format
tbirdso Jun 2, 2022
284824e
ENH: Adding get/set functions for missing header parameters
mkuczyns Aug 13, 2022
a4815b8
ENH: Updated tests for new get/set functions
mkuczyns Sep 8, 2022
a3e1f04
COMP: Use modern macro for name of class
hjmjohnson Jan 25, 2025
e5e12e8
ENH: Merge pull request #86 from hjmjohnson/fix-legacy-remove
dzenanz May 27, 2025
580d0ff
COMP: Safe DataRange access
thewtex May 26, 2025
48aa471
COMP: Safe setting of DataRange after ExposeMetaData
thewtex May 26, 2025
cd4efaf
ENH: Merge pull request #88 from dzenanz/itk-5.4-ci
dzenanz May 27, 2025
fdfdb7e
BUG: Have header keep original rescale slope/intercept values
May 26, 2025
73934bb
ENH: fix creation date output in header and some associated refactoring
ebald19 Jun 3, 2025
4116e41
ENH: Squashed commit of the following:
ebald19 Jun 17, 2025
613f1b5
ENH: Merge pull request #96 from ORMIR-XCT/enhancement/incorporate_ai…
thewtex Jun 19, 2025
1e76159
ENH: Merge changes from main:
ebald19 May 27, 2025
0601ff3
ENH: Add tests for aim writer
ebald19 Jun 11, 2025
9f05207
STYLE: add testing for float and v030 aim
ebald19 Jun 17, 2025
1dea2d7
ENH: Squashed commit of the following:
ebald19 Jun 17, 2025
608a2b8
ENH: Merge remote-tracking branch 'origin/master' into
ebald19 Jun 19, 2025
542b9f2
BUG: align type comparisons
ebald19 Jun 20, 2025
ce9d94a
BUG: fix type cast warnings
ebald19 Jun 23, 2025
fdfe94d
ENH: Merge pull request #97 from ORMIR-XCT/enhancement/read_write_aim…
dzenanz Jun 24, 2025
4767a92
COMP: Add missing module dependency on ITKIOImageBase
dzenanz Mar 11, 2026
d5d02d7
ENH: Convert from md5 to .cid tags.
hjmjohnson Apr 22, 2026
3cce9a8
BUG: Replace strncpy with snprintf to ensure NUL termination
hjmjohnson Apr 30, 2026
43107e6
STYLE: Replace fixed-width Scanco field magic numbers with constexpr
hjmjohnson Apr 30, 2026
f9bf06c
ENH: Ingest ITKIOScanco into Modules/IO
hjmjohnson May 14, 2026
d207530
COMP: Remove IOScanco .remote.cmake (in-tree)
hjmjohnson May 14, 2026
577058d
ENH: Enable Module_IOScanco in configure-ci pixi task
hjmjohnson May 14, 2026
aff3c0f
ENH: Normalize C0004255.ISQ to CID content-link (now in ITKTestingData)
hjmjohnson May 14, 2026
d4a96ec
BUG: Fix PadString writing twice the expected byte count
hjmjohnson May 14, 2026
60517f0
BUG: Use bounded comparison for Scanco magic string check
hjmjohnson May 14, 2026
504267d
BUG: Make CheckVersion return non-zero only for recognized Scanco for…
hjmjohnson May 14, 2026
877a779
BUG: Preserve VECTOR pixel type for multi-component AIM data
hjmjohnson May 14, 2026
3b267eb
BUG: Use m_FileName in WriteHeader and fix newline escape typo
hjmjohnson May 14, 2026
ba4ba5b
COMP: Scope _CRT_SECURE_NO_WARNINGS to the ITKIOScanco target
hjmjohnson May 14, 2026
191e28d
COMP: Revert C0004255.ISQ to .sha512 content-link (blob exceeds GitHu…
hjmjohnson May 14, 2026
6edcd94
COMP: Gate C0004255.ISQ tests behind ITK_BUILD_BIG_DATA_TESTS
hjmjohnson May 14, 2026
d25934f
COMP: Gate C0004255 tests on memory size; baseline .cid -> .sha512
hjmjohnson May 14, 2026
4ba7528
COMP: Remove stale standalone-build branch from CMakeLists
hjmjohnson May 14, 2026
92836f2
COMP: Switch fixtures to .cid content-links (blob in ITKTestingData P…
hjmjohnson May 14, 2026
66fdff6
BUG: Recognize legacy pre-magic AIM v020 files in CheckVersion
hjmjohnson May 14, 2026
98f5d3b
Merge branch 'main' into ingest-IOScanco
hjmjohnson May 17, 2026
41aea5e
BUG: Fix Scanco AIM processing-log buffer overflow
hjmjohnson May 17, 2026
98e2a14
COMP: Curate and alphabetically sort Pixi-Cxx module list
hjmjohnson May 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Modules/IO/IOScanco/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
project(IOScanco)
set(IOScanco_LIBRARIES IOScanco)

itk_module_impl()
127 changes: 127 additions & 0 deletions Modules/IO/IOScanco/include/itkAIMHeaderIO.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
/*=========================================================================
*
* Copyright NumFOCUS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/

#ifndef itkAIMHeaderIO_h
#define itkAIMHeaderIO_h
#include "itkScancoHeaderIO.h"
#include <sstream>

struct AIMV020StructHeader;
struct AIMV030StructHeader;

namespace itk
{
class AIMHeaderIO : public ScancoHeaderIO
{
public:
using ScancoHeaderIO::ScancoHeaderIO;

~AIMHeaderIO();

/** Read the header from an infile.
* Fills in the m_HeaderData structure with the header information.
* \param infile The input file stream to read the header from.
* \throws std::runtime_error if the file cannot be opened or read.
* \note Overrides base class virtual method
*/
unsigned long
ReadHeader(std::ifstream & infile) override;

/** Write the header to an open file stream.
* \param outfile Pointer to an open std::ofstream where the header will be written.
* \param imageSize size of the image that will be written after the header, in bytes
* \throws std::runtime_error if headerData is null.
* \note overrides base class virtual method
* \returns number of bytes written to the file.
*/
unsigned long
WriteHeader(std::ofstream & outfile, unsigned long imageSize) override;

protected:
/** Read the AIM pre-header from the file stream.
* \param file The input file stream to read the header from.
* \param offset The offset in the file to start reading from.
* \note m_IntSize is used to determine the size of integers in the pre-header,
* and should be set appropriately before calling
* \returns -1 on failure, 0 on success.
*/
int
ReadPreHeader(std::ifstream & file, size_t offset = 0);

/** Read the AIM v020 image structure header from a data structure.
* \param headerData pointer to structure containing image structure header
*/
void
ReadImgStructHeader(AIMV020StructHeader * headerData);

/** Read the AIM v030 image structure header from a data structure.
* \param headerData pointer to structure containing image structure header
* \overload ReadImgStructHeader for AIM v020
*/
void
ReadImgStructHeader(AIMV030StructHeader * headerData);

/** Read the AIM processing log from the file stream.
* \param file The input file stream to read the header from.
* \param length The length of the processing log to read.
* \param offset The offset in the file to start reading from.
* \returns size of the processing log read
*/
size_t
ReadProcessingLog(std::ifstream & infile, size_t offset, size_t length);

/** Write the image structure header to an AIM v020 data structure
* \returns AIMV020StructHeader structure filled with encoded header data
*/
AIMV020StructHeader
WriteStructHeaderV020();

/** Write the image structure header to an AIM v030 data structure
* \returns AIMV030StructHeader structure filled with encoded header data
*/
AIMV030StructHeader
WriteStructHeaderV030();

/** Write the processing log to a string.
* \returns std::string containing the processing log populated with the header data
*/
std::string
WriteProcessingLog();

/** Write the image pre-header to a file
* \param outfile The output file stream to write the pre-header to
* \param imageSize size of the image that will be written after the header, in bytes
* \param version The AIM file version to write (default is AIM_020)
* \returns number of bytes written to the file
* \note pre-header is written into the current file pointer of the outfile stream
* \note pre-header blocks are written based on imageSize, m_ImgStructSize, and m_ProcessingLogSize,
* which should be set accordingly
*/
size_t
WritePreHeader(std::ofstream & outfile, size_t imageSize, ScancoFileVersions version = ScancoFileVersions::AIM_020);

private:
unsigned int m_IntSize{ 4 }; // Size of integers in the header (4 for AIM v020, 8 for AIM v030)

/** Header Size = m_PreHeaderSize + m_ImgStructSize + m_ProcessingLogSize */
size_t m_PreHeaderSize{ 0 };
size_t m_ImgStructSize{ 0 };
size_t m_ProcessingLogSize{ 0 };
};
} // namespace itk
#endif // itkAIMHeaderIO_h
118 changes: 118 additions & 0 deletions Modules/IO/IOScanco/include/itkISQHeaderIO.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/*=========================================================================
*
* Copyright NumFOCUS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/

#ifndef itkISQHeaderIO_h
#define itkISQHeaderIO_h
#include "itkScancoHeaderIO.h"

struct ISQEncodedPreHeader;
struct ISQEncodedHeaderBlock;
struct RADEncodedHeaderBlock;

namespace itk
{
class ISQHeaderIO : public ScancoHeaderIO
{
public:
using ScancoHeaderIO::ScancoHeaderIO;

/** Read the header from an infile.
* Fills in the m_HeaderData structure with the header information.
* \param infile The input file stream to read the header from.
* \throws std::runtime_error if the file cannot be opened or read.
* \note Overrides base class virtual method
*/
unsigned long
ReadHeader(std::ifstream & infile) override;

/** Write the header to an open file stream.
* \param outfile Pointer to an open std::ofstream where the header will be written.
* \throws std::runtime_error if headerData is null.
* \returns number of bytes written to the file.
*/
unsigned long
WriteHeader(std::ofstream & outfile, unsigned long imageSize) override;

private:
/** Read date into creation and modification date strings
* \param year The Gregorian year.
* \param month The Gregorian month (1-12).
* \param day The Gregorian day (1-31).
* \param hour The hour (0-23).
* \param minute The minute (0-59).
* \param second The second (0-59).
* \param millis The milliseconds (0-999).
*/
void
ReadDateValues(const int year,
const int month,
const int day,
const int hour,
const int minute,
const int second,
const int milli);

/** Parse and Save pixel and physical dimension values
* Values are converted into appropriate units
* \see unit conversions in itkScancoImageIO.h
* \param imageData encoded data of at least 24 bytes to read from
* \returns true if the file is a RAD file based on the dimension data,
* false otherise
*/
bool
ReadDimensionData(ISQEncodedPreHeader * imageData);

/** Read RAD header values and convert units appropriately
* \see unit conversions in itkScancoImageIO.h
* \param headerData struct holding encoded RAD header data
*/
void
ReadRADHeader(RADEncodedHeaderBlock * headerData);

/** Read ISQ header values and convert units appropriately
* \see unit conversions in itkScancoImageIO.h
* \param headerData struct holding encoded ISQ header data
*/
void
ReadISQHeader(ISQEncodedHeaderBlock * headerData);

/** Read in extended header data
* This may include a multi-header section with calibration data
* \param buffer pointer to start of extended header data
* \param length length of extended header,
* this can be calculated from the data offset found in the last 4 bytes of the main header block
* \note length must be at least 3 blocks
* \note buffer must be at least length bytes
*/
void
ReadExtendedHeader(const char * buffer, unsigned long length);

/** Write Calibration data to extended header blocks
* \param outfile file to write data to
* \note requires first block (512 bytes) to be written with header data
* \returns number of bytes written to the file
*/
unsigned long
WriteExtendedHeader(std::ofstream & outfile);

unsigned long m_HeaderSize;
};

} // namespace itk

#endif // itkISQHeaderIO_h
Loading
Loading